Merge remote-tracking branch 'asm/asm_16.2.2' into master_16.2.2

Conflicts:
	cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java

Change-Id: I6c0ee27d5dba0255a365886af61f124bd4b64744

Former-commit-id: 12523a79aae3630156c95e62dc87e7ac4e1521c1
This commit is contained in:
Shawn.Hooper 2016-06-07 10:30:36 -04:00
commit d1cfaab789

View file

@ -386,6 +386,7 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
* specific checks that need it.
* Mar 17, 2016 RM 18727 D. Friedman Fix use of verification listener when entering and exiting editor.
* Apr 15, 2016 RM 18870 D. Friedman Replace commas with ellipses only at start of edit and then word-wrap.
* May 26, 2016 RM 17614 mgamazaychikov Fix loading of product on exit from edit mode.
*
* </pre>
*
@ -1422,6 +1423,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private static final String PARAGRAPH_PADDING_PATTERN_FILENAME = "textws/gui/ParagraphPaddingPattern.txt";
// derived from /data/fxa/nationalData/textQC.config
private static final List<String> updateHeaderTimesPils = Arrays.asList(
"EWW", "FFS", "FFW", "FLS", "FLW", "MWS", "NOW", "SMW", "SPS",
"SVR", "SVS", "TOR");
/**
* Constructor with additional cave style rules
*
@ -4160,6 +4166,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* Enter the text editor mode.
*/
private void enterEditor() {
// Reset the saved
saved = false;
if (!validateTime()) {
return;
}
@ -4375,8 +4383,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
searchReplaceDlg.setEditMode(inEditMode);
}
if (originalText != null) {
textEditor.setText(originalText);
// Only set text to originalText for unsaved products
if (!saved) {
if (originalText != null) {
textEditor.setText(originalText);
}
}
markUneditableText(textEditor);
@ -5137,14 +5148,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
statusHandler.handle(Priority.INFO,
"Will NOT increment ETN for this product.");
}
/*
*
* The text product may have had it's VTEC, WMO, and MND time
* modified in saveEditedProduct as well as having it's ETN
* updated. Make sure these changes are reflected in the
* text editor. DR17614
*/
updateTextEditor(copyUpdatedProduct(prod.getProduct(), body));
// Update editor so the proper send times are displayed.
updateTextEditor(prod.getProduct());
}
String product = prod.getProduct();
@ -5280,30 +5285,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
return req;
}
private static String copyUpdatedProduct(String productString, String bodyString) {
/* The productString has already been updated before this function was
* called, the purpose here is to remove an extraneous header that is
* added. In the future, this function may need to perform updates on the
* text added to the text editor but currently it only needs to remove
* the header.
*/
String[] bodyStrings = bodyString.split("\n");
String[] productStrings = productString.split("\n");
/* The difference between the bodyStrings and the productStrings
* is a header. We begin by coping from the end of the header so
* that it is effectively removed from the final String
*/
int textLinesDifference = productStrings.length - bodyStrings.length;
StringBuilder updatedBody = new StringBuilder();
for (int i = textLinesDifference; i < productStrings.length; ++i) {
updatedBody.append(productStrings[i]).append("\n");
}
return updatedBody.toString();
}
/**
* Recreates the original message by combining the header and the body from
* the edit windows.
@ -5438,24 +5419,21 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
} else {
productText = replaceDDHHMM(productText, currentDate);
}
VtecObject vtecObj = VtecUtil.parseMessage(productText);
if (warnGenFlag) {
/*
* DR14613 - string currectDate is derived from Date now
* ensuring the same time in WMO heading and in the MND
* heading.
*/
productText = updateVtecTimes(productText, vtecObj, now);
// Sync VTEC and MND header times with the header time for certain products
if (updateHeaderTimesPils.contains(storedProduct.getNnnid())) {
productText = updateHeaderTimes(productText, now);
// Update editor so the proper send times are displayed.
VtecObject vtecObj = VtecUtil.parseMessage(productText);
if (vtecObj != null) {
productText = updateVtecTimes(productText, vtecObj, now);
}
String[] b = productText.split("\n");
StringBuilder body = new StringBuilder();
for (int i = 2; i < b.length; ++i) {
body.append(b[i]).append("\n");
}
// Update editor so the proper send times are displayed.
updateTextEditor(body.toString());
}
storedProduct.setHdrtime(currentDate);
}
storedProduct.setRefTime(System.currentTimeMillis());
@ -6187,6 +6165,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* @param isObsUpdated
*/
public void executeCommand(ICommand command, final boolean isObsUpdated) {
// Reset the saved
saved = false;
if (isDisposed()) {
return;
}