Merge "Issue #1159 No longer wrap text pasted to empty text field." into development

Former-commit-id: 8f95f21e6a [formerly b22bd12fad] [formerly 903c220ecb [formerly bacccfd683e71eab49c69d815aafbef2e395e863]]
Former-commit-id: 903c220ecb
Former-commit-id: f1a836d0bb
This commit is contained in:
Lee Venable 2012-09-10 15:13:47 -05:00 committed by Gerrit Code Review
commit 9d55815fcf

View file

@ -284,6 +284,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 25JUL2012 14459 rferrel Strip WMH headers when getting all METARs.
* 13AUG2012 14613 M.Gamazaychikov Ensured the WMO and MND header times are the same.
* 20AUG2012 15340 D.Friedman Use callbacks for stop sign dialog. Prevent NOR in header.
* 10SEP2012 15334 rferrel No longer wrap text pasted to an empty text field.
* </pre>
*
* @author lvenable
@ -4112,6 +4113,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private void pasteText() {
// AWIPS I just does the pasted in both overwrite and insert mode.
try {
// When pasting to empty editor assume text is properly formatted
// and does not need wrapping.
boolean doWrap = true;
if (textEditor.getText().trim().length() == 0) {
doWrap = false;
textEditor.setText("");
}
int start = -1;
if (textEditor.getSelectionCount() == 0) {
start = textEditor.getCaretOffset();
@ -4119,7 +4127,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
start = textEditor.getSelectionRange().x;
}
textEditor.paste();
if (doWrap) {
rewrap(start, textEditor.getCaretOffset());
}
} catch (IllegalArgumentException ex) {
// Ignore
}
@ -4364,7 +4374,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
final CAVEMode mode = CAVEMode.getMode();
StdTextProduct prod = getStdTextProduct();
String afosId = prod.getCccid() + prod.getNnnid() + prod.getXxxid();
final String title = QualityControl.getProductWarningType(prod.getNnnid());
final String title = QualityControl.getProductWarningType(prod
.getNnnid());
final StringBuilder productMessage = new StringBuilder();
final StringBuilder modeMessage = new StringBuilder();
@ -4389,7 +4400,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
@Override
public void dialogDismissed(Object dialogResult) {
if (Boolean.TRUE.equals(dialogResult))
finishSendProduct1(resend, title, mode, productMessage, modeMessage);
finishSendProduct1(resend, title, mode,
productMessage, modeMessage);
}
});
@ -4399,7 +4411,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
finishSendProduct1(resend, title, mode, productMessage, modeMessage);
}
private void finishSendProduct1(final boolean resend, String title, CAVEMode mode, StringBuilder productMessage, StringBuilder modeMessage) {
private void finishSendProduct1(final boolean resend, String title,
CAVEMode mode, StringBuilder productMessage,
StringBuilder modeMessage) {
Pattern p = Pattern.compile(".\\%[s].");
Matcher m = p.matcher(STORED_SENT_MSG);
@ -4464,7 +4478,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
token);
OUPRequest req = new OUPRequest();
OfficialUserProduct oup = new OfficialUserProduct();
StdTextProduct prod = getStdTextProduct(); // TODO: makes me nervous...
StdTextProduct prod = getStdTextProduct(); // TODO: makes me
// nervous...
String awipsWanPil = prod.getSite() + prod.getNnnid()
+ prod.getXxxid();
String awipsID = prod.getNnnid() + prod.getXxxid();
@ -4619,9 +4634,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
boolean successful = false;
/*
* DR14613 - string currectDate is derived from Date now
* ensuring the same time in WMO heading and in the
* MND heading.
* DR14613 - string currectDate is derived from Date now ensuring the
* same time in WMO heading and in the MND heading.
*/
Date now = SimulatedTime.getSystemTime().getTime();
String currentDate = getCurrentDate(now);
@ -4665,8 +4679,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
if (warnGenFlag) {
/*
* DR14613 - string currectDate is derived from Date now
* ensuring the same time in WMO heading and in the
* MND heading.
* ensuring the same time in WMO heading and in the MND
* heading.
*/
productText = updateVtecTimes(productText, vtecObj, now);
productText = updateHeaderTimes(productText, now);
@ -5186,7 +5200,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
return product;
}
public void setCurrentWmoId(String wmoId) {
TextDisplayModel.getInstance().setWmoId(token, wmoId);
}