Issue #1159 No longer wrap text pasted to empty text field.
Change-Id: I03cc61a4d6d158344c0dbdbbed8be7edeb9cc42d Former-commit-id:ef9634dd96
[formerly 0b418dc248fd3c2107f2d6c045c8da51f13f1faa] Former-commit-id:e55c9ca0bd
This commit is contained in:
parent
b287d102a7
commit
aa036adf6d
1 changed files with 36 additions and 23 deletions
|
@ -283,7 +283,8 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
|||
* 18JUL2012 14457 rferrel Add mouse listener to clear site's update obs when clicked on.
|
||||
* 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.
|
||||
* 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();
|
||||
rewrap(start, textEditor.getCaretOffset());
|
||||
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();
|
||||
|
@ -4378,7 +4389,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
} else if (warnGenFlag) {
|
||||
productMessage.append("You are about to SEND a " + afosId + "\n");
|
||||
productMessage.append(title).append(".\n");
|
||||
|
||||
|
||||
QualityControl qcCheck = new QualityControl();
|
||||
if (qcCheck.checkWarningInfo(headerTF.getText().toUpperCase(),
|
||||
textEditor.getText().toUpperCase(), prod.getNnnid()) == false) {
|
||||
|
@ -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,15 +4634,14 @@ 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);
|
||||
TextDisplayModel tdmInst = TextDisplayModel.getInstance();
|
||||
|
||||
// Convert the text in the text editor to uppercase
|
||||
// Convert the text in the text editor to uppercase
|
||||
if (!isAutoSave) {
|
||||
if (!verifyRequiredFields()) {
|
||||
return false;
|
||||
|
@ -4663,10 +4677,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
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.
|
||||
* ensuring the same time in WMO heading and in the MND
|
||||
* heading.
|
||||
*/
|
||||
productText = updateVtecTimes(productText, vtecObj, now);
|
||||
productText = updateHeaderTimes(productText, now);
|
||||
|
@ -5130,9 +5144,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
private String getCurrentDate(Date now) {
|
||||
/*
|
||||
* DR14613 - pass the Date now as an argument
|
||||
*/
|
||||
/*
|
||||
* DR14613 - pass the Date now as an argument
|
||||
*/
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("ddHHmm");
|
||||
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
return (formatter.format(now));
|
||||
|
@ -5159,11 +5173,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
product = product.replace(
|
||||
vtecFormatter.format(vtecObj.getStartTime().getTime()),
|
||||
vtecFormatter.format(now));
|
||||
}
|
||||
}
|
||||
|
||||
return product;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the MND header time using the Date now.
|
||||
*
|
||||
|
@ -5172,7 +5186,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* @return
|
||||
*/
|
||||
private String updateHeaderTimes(String product, Date now) {
|
||||
// Update the header time
|
||||
// Update the header time
|
||||
Matcher m = datePtrn.matcher(product);
|
||||
if (m.find()) {
|
||||
SimpleDateFormat headerFormat = new SimpleDateFormat(
|
||||
|
@ -5183,9 +5197,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
product = product.replace(m.group(1), headerFormat.format(now)
|
||||
.toUpperCase());
|
||||
}
|
||||
return product;
|
||||
return product;
|
||||
}
|
||||
|
||||
|
||||
public void setCurrentWmoId(String wmoId) {
|
||||
TextDisplayModel.getInstance().setWmoId(token, wmoId);
|
||||
|
@ -7293,7 +7306,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
job.setSystem(true);
|
||||
job.schedule();
|
||||
}
|
||||
|
||||
|
||||
private static String fixNOR(String bbb) {
|
||||
if ("NOR".equals(bbb))
|
||||
return "";
|
||||
|
|
Loading…
Add table
Reference in a new issue