13.5.1.1-1 baseline

Former-commit-id: 6ccc6d533c57302d87b49920a236f9f033c90c14
This commit is contained in:
Steve Harris 2013-09-12 11:03:55 -04:00
parent a60b097050
commit 5b0cd7cbcc
8 changed files with 129 additions and 223 deletions

View file

@ -63,7 +63,6 @@ import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
@ -152,6 +151,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 02/12/2013 #1597 randerso Code cleanup. Fixed possible widget disposed errors on shut down.
* 05/08/2013 #1842 dgilling Add alternate setProductText(), fix
* warnings.
* 09/03/2013 16534 ryu Refactor; sneak in a change for Ron (RM #1597).
*
* </pre>
*
@ -1851,7 +1851,7 @@ public class ProductEditorComp extends Composite implements
}
// convert to hours and check bounds
Float purgeOffset = (float) (offset / TimeUtil.SECONDS_PER_HOUR);
Float purgeOffset = offset / ((float) TimeUtil.SECONDS_PER_HOUR);
purgeOffset = Math.min(purgeOffset, 24F);
purgeOffset = Math.max(purgeOffset, 1F);
@ -2868,21 +2868,16 @@ public class ProductEditorComp extends Composite implements
}
// Look for locked text in the selection
StyleRange[] styleRanges = styledText.getStyleRanges(selectionRange.x,
selectionRange.y);
Color lockedColor = textComp.getLockColor();
for (StyleRange styleRange : styleRanges) {
if (lockedColor.equals(styleRange.foreground)) {
String msg2 = "Selection contains locked text\n\n ";
MessageBox mb2 = new MessageBox(getShell(), SWT.OK
| SWT.ICON_WARNING);
mb2.setText("CTA");
mb2.setMessage(msg2);
mb2.open();
return;
}
if (textComp.rangeHasLockedText(selectionRange.x, selectionRange.y)) {
String msg2 = "Selection contains locked text\n\n ";
MessageBox mb2 = new MessageBox(getShell(), SWT.OK
| SWT.ICON_WARNING);
mb2.setText("CTA");
mb2.setMessage(msg2);
mb2.open();
return;
}
// Word-wrap the whole selection.
int curLine = styledText.getLineAtOffset(selectionRange.x);
int lastSelIdx = selectionRange.x + selectionRange.y - 1;

View file

@ -80,6 +80,7 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
* 26 Sep 2012 15423 ryu Avoid resetting text when possible.
* 03 Dec 2012 15620 ryu Unlock framed cities list for editing.
* 30 APR 2013 16095 ryu Modified updateTextStyle() to not lock edited text.
* 04 SEP 2013 16534 ryu Fixed word wrap to not insert duplicate text; refactor.
*
* </pre>
*
@ -332,19 +333,6 @@ public class StyledTextComp extends Composite {
newProduct = false;
}
/**
* computes the logical caret offset within the ProductEditor as a result of
* the CTA insert.
*
* @param newProductText
* The new product text
*/
private int caretOffsetAfterCTAInsert(String newProductText) {
int currentProductTextLength = textEditorST.getText().length();
int displacement = newProductText.length() - currentProductTextLength;
return displacement + textEditorST.getCaretOffset();
}
/**
* Lock the parts of the text that needs to be uneditable.
*/
@ -576,7 +564,7 @@ public class StyledTextComp extends Composite {
replaceText(ff, SPC + newfield);
}
} else {
String s = SPC + newfield;
String s = SPC + newfield;
if (!ff.getText().equals(s)) {
replaceText(ff, s);
}
@ -820,7 +808,7 @@ public class StyledTextComp extends Composite {
* @return Whether or not there is text in the range that contains locked
* text.
*/
private boolean rangeHasLockedText(int offset, int length) {
protected boolean rangeHasLockedText(int offset, int length) {
StyleRange[] ranges = textEditorST.getStyleRanges(offset, length);
for (StyleRange range : ranges) {
@ -1348,17 +1336,8 @@ public class StyledTextComp extends Composite {
line = st.getLine(searchLine);
int lineOffset = st.getOffsetAtLine(searchLine);
// if line contains locked text, quit looking.
StyleRange[] styleRanges = st.getStyleRanges(lineOffset,
line.length());
boolean locked = false;
for (StyleRange range : styleRanges) {
if (range.foreground.equals(lockColor)) {
locked = true;
break;
}
}
if (locked) {
// if line contains locked text, quit looking.
if (rangeHasLockedText(lineOffset, line.length())) {
break;
}
@ -1390,16 +1369,7 @@ public class StyledTextComp extends Composite {
line = st.getLine(searchLine);
// don't use locked text
StyleRange[] ranges = st.getStyleRanges(lineStartOffset,
line.length());
boolean locked = false;
for (StyleRange range : ranges) {
if (range.foreground.equals(lockColor)) {
locked = true;
break;
}
}
if (locked) {
if (rangeHasLockedText(lineStartOffset, line.length())) {
break;
}
@ -1423,6 +1393,10 @@ public class StyledTextComp extends Composite {
if (endIndex >= st.getCharCount()) {
endIndex = st.getCharCount() - 1;
}
if (endIndex < startIndex) {
return new int[] { startIndex, endIndex, 0 };
}
// get the block text before the cursor
String pre = "";

View file

@ -381,6 +381,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
final QcPrecipOptionsDialog dialog = new QcPrecipOptionsDialog(
getParentShell().getShell());
display.asyncExec(new Runnable() {
@Override
public void run() {
dialog.open();
}
@ -407,6 +408,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
final QcTempOptionsDialog dialog = new QcTempOptionsDialog(
getParentShell().getShell());
display.asyncExec(new Runnable() {
@Override
public void run() {
dialog.open();
}
@ -433,6 +435,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
final QcFreezeOptionsDialog dialog = new QcFreezeOptionsDialog(
getParentShell().getShell());
display.asyncExec(new Runnable() {
@Override
public void run() {
dialog.open();
}
@ -559,7 +562,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
j = area_names.length();
}
aList.add(area_names.substring(i, j));
i += j + 1;
i = j + 1;
}
} else {
aList.add(0, area_names.trim());

View file

@ -55,6 +55,8 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Maps;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 4, 2009 snaples Initial creation
* Aug 12, 2013 16490 snaples Fixed mapping of hrap grid to basins
* in get_basin_data
*
* </pre>
*
@ -75,7 +77,6 @@ public class GetBasinData {
int ib, l, numpts, ip, x, y, ip2, ip3, ip4, i;
int hrap_basin_flag = 1;
double lat, lon;
int m;
int mm;
int num_points;
File basin_f = new File(basin_file);
@ -150,20 +151,14 @@ public class GetBasinData {
ib++;
}
// mean_areal_precip_global[ib] = dc.new Maps();
// mean_areal_precip_global[ib].hb5 = "";
maxib = ib;
System.out.println("Size of map array is : " + maxib + " basins");
s.close();
in.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block. Please revise as
// appropriate.
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
return false;
} catch (IOException e) {
// TODO Auto-generated catch block. Please revise as
// appropriate.
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
return false;
} catch (NumberFormatException e) {
@ -192,7 +187,6 @@ public class GetBasinData {
mean_areal_precip_global[ib].tmaps_done = new int[200];
mean_areal_precip_global[ib].zmaps_done = new int[200];
// for (m = 0; m < 200; m++) {
Arrays.fill(mean_areal_precip_global[ib].gz, -1);
Arrays.fill(mean_areal_precip_global[ib].uz, -1);
Arrays.fill(mean_areal_precip_global[ib].mz, -1);
@ -209,30 +203,31 @@ public class GetBasinData {
Arrays.fill(mean_areal_precip_global[ib].tmaps_done, -1);
Arrays.fill(mean_areal_precip_global[ib].zmaps_done, -1);
// }
}
if (hrap_basin_flag == 1) {
try {
System.out.println("Reading basin data from file.");
System.out.println("Reading hrap basin data from file.");
long basin_start = System.currentTimeMillis();
in = new BufferedReader(new FileReader(hrap_f));
char eb[] = new char[100];
Scanner s = new Scanner(in);
String eb = new String();
for (ib = 0; ib < maxib; ib++) {
in.read(eb, 0, 80);
int p = new String(eb).indexOf('\n');
eb = in.readLine(); //(eb, 0, 80);
int p = eb.length(); //new String(eb).indexOf('\n');
if (p != -1) {
p = 0;
}
String t = new String(eb);
Scanner s = new Scanner(t);
eb = eb.trim();
s = new Scanner(eb);
Pattern pc = Pattern.compile("\\s*[A-Z]+$");
numpts = s.nextInt();
mean_areal_precip_global[ib].hrap_points = numpts;
String bchar = "";
bchar = s.findInLine("*$");
mean_areal_precip_global[ib].bchar = bchar;
bchar = s.findInLine(pc);
mean_areal_precip_global[ib].bchar = bchar.trim();
mean_areal_precip_global[ib].hrap_data = new Hrap_Data[numpts];
for (mm = 0; mm < 4; mm++) {
@ -240,42 +235,34 @@ public class GetBasinData {
}
for (l = 0; l < numpts; l++) {
Hrap_Data d = dc.new Hrap_Data();
mean_areal_precip_global[ib].hrap_data[l] = d;
for (mm = 0; mm < 4; mm++) {
mean_areal_precip_global[ib].hrap_data[l].zone[mm] = -1;
}
p = in.read(eb, 0, 100);
eb = in.readLine(); //(eb, 0, 100);
eb = eb.trim();
p = eb.length();
if (p == 0) {
break;
}
t = new String(eb);
// ier = sscanf (ibuf, "%d %d %d %d %d %d\n", &x, &y,
// &ip, &ip2, &ip3,&ip4);
s = new Scanner(eb);
x = s.nextInt();
y = s.nextInt();
if (s.hasNextInt()) {
ip = s.nextInt();
if (ip < 0 || ip > 4) {
System.out
.println("HRAP error in read_basin_data routine.\n");
return false;
}
ip2 = s.nextInt();
ip3 = s.nextInt();
ip4 = s.nextInt();
mean_areal_precip_global[ib].hrap_data[l].x = x;
mean_areal_precip_global[ib].hrap_data[l].y = y;
mean_areal_precip_global[ib].hrap_data[l].zone[ip - 1] = 1;
mean_areal_precip_global[ib].zones[0] = 1;
if (s.hasNextInt()) {
ip2 = s.nextInt();
if (ip2 < 0 || ip2 > 4) {
System.out
.println("HRAP error in read_basin_data routine.\n");
@ -288,7 +275,7 @@ public class GetBasinData {
}
if (s.hasNextInt()) {
ip3 = s.nextInt();
if (ip3 < 0 || ip3 > 4) {
System.out
.println("HRAP error in read_basin_data routine.\n");
@ -301,7 +288,7 @@ public class GetBasinData {
}
if (s.hasNextInt()) {
ip4 = s.nextInt();
if (ip4 < 0 || ip4 > 4) {
System.out
.println("HRAP error in read_basin_data routine.\n");
@ -315,22 +302,18 @@ public class GetBasinData {
}
}
System.out
.println("Finished reading basin data from file, elapsed time: "
+ (System.currentTimeMillis() - basin_start)
+ " ms");
s.close();
in.close();
}
System.out
.println("Finished reading basin data from file, elapsed time: "
+ (System.currentTimeMillis() - basin_start)
+ " ms");
s.close();
in.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block. Please revise as
// appropriate.
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
return false;
} catch (IOException e) {
// TODO Auto-generated catch block. Please revise as
// appropriate.
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
return false;

View file

@ -20,8 +20,9 @@
package com.raytheon.viz.texteditor.command;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@ -46,6 +47,7 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 18, 2013 rferrel Initial creation
* Aug 23, 2013 DR 16514 D. Friedman Fix accum/cancel logic.
*
* </pre>
*
@ -59,82 +61,53 @@ public class ProductQueryJob extends Job {
private final IProductQueryCallback callback;
/**
* flag to indicate request accumulate.
*/
private boolean accumulate;
/**
* List queries to perform.
*/
private final List<Request> requests;
/**
* Set of queries main thread is waiting for.
*/
private final Set<Request> expected;
/**
* Transport to use for the queries.
*/
private final IQueryTransport queryTransport;
/**
* Flag to indicate cancel is being performed.
*/
private final AtomicBoolean canceled;
public ProductQueryJob(IProductQueryCallback callback) {
super("Product Query");
setSystem(true);
this.callback = callback;
accumulate = false;
requests = new ArrayList<Request>();
expected = new HashSet<Request>();
queryTransport = TextEditorUtil.getTextDbsrvTransport();
canceled = new AtomicBoolean(false);
}
/**
* Add request to queue and determine what needs to be done to schedule the
* request.
* Add request to queue. If not an incremental update, cancel
* existing requests.
*
* @param command
* @param isObsUpdated
*/
public synchronized void addRequest(ICommand command, boolean isObsUpdated) {
Request request = new Request(command, isObsUpdated);
if (accumulate) {
requests.add(request);
if (getState() == Job.NONE) {
schedule();
}
} else {
requests.clear();
requests.add(request);
if (getState() == Job.NONE) {
schedule();
} else {
cancel();
}
}
}
public boolean isAccumulate() {
return accumulate;
}
/**
* When set to true requests will accumulate and be processed in the order
* received; otherwise the queue is purged and any current request is
* canceled if a new request is received.
*
* @param accumulate
*/
public void setAccumulate(boolean accumulate) {
if (this.accumulate != accumulate) {
synchronized (this) {
requests.clear();
if (getState() != Job.NONE) {
cancel();
}
this.accumulate = accumulate;
}
public synchronized void addRequest(ICommand command, boolean isObsUpdated,
boolean accumulate) {
Request request = new Request(command, isObsUpdated);
if (! accumulate && ! isObsUpdated) {
// Cancel existing requests.
expected.clear();
requests.clear();
}
requests.add(request);
expected.add(request);
schedule();
}
public boolean isExpectingRequests() {
return ! expected.isEmpty();
}
/*
@ -149,65 +122,44 @@ public class ProductQueryJob extends Job {
return Status.OK_STATUS;
}
Request request = null;
try {
while (true) {
synchronized (this) {
if (requests.size() > 0) {
request = requests.remove(0);
} else {
break;
}
while (true) {
final Request request;
synchronized (this) {
if (requests.size() > 0) {
request = requests.remove(0);
} else {
break;
}
}
List<StdTextProduct> prodList = null;
try {
try {
final ICommand command = request.getCommand();
final boolean isObsUpdated = request.isObsUpdated();
final List<StdTextProduct> prodList = command
.executeCommand(queryTransport);
// User may have canceled during long query.
if (!canceled.get()) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
callback.requestDone(command, prodList,
isObsUpdated);
}
});
} else {
break;
}
prodList = request.getCommand().
executeCommand(queryTransport);
} catch (CommandFailedException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
if (!canceled.get()) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
callback.requestDone(null, null, false);
}
});
}
}
} finally {
final List<StdTextProduct> resultProdList = prodList;
VizApp.runAsync(new Runnable() {
@Override
public void run() {
if (expected.remove(request) && resultProdList != null) {
callback.requestDone(request.getCommand(), resultProdList,
request.isObsUpdated());
} else {
callback.requestDone(null, null, false);
}
}
});
}
} finally {
canceled.set(false);
}
return Status.OK_STATUS;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.jobs.Job#canceling()
*/
@Override
protected void canceling() {
canceled.set(true);
}
/*
* Class to hold the query command and isObsUpdated flag needed for the
* query and its callback.

View file

@ -329,6 +329,8 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* add selection listener to catch the highlight words and
* set the highlight colors.
* 25July2013 15733 GHull Read font and color prefs from TextEditorCfg.
* 23Aug2013 DR 16514 D. Friedman Fix handling of completed product requests. Do not change
* command history or close browser window for "update obs".
*
* </pre>
*
@ -1101,11 +1103,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
*/
private boolean overwriteMode = false;
/**
* flag to indicate it a product request is from the GUI or an updated ob.
*/
private final AtomicInteger updateCount = new AtomicInteger(0);
/**
* The expire notification when editing a warn gen product.
*/
@ -3098,12 +3095,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
accumChkBtn = new Button(topBtnRowComp, SWT.CHECK);
accumChkBtn.setText("Accum");
accumChkBtn.setLayoutData(rd);
accumChkBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
productQueryJob.setAccumulate(accumChkBtn.getSelection());
}
});
// Add the Update Observation check button.
rd = new RowData(BUTTON_WIDTH, BUTTON_HEIGHT);
@ -5896,12 +5887,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
return;
}
if (browser != null) {
browser.close();
browser = null;
if (! isObsUpdated) {
if (browser != null) {
browser.close();
browser = null;
}
commandHistory.addCommand(command);
}
commandHistory.addCommand(command);
statusBarLabel.setText("Loading "
+ TextEditorUtil.getCommandText(command));
statusBarLabel.update();
@ -5910,7 +5904,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
if (queryTransport == null) {
queryTransport = TextEditorUtil.getTextDbsrvTransport();
}
productQueryJob.addRequest(command, isObsUpdated);
productQueryJob.addRequest(command, isObsUpdated,
accumChkBtn.getSelection());
}
/**
@ -5991,7 +5986,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
stripWMOHeaders(prod);
}
if (updateCount.get() > 0) {
if (isObsUpdated) {
updateDisplayedProduct(prod);
} else {
setDisplayedProduct(prod);
@ -6086,13 +6081,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private void postExecute(boolean hasAttachment, boolean enterEditor,
boolean validExecuteCommand, String attachedFilename) {
if (!this.isDisposed()) {
if (hasAttachment) {
statusBarLabel.setText("Attachment: " + attachedFilename);
} else {
statusBarLabel.setText("");
if (! productQueryJob.isExpectingRequests()) {
if (hasAttachment) {
statusBarLabel.setText("Attachment: " + attachedFilename);
} else {
statusBarLabel.setText("");
}
statusBarLabel.update();
setBusy(false);
}
statusBarLabel.update();
setBusy(false);
// Automatically open the editor window with returned data.
if (enterEditor) {
enterEditor();
@ -6471,7 +6468,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
@Override
public void setAccumulation(boolean flag) {
this.accumChkBtn.setSelection(flag);
productQueryJob.setAccumulate(flag);
}
/*
@ -6958,7 +6954,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
// retrieved for display in this text editor dialog
// instance.
TextDisplayModel.getInstance().setStdTextProduct(token, product);
updateCount.addAndGet(-1);
}
/*
@ -7309,7 +7304,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
msgPIL = "";
}
if (isObsDisplayed(msgPIL)) {
updateCount.addAndGet(1);
ICommand command = CommandFactory.getAfosCommand(msgPIL);
UpdateObsRun run = new UpdateObsRun(command);
VizApp.runSync(run);

View file

@ -60,6 +60,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 5, 2011 mpduff Initial creation
* Sep 5, 2013 16437 wkwock Fix the "HiRes" issue
*
* </pre>
*
@ -343,6 +344,9 @@ public class GAFF {
try {
uri = db.getDataURI(rfc, durString, today);
if (uri == null) {
uri = db.getDataURI(rfc+"-HiRes", durString, today);
}
if (uri == null) {
continue;
}

View file

@ -34,6 +34,7 @@ buildRPM ${SPECS}
if [ $? -ne 0 ]; then
exit 1
fi
exit 0
# build java 1.7
SPECS=1.7/component.spec