13.5.1.1-1 baseline
Former-commit-id: 6ccc6d533c57302d87b49920a236f9f033c90c14
This commit is contained in:
parent
a60b097050
commit
5b0cd7cbcc
8 changed files with 129 additions and 223 deletions
|
@ -63,7 +63,6 @@ import org.eclipse.swt.events.MouseAdapter;
|
||||||
import org.eclipse.swt.events.MouseEvent;
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.Color;
|
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.Font;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Image;
|
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.
|
* 02/12/2013 #1597 randerso Code cleanup. Fixed possible widget disposed errors on shut down.
|
||||||
* 05/08/2013 #1842 dgilling Add alternate setProductText(), fix
|
* 05/08/2013 #1842 dgilling Add alternate setProductText(), fix
|
||||||
* warnings.
|
* warnings.
|
||||||
|
* 09/03/2013 16534 ryu Refactor; sneak in a change for Ron (RM #1597).
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -1851,7 +1851,7 @@ public class ProductEditorComp extends Composite implements
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert to hours and check bounds
|
// 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.min(purgeOffset, 24F);
|
||||||
purgeOffset = Math.max(purgeOffset, 1F);
|
purgeOffset = Math.max(purgeOffset, 1F);
|
||||||
|
|
||||||
|
@ -2868,21 +2868,16 @@ public class ProductEditorComp extends Composite implements
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for locked text in the selection
|
// Look for locked text in the selection
|
||||||
StyleRange[] styleRanges = styledText.getStyleRanges(selectionRange.x,
|
if (textComp.rangeHasLockedText(selectionRange.x, selectionRange.y)) {
|
||||||
selectionRange.y);
|
String msg2 = "Selection contains locked text\n\n ";
|
||||||
Color lockedColor = textComp.getLockColor();
|
MessageBox mb2 = new MessageBox(getShell(), SWT.OK
|
||||||
for (StyleRange styleRange : styleRanges) {
|
| SWT.ICON_WARNING);
|
||||||
if (lockedColor.equals(styleRange.foreground)) {
|
mb2.setText("CTA");
|
||||||
String msg2 = "Selection contains locked text\n\n ";
|
mb2.setMessage(msg2);
|
||||||
MessageBox mb2 = new MessageBox(getShell(), SWT.OK
|
mb2.open();
|
||||||
| SWT.ICON_WARNING);
|
return;
|
||||||
mb2.setText("CTA");
|
|
||||||
mb2.setMessage(msg2);
|
|
||||||
mb2.open();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Word-wrap the whole selection.
|
// Word-wrap the whole selection.
|
||||||
int curLine = styledText.getLineAtOffset(selectionRange.x);
|
int curLine = styledText.getLineAtOffset(selectionRange.x);
|
||||||
int lastSelIdx = selectionRange.x + selectionRange.y - 1;
|
int lastSelIdx = selectionRange.x + selectionRange.y - 1;
|
||||||
|
|
|
@ -80,6 +80,7 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
|
||||||
* 26 Sep 2012 15423 ryu Avoid resetting text when possible.
|
* 26 Sep 2012 15423 ryu Avoid resetting text when possible.
|
||||||
* 03 Dec 2012 15620 ryu Unlock framed cities list for editing.
|
* 03 Dec 2012 15620 ryu Unlock framed cities list for editing.
|
||||||
* 30 APR 2013 16095 ryu Modified updateTextStyle() to not lock edited text.
|
* 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>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -332,19 +333,6 @@ public class StyledTextComp extends Composite {
|
||||||
newProduct = false;
|
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.
|
* Lock the parts of the text that needs to be uneditable.
|
||||||
*/
|
*/
|
||||||
|
@ -576,7 +564,7 @@ public class StyledTextComp extends Composite {
|
||||||
replaceText(ff, SPC + newfield);
|
replaceText(ff, SPC + newfield);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String s = SPC + newfield;
|
String s = SPC + newfield;
|
||||||
if (!ff.getText().equals(s)) {
|
if (!ff.getText().equals(s)) {
|
||||||
replaceText(ff, 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
|
* @return Whether or not there is text in the range that contains locked
|
||||||
* text.
|
* text.
|
||||||
*/
|
*/
|
||||||
private boolean rangeHasLockedText(int offset, int length) {
|
protected boolean rangeHasLockedText(int offset, int length) {
|
||||||
StyleRange[] ranges = textEditorST.getStyleRanges(offset, length);
|
StyleRange[] ranges = textEditorST.getStyleRanges(offset, length);
|
||||||
|
|
||||||
for (StyleRange range : ranges) {
|
for (StyleRange range : ranges) {
|
||||||
|
@ -1348,17 +1336,8 @@ public class StyledTextComp extends Composite {
|
||||||
line = st.getLine(searchLine);
|
line = st.getLine(searchLine);
|
||||||
int lineOffset = st.getOffsetAtLine(searchLine);
|
int lineOffset = st.getOffsetAtLine(searchLine);
|
||||||
|
|
||||||
// if line contains locked text, quit looking.
|
// if line contains locked text, quit looking.
|
||||||
StyleRange[] styleRanges = st.getStyleRanges(lineOffset,
|
if (rangeHasLockedText(lineOffset, line.length())) {
|
||||||
line.length());
|
|
||||||
boolean locked = false;
|
|
||||||
for (StyleRange range : styleRanges) {
|
|
||||||
if (range.foreground.equals(lockColor)) {
|
|
||||||
locked = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (locked) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1390,16 +1369,7 @@ public class StyledTextComp extends Composite {
|
||||||
line = st.getLine(searchLine);
|
line = st.getLine(searchLine);
|
||||||
|
|
||||||
// don't use locked text
|
// don't use locked text
|
||||||
StyleRange[] ranges = st.getStyleRanges(lineStartOffset,
|
if (rangeHasLockedText(lineStartOffset, line.length())) {
|
||||||
line.length());
|
|
||||||
boolean locked = false;
|
|
||||||
for (StyleRange range : ranges) {
|
|
||||||
if (range.foreground.equals(lockColor)) {
|
|
||||||
locked = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (locked) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1423,6 +1393,10 @@ public class StyledTextComp extends Composite {
|
||||||
if (endIndex >= st.getCharCount()) {
|
if (endIndex >= st.getCharCount()) {
|
||||||
endIndex = st.getCharCount() - 1;
|
endIndex = st.getCharCount() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (endIndex < startIndex) {
|
||||||
|
return new int[] { startIndex, endIndex, 0 };
|
||||||
|
}
|
||||||
|
|
||||||
// get the block text before the cursor
|
// get the block text before the cursor
|
||||||
String pre = "";
|
String pre = "";
|
||||||
|
|
|
@ -381,6 +381,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
|
||||||
final QcPrecipOptionsDialog dialog = new QcPrecipOptionsDialog(
|
final QcPrecipOptionsDialog dialog = new QcPrecipOptionsDialog(
|
||||||
getParentShell().getShell());
|
getParentShell().getShell());
|
||||||
display.asyncExec(new Runnable() {
|
display.asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
@ -407,6 +408,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
|
||||||
final QcTempOptionsDialog dialog = new QcTempOptionsDialog(
|
final QcTempOptionsDialog dialog = new QcTempOptionsDialog(
|
||||||
getParentShell().getShell());
|
getParentShell().getShell());
|
||||||
display.asyncExec(new Runnable() {
|
display.asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
@ -433,6 +435,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
|
||||||
final QcFreezeOptionsDialog dialog = new QcFreezeOptionsDialog(
|
final QcFreezeOptionsDialog dialog = new QcFreezeOptionsDialog(
|
||||||
getParentShell().getShell());
|
getParentShell().getShell());
|
||||||
display.asyncExec(new Runnable() {
|
display.asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
@ -559,7 +562,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
|
||||||
j = area_names.length();
|
j = area_names.length();
|
||||||
}
|
}
|
||||||
aList.add(area_names.substring(i, j));
|
aList.add(area_names.substring(i, j));
|
||||||
i += j + 1;
|
i = j + 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
aList.add(0, area_names.trim());
|
aList.add(0, area_names.trim());
|
||||||
|
|
|
@ -55,6 +55,8 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Maps;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Mar 4, 2009 snaples Initial creation
|
* Mar 4, 2009 snaples Initial creation
|
||||||
|
* Aug 12, 2013 16490 snaples Fixed mapping of hrap grid to basins
|
||||||
|
* in get_basin_data
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -75,7 +77,6 @@ public class GetBasinData {
|
||||||
int ib, l, numpts, ip, x, y, ip2, ip3, ip4, i;
|
int ib, l, numpts, ip, x, y, ip2, ip3, ip4, i;
|
||||||
int hrap_basin_flag = 1;
|
int hrap_basin_flag = 1;
|
||||||
double lat, lon;
|
double lat, lon;
|
||||||
int m;
|
|
||||||
int mm;
|
int mm;
|
||||||
int num_points;
|
int num_points;
|
||||||
File basin_f = new File(basin_file);
|
File basin_f = new File(basin_file);
|
||||||
|
@ -150,20 +151,14 @@ public class GetBasinData {
|
||||||
ib++;
|
ib++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mean_areal_precip_global[ib] = dc.new Maps();
|
|
||||||
// mean_areal_precip_global[ib].hb5 = "";
|
|
||||||
maxib = ib;
|
maxib = ib;
|
||||||
System.out.println("Size of map array is : " + maxib + " basins");
|
System.out.println("Size of map array is : " + maxib + " basins");
|
||||||
s.close();
|
s.close();
|
||||||
in.close();
|
in.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
// TODO Auto-generated catch block. Please revise as
|
|
||||||
// appropriate.
|
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block. Please revise as
|
|
||||||
// appropriate.
|
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
} catch (NumberFormatException e) {
|
} 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].tmaps_done = new int[200];
|
||||||
mean_areal_precip_global[ib].zmaps_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].gz, -1);
|
||||||
Arrays.fill(mean_areal_precip_global[ib].uz, -1);
|
Arrays.fill(mean_areal_precip_global[ib].uz, -1);
|
||||||
Arrays.fill(mean_areal_precip_global[ib].mz, -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].tmaps_done, -1);
|
||||||
Arrays.fill(mean_areal_precip_global[ib].zmaps_done, -1);
|
Arrays.fill(mean_areal_precip_global[ib].zmaps_done, -1);
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
if (hrap_basin_flag == 1) {
|
if (hrap_basin_flag == 1) {
|
||||||
try {
|
try {
|
||||||
System.out.println("Reading basin data from file.");
|
System.out.println("Reading hrap basin data from file.");
|
||||||
long basin_start = System.currentTimeMillis();
|
long basin_start = System.currentTimeMillis();
|
||||||
in = new BufferedReader(new FileReader(hrap_f));
|
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++) {
|
for (ib = 0; ib < maxib; ib++) {
|
||||||
in.read(eb, 0, 80);
|
eb = in.readLine(); //(eb, 0, 80);
|
||||||
int p = new String(eb).indexOf('\n');
|
int p = eb.length(); //new String(eb).indexOf('\n');
|
||||||
|
|
||||||
if (p != -1) {
|
if (p != -1) {
|
||||||
p = 0;
|
p = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
String t = new String(eb);
|
eb = eb.trim();
|
||||||
Scanner s = new Scanner(t);
|
s = new Scanner(eb);
|
||||||
|
Pattern pc = Pattern.compile("\\s*[A-Z]+$");
|
||||||
|
|
||||||
numpts = s.nextInt();
|
numpts = s.nextInt();
|
||||||
mean_areal_precip_global[ib].hrap_points = numpts;
|
mean_areal_precip_global[ib].hrap_points = numpts;
|
||||||
String bchar = "";
|
String bchar = "";
|
||||||
bchar = s.findInLine("*$");
|
bchar = s.findInLine(pc);
|
||||||
mean_areal_precip_global[ib].bchar = bchar;
|
mean_areal_precip_global[ib].bchar = bchar.trim();
|
||||||
mean_areal_precip_global[ib].hrap_data = new Hrap_Data[numpts];
|
mean_areal_precip_global[ib].hrap_data = new Hrap_Data[numpts];
|
||||||
|
|
||||||
for (mm = 0; mm < 4; mm++) {
|
for (mm = 0; mm < 4; mm++) {
|
||||||
|
@ -240,42 +235,34 @@ public class GetBasinData {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l = 0; l < numpts; l++) {
|
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++) {
|
for (mm = 0; mm < 4; mm++) {
|
||||||
mean_areal_precip_global[ib].hrap_data[l].zone[mm] = -1;
|
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) {
|
if (p == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
t = new String(eb);
|
s = new Scanner(eb);
|
||||||
|
|
||||||
// ier = sscanf (ibuf, "%d %d %d %d %d %d\n", &x, &y,
|
|
||||||
// &ip, &ip2, &ip3,&ip4);
|
|
||||||
|
|
||||||
x = s.nextInt();
|
x = s.nextInt();
|
||||||
y = s.nextInt();
|
y = s.nextInt();
|
||||||
if (s.hasNextInt()) {
|
if (s.hasNextInt()) {
|
||||||
ip = s.nextInt();
|
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].x = x;
|
||||||
mean_areal_precip_global[ib].hrap_data[l].y = y;
|
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].hrap_data[l].zone[ip - 1] = 1;
|
||||||
mean_areal_precip_global[ib].zones[0] = 1;
|
mean_areal_precip_global[ib].zones[0] = 1;
|
||||||
|
|
||||||
if (s.hasNextInt()) {
|
if (s.hasNextInt()) {
|
||||||
|
ip2 = s.nextInt();
|
||||||
if (ip2 < 0 || ip2 > 4) {
|
if (ip2 < 0 || ip2 > 4) {
|
||||||
System.out
|
System.out
|
||||||
.println("HRAP error in read_basin_data routine.\n");
|
.println("HRAP error in read_basin_data routine.\n");
|
||||||
|
@ -288,7 +275,7 @@ public class GetBasinData {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.hasNextInt()) {
|
if (s.hasNextInt()) {
|
||||||
|
ip3 = s.nextInt();
|
||||||
if (ip3 < 0 || ip3 > 4) {
|
if (ip3 < 0 || ip3 > 4) {
|
||||||
System.out
|
System.out
|
||||||
.println("HRAP error in read_basin_data routine.\n");
|
.println("HRAP error in read_basin_data routine.\n");
|
||||||
|
@ -301,7 +288,7 @@ public class GetBasinData {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.hasNextInt()) {
|
if (s.hasNextInt()) {
|
||||||
|
ip4 = s.nextInt();
|
||||||
if (ip4 < 0 || ip4 > 4) {
|
if (ip4 < 0 || ip4 > 4) {
|
||||||
System.out
|
System.out
|
||||||
.println("HRAP error in read_basin_data routine.\n");
|
.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) {
|
} catch (FileNotFoundException e) {
|
||||||
// TODO Auto-generated catch block. Please revise as
|
|
||||||
// appropriate.
|
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
e);
|
e);
|
||||||
return false;
|
return false;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO Auto-generated catch block. Please revise as
|
|
||||||
// appropriate.
|
|
||||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||||
e);
|
e);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -20,8 +20,9 @@
|
||||||
package com.raytheon.viz.texteditor.command;
|
package com.raytheon.viz.texteditor.command;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
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.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
@ -46,6 +47,7 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jan 18, 2013 rferrel Initial creation
|
* Jan 18, 2013 rferrel Initial creation
|
||||||
|
* Aug 23, 2013 DR 16514 D. Friedman Fix accum/cancel logic.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -59,82 +61,53 @@ public class ProductQueryJob extends Job {
|
||||||
|
|
||||||
private final IProductQueryCallback callback;
|
private final IProductQueryCallback callback;
|
||||||
|
|
||||||
/**
|
|
||||||
* flag to indicate request accumulate.
|
|
||||||
*/
|
|
||||||
private boolean accumulate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List queries to perform.
|
* List queries to perform.
|
||||||
*/
|
*/
|
||||||
private final List<Request> requests;
|
private final List<Request> requests;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set of queries main thread is waiting for.
|
||||||
|
*/
|
||||||
|
private final Set<Request> expected;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transport to use for the queries.
|
* Transport to use for the queries.
|
||||||
*/
|
*/
|
||||||
private final IQueryTransport queryTransport;
|
private final IQueryTransport queryTransport;
|
||||||
|
|
||||||
/**
|
|
||||||
* Flag to indicate cancel is being performed.
|
|
||||||
*/
|
|
||||||
private final AtomicBoolean canceled;
|
|
||||||
|
|
||||||
public ProductQueryJob(IProductQueryCallback callback) {
|
public ProductQueryJob(IProductQueryCallback callback) {
|
||||||
super("Product Query");
|
super("Product Query");
|
||||||
setSystem(true);
|
setSystem(true);
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
accumulate = false;
|
|
||||||
requests = new ArrayList<Request>();
|
requests = new ArrayList<Request>();
|
||||||
|
expected = new HashSet<Request>();
|
||||||
queryTransport = TextEditorUtil.getTextDbsrvTransport();
|
queryTransport = TextEditorUtil.getTextDbsrvTransport();
|
||||||
canceled = new AtomicBoolean(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add request to queue and determine what needs to be done to schedule the
|
* Add request to queue. If not an incremental update, cancel
|
||||||
* request.
|
* existing requests.
|
||||||
*
|
*
|
||||||
* @param command
|
* @param command
|
||||||
* @param isObsUpdated
|
* @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
|
* @param accumulate
|
||||||
*/
|
*/
|
||||||
public void setAccumulate(boolean accumulate) {
|
public synchronized void addRequest(ICommand command, boolean isObsUpdated,
|
||||||
if (this.accumulate != accumulate) {
|
boolean accumulate) {
|
||||||
synchronized (this) {
|
Request request = new Request(command, isObsUpdated);
|
||||||
requests.clear();
|
if (! accumulate && ! isObsUpdated) {
|
||||||
if (getState() != Job.NONE) {
|
// Cancel existing requests.
|
||||||
cancel();
|
expected.clear();
|
||||||
}
|
requests.clear();
|
||||||
this.accumulate = accumulate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
Request request = null;
|
while (true) {
|
||||||
try {
|
final Request request;
|
||||||
while (true) {
|
synchronized (this) {
|
||||||
synchronized (this) {
|
if (requests.size() > 0) {
|
||||||
if (requests.size() > 0) {
|
request = requests.remove(0);
|
||||||
request = requests.remove(0);
|
} else {
|
||||||
} else {
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<StdTextProduct> prodList = null;
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
final ICommand command = request.getCommand();
|
prodList = request.getCommand().
|
||||||
final boolean isObsUpdated = request.isObsUpdated();
|
executeCommand(queryTransport);
|
||||||
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;
|
|
||||||
}
|
|
||||||
} catch (CommandFailedException e) {
|
} catch (CommandFailedException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
e.getLocalizedMessage(), e);
|
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;
|
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
|
* Class to hold the query command and isObsUpdated flag needed for the
|
||||||
* query and its callback.
|
* query and its callback.
|
||||||
|
|
|
@ -329,6 +329,8 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
||||||
* add selection listener to catch the highlight words and
|
* add selection listener to catch the highlight words and
|
||||||
* set the highlight colors.
|
* set the highlight colors.
|
||||||
* 25July2013 15733 GHull Read font and color prefs from TextEditorCfg.
|
* 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>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -1101,11 +1103,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
*/
|
*/
|
||||||
private boolean overwriteMode = false;
|
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.
|
* 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 = new Button(topBtnRowComp, SWT.CHECK);
|
||||||
accumChkBtn.setText("Accum");
|
accumChkBtn.setText("Accum");
|
||||||
accumChkBtn.setLayoutData(rd);
|
accumChkBtn.setLayoutData(rd);
|
||||||
accumChkBtn.addSelectionListener(new SelectionAdapter() {
|
|
||||||
@Override
|
|
||||||
public void widgetSelected(SelectionEvent event) {
|
|
||||||
productQueryJob.setAccumulate(accumChkBtn.getSelection());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add the Update Observation check button.
|
// Add the Update Observation check button.
|
||||||
rd = new RowData(BUTTON_WIDTH, BUTTON_HEIGHT);
|
rd = new RowData(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
|
@ -5896,12 +5887,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser != null) {
|
if (! isObsUpdated) {
|
||||||
browser.close();
|
if (browser != null) {
|
||||||
browser = null;
|
browser.close();
|
||||||
|
browser = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
commandHistory.addCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
commandHistory.addCommand(command);
|
|
||||||
statusBarLabel.setText("Loading "
|
statusBarLabel.setText("Loading "
|
||||||
+ TextEditorUtil.getCommandText(command));
|
+ TextEditorUtil.getCommandText(command));
|
||||||
statusBarLabel.update();
|
statusBarLabel.update();
|
||||||
|
@ -5910,7 +5904,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
if (queryTransport == null) {
|
if (queryTransport == null) {
|
||||||
queryTransport = TextEditorUtil.getTextDbsrvTransport();
|
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);
|
stripWMOHeaders(prod);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updateCount.get() > 0) {
|
if (isObsUpdated) {
|
||||||
updateDisplayedProduct(prod);
|
updateDisplayedProduct(prod);
|
||||||
} else {
|
} else {
|
||||||
setDisplayedProduct(prod);
|
setDisplayedProduct(prod);
|
||||||
|
@ -6086,13 +6081,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
private void postExecute(boolean hasAttachment, boolean enterEditor,
|
private void postExecute(boolean hasAttachment, boolean enterEditor,
|
||||||
boolean validExecuteCommand, String attachedFilename) {
|
boolean validExecuteCommand, String attachedFilename) {
|
||||||
if (!this.isDisposed()) {
|
if (!this.isDisposed()) {
|
||||||
if (hasAttachment) {
|
if (! productQueryJob.isExpectingRequests()) {
|
||||||
statusBarLabel.setText("Attachment: " + attachedFilename);
|
if (hasAttachment) {
|
||||||
} else {
|
statusBarLabel.setText("Attachment: " + attachedFilename);
|
||||||
statusBarLabel.setText("");
|
} else {
|
||||||
|
statusBarLabel.setText("");
|
||||||
|
}
|
||||||
|
statusBarLabel.update();
|
||||||
|
setBusy(false);
|
||||||
}
|
}
|
||||||
statusBarLabel.update();
|
|
||||||
setBusy(false);
|
|
||||||
// Automatically open the editor window with returned data.
|
// Automatically open the editor window with returned data.
|
||||||
if (enterEditor) {
|
if (enterEditor) {
|
||||||
enterEditor();
|
enterEditor();
|
||||||
|
@ -6471,7 +6468,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
@Override
|
@Override
|
||||||
public void setAccumulation(boolean flag) {
|
public void setAccumulation(boolean flag) {
|
||||||
this.accumChkBtn.setSelection(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
|
// retrieved for display in this text editor dialog
|
||||||
// instance.
|
// instance.
|
||||||
TextDisplayModel.getInstance().setStdTextProduct(token, product);
|
TextDisplayModel.getInstance().setStdTextProduct(token, product);
|
||||||
updateCount.addAndGet(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7309,7 +7304,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
msgPIL = "";
|
msgPIL = "";
|
||||||
}
|
}
|
||||||
if (isObsDisplayed(msgPIL)) {
|
if (isObsDisplayed(msgPIL)) {
|
||||||
updateCount.addAndGet(1);
|
|
||||||
ICommand command = CommandFactory.getAfosCommand(msgPIL);
|
ICommand command = CommandFactory.getAfosCommand(msgPIL);
|
||||||
UpdateObsRun run = new UpdateObsRun(command);
|
UpdateObsRun run = new UpdateObsRun(command);
|
||||||
VizApp.runSync(run);
|
VizApp.runSync(run);
|
||||||
|
|
|
@ -60,6 +60,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jan 5, 2011 mpduff Initial creation
|
* Jan 5, 2011 mpduff Initial creation
|
||||||
|
* Sep 5, 2013 16437 wkwock Fix the "HiRes" issue
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -343,6 +344,9 @@ public class GAFF {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
uri = db.getDataURI(rfc, durString, today);
|
uri = db.getDataURI(rfc, durString, today);
|
||||||
|
if (uri == null) {
|
||||||
|
uri = db.getDataURI(rfc+"-HiRes", durString, today);
|
||||||
|
}
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ buildRPM ${SPECS}
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
exit 0
|
||||||
|
|
||||||
# build java 1.7
|
# build java 1.7
|
||||||
SPECS=1.7/component.spec
|
SPECS=1.7/component.spec
|
||||||
|
|
Loading…
Add table
Reference in a new issue