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. * specific checks that need it.
* Mar 17, 2016 RM 18727 D. Friedman Fix use of verification listener when entering and exiting editor. * 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. * 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> * </pre>
* *
@ -1422,6 +1423,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private static final String PARAGRAPH_PADDING_PATTERN_FILENAME = "textws/gui/ParagraphPaddingPattern.txt"; 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 * Constructor with additional cave style rules
* *
@ -4160,6 +4166,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* Enter the text editor mode. * Enter the text editor mode.
*/ */
private void enterEditor() { private void enterEditor() {
// Reset the saved
saved = false;
if (!validateTime()) { if (!validateTime()) {
return; return;
} }
@ -4375,9 +4383,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
searchReplaceDlg.setEditMode(inEditMode); searchReplaceDlg.setEditMode(inEditMode);
} }
// Only set text to originalText for unsaved products
if (!saved) {
if (originalText != null) { if (originalText != null) {
textEditor.setText(originalText); textEditor.setText(originalText);
} }
}
markUneditableText(textEditor); markUneditableText(textEditor);
@ -5137,14 +5148,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
statusHandler.handle(Priority.INFO, statusHandler.handle(Priority.INFO,
"Will NOT increment ETN for this product."); "Will NOT increment ETN for this product.");
} }
/* // Update editor so the proper send times are displayed.
* updateTextEditor(prod.getProduct());
* 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));
} }
String product = prod.getProduct(); String product = prod.getProduct();
@ -5280,30 +5285,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
return req; 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 * Recreates the original message by combining the header and the body from
* the edit windows. * the edit windows.
@ -5438,24 +5419,21 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
} else { } else {
productText = replaceDDHHMM(productText, currentDate); productText = replaceDDHHMM(productText, currentDate);
} }
VtecObject vtecObj = VtecUtil.parseMessage(productText); // Sync VTEC and MND header times with the header time for certain products
if (warnGenFlag) { if (updateHeaderTimesPils.contains(storedProduct.getNnnid())) {
/*
* 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);
productText = updateHeaderTimes(productText, now); 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"); String[] b = productText.split("\n");
StringBuilder body = new StringBuilder(); StringBuilder body = new StringBuilder();
for (int i = 2; i < b.length; ++i) { for (int i = 2; i < b.length; ++i) {
body.append(b[i]).append("\n"); body.append(b[i]).append("\n");
} }
// Update editor so the proper send times are displayed.
updateTextEditor(body.toString()); updateTextEditor(body.toString());
} }
storedProduct.setHdrtime(currentDate); storedProduct.setHdrtime(currentDate);
} }
storedProduct.setRefTime(System.currentTimeMillis()); storedProduct.setRefTime(System.currentTimeMillis());
@ -6187,6 +6165,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* @param isObsUpdated * @param isObsUpdated
*/ */
public void executeCommand(ICommand command, final boolean isObsUpdated) { public void executeCommand(ICommand command, final boolean isObsUpdated) {
// Reset the saved
saved = false;
if (isDisposed()) { if (isDisposed()) {
return; return;
} }