Issue #1159 No longer wrap text pasted to empty text field.
Change-Id: I03cc61a4d6d158344c0dbdbbed8be7edeb9cc42d Former-commit-id: 0b418dc248fd3c2107f2d6c045c8da51f13f1faa
This commit is contained in:
parent
caff5053cb
commit
e55c9ca0bd
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.
|
* 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.
|
* 25JUL2012 14459 rferrel Strip WMH headers when getting all METARs.
|
||||||
* 13AUG2012 14613 M.Gamazaychikov Ensured the WMO and MND header times are the same.
|
* 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>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author lvenable
|
* @author lvenable
|
||||||
|
@ -4112,6 +4113,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
private void pasteText() {
|
private void pasteText() {
|
||||||
// AWIPS I just does the pasted in both overwrite and insert mode.
|
// AWIPS I just does the pasted in both overwrite and insert mode.
|
||||||
try {
|
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;
|
int start = -1;
|
||||||
if (textEditor.getSelectionCount() == 0) {
|
if (textEditor.getSelectionCount() == 0) {
|
||||||
start = textEditor.getCaretOffset();
|
start = textEditor.getCaretOffset();
|
||||||
|
@ -4119,7 +4127,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
start = textEditor.getSelectionRange().x;
|
start = textEditor.getSelectionRange().x;
|
||||||
}
|
}
|
||||||
textEditor.paste();
|
textEditor.paste();
|
||||||
rewrap(start, textEditor.getCaretOffset());
|
if (doWrap) {
|
||||||
|
rewrap(start, textEditor.getCaretOffset());
|
||||||
|
}
|
||||||
} catch (IllegalArgumentException ex) {
|
} catch (IllegalArgumentException ex) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
@ -4364,7 +4374,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
final CAVEMode mode = CAVEMode.getMode();
|
final CAVEMode mode = CAVEMode.getMode();
|
||||||
StdTextProduct prod = getStdTextProduct();
|
StdTextProduct prod = getStdTextProduct();
|
||||||
String afosId = prod.getCccid() + prod.getNnnid() + prod.getXxxid();
|
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 productMessage = new StringBuilder();
|
||||||
|
|
||||||
final StringBuilder modeMessage = new StringBuilder();
|
final StringBuilder modeMessage = new StringBuilder();
|
||||||
|
@ -4378,7 +4389,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
} else if (warnGenFlag) {
|
} else if (warnGenFlag) {
|
||||||
productMessage.append("You are about to SEND a " + afosId + "\n");
|
productMessage.append("You are about to SEND a " + afosId + "\n");
|
||||||
productMessage.append(title).append(".\n");
|
productMessage.append(title).append(".\n");
|
||||||
|
|
||||||
QualityControl qcCheck = new QualityControl();
|
QualityControl qcCheck = new QualityControl();
|
||||||
if (qcCheck.checkWarningInfo(headerTF.getText().toUpperCase(),
|
if (qcCheck.checkWarningInfo(headerTF.getText().toUpperCase(),
|
||||||
textEditor.getText().toUpperCase(), prod.getNnnid()) == false) {
|
textEditor.getText().toUpperCase(), prod.getNnnid()) == false) {
|
||||||
|
@ -4389,7 +4400,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
@Override
|
@Override
|
||||||
public void dialogDismissed(Object dialogResult) {
|
public void dialogDismissed(Object dialogResult) {
|
||||||
if (Boolean.TRUE.equals(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);
|
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].");
|
Pattern p = Pattern.compile(".\\%[s].");
|
||||||
Matcher m = p.matcher(STORED_SENT_MSG);
|
Matcher m = p.matcher(STORED_SENT_MSG);
|
||||||
|
|
||||||
|
@ -4464,7 +4478,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
token);
|
token);
|
||||||
OUPRequest req = new OUPRequest();
|
OUPRequest req = new OUPRequest();
|
||||||
OfficialUserProduct oup = new OfficialUserProduct();
|
OfficialUserProduct oup = new OfficialUserProduct();
|
||||||
StdTextProduct prod = getStdTextProduct(); // TODO: makes me nervous...
|
StdTextProduct prod = getStdTextProduct(); // TODO: makes me
|
||||||
|
// nervous...
|
||||||
String awipsWanPil = prod.getSite() + prod.getNnnid()
|
String awipsWanPil = prod.getSite() + prod.getNnnid()
|
||||||
+ prod.getXxxid();
|
+ prod.getXxxid();
|
||||||
String awipsID = prod.getNnnid() + prod.getXxxid();
|
String awipsID = prod.getNnnid() + prod.getXxxid();
|
||||||
|
@ -4619,15 +4634,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
boolean successful = false;
|
boolean successful = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DR14613 - string currectDate is derived from Date now
|
* DR14613 - string currectDate is derived from Date now ensuring the
|
||||||
* ensuring the same time in WMO heading and in the
|
* same time in WMO heading and in the MND heading.
|
||||||
* MND heading.
|
|
||||||
*/
|
*/
|
||||||
Date now = SimulatedTime.getSystemTime().getTime();
|
Date now = SimulatedTime.getSystemTime().getTime();
|
||||||
String currentDate = getCurrentDate(now);
|
String currentDate = getCurrentDate(now);
|
||||||
TextDisplayModel tdmInst = TextDisplayModel.getInstance();
|
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 (!isAutoSave) {
|
||||||
if (!verifyRequiredFields()) {
|
if (!verifyRequiredFields()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4663,10 +4677,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
|
|
||||||
VtecObject vtecObj = VtecUtil.parseMessage(productText);
|
VtecObject vtecObj = VtecUtil.parseMessage(productText);
|
||||||
if (warnGenFlag) {
|
if (warnGenFlag) {
|
||||||
/*
|
/*
|
||||||
* DR14613 - string currectDate is derived from Date now
|
* DR14613 - string currectDate is derived from Date now
|
||||||
* ensuring the same time in WMO heading and in the
|
* ensuring the same time in WMO heading and in the MND
|
||||||
* MND heading.
|
* heading.
|
||||||
*/
|
*/
|
||||||
productText = updateVtecTimes(productText, vtecObj, now);
|
productText = updateVtecTimes(productText, vtecObj, now);
|
||||||
productText = updateHeaderTimes(productText, now);
|
productText = updateHeaderTimes(productText, now);
|
||||||
|
@ -5130,9 +5144,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getCurrentDate(Date now) {
|
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");
|
SimpleDateFormat formatter = new SimpleDateFormat("ddHHmm");
|
||||||
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
|
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||||
return (formatter.format(now));
|
return (formatter.format(now));
|
||||||
|
@ -5159,11 +5173,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
product = product.replace(
|
product = product.replace(
|
||||||
vtecFormatter.format(vtecObj.getStartTime().getTime()),
|
vtecFormatter.format(vtecObj.getStartTime().getTime()),
|
||||||
vtecFormatter.format(now));
|
vtecFormatter.format(now));
|
||||||
}
|
}
|
||||||
|
|
||||||
return product;
|
return product;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the MND header time using the Date now.
|
* Update the MND header time using the Date now.
|
||||||
*
|
*
|
||||||
|
@ -5172,7 +5186,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String updateHeaderTimes(String product, Date now) {
|
private String updateHeaderTimes(String product, Date now) {
|
||||||
// Update the header time
|
// Update the header time
|
||||||
Matcher m = datePtrn.matcher(product);
|
Matcher m = datePtrn.matcher(product);
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
SimpleDateFormat headerFormat = new SimpleDateFormat(
|
SimpleDateFormat headerFormat = new SimpleDateFormat(
|
||||||
|
@ -5183,9 +5197,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
product = product.replace(m.group(1), headerFormat.format(now)
|
product = product.replace(m.group(1), headerFormat.format(now)
|
||||||
.toUpperCase());
|
.toUpperCase());
|
||||||
}
|
}
|
||||||
return product;
|
return product;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setCurrentWmoId(String wmoId) {
|
public void setCurrentWmoId(String wmoId) {
|
||||||
TextDisplayModel.getInstance().setWmoId(token, wmoId);
|
TextDisplayModel.getInstance().setWmoId(token, wmoId);
|
||||||
|
@ -7293,7 +7306,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
job.setSystem(true);
|
job.setSystem(true);
|
||||||
job.schedule();
|
job.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String fixNOR(String bbb) {
|
private static String fixNOR(String bbb) {
|
||||||
if ("NOR".equals(bbb))
|
if ("NOR".equals(bbb))
|
||||||
return "";
|
return "";
|
||||||
|
|
Loading…
Add table
Reference in a new issue