Omaha #4018 Added logging of changes in GFE product editor. Additional code clean up.
Change-Id: Ifa188f6e465062b1cf16042c87bf1074814909a2 Former-commit-id:bdc365d9c9
[formerly 9d2f64b08acbec0567c7f29871480827ff0f6de7] Former-commit-id:346ea417ea
This commit is contained in:
parent
a00e04a8d7
commit
48c2f0e843
4 changed files with 118 additions and 97 deletions
|
@ -33,7 +33,7 @@
|
|||
# Jul 10, 2014 #3363 bclement logs command used to launch application to console logs
|
||||
# Oct 10, 2014 #3675 njensen Logback now does console logging to ensure correct pid
|
||||
# Oct 13, 2014 #3675 bclement startup shutdown log includes both launching pid and placeholder
|
||||
#
|
||||
# Jan 28, 2015 #4018 randerso Added a productEditor log file to changes in the GFE product editor
|
||||
#
|
||||
|
||||
|
||||
|
@ -218,6 +218,7 @@ curTime=`date +%Y%m%d_%H%M%S`
|
|||
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_logs.log"
|
||||
export LOGFILE_CONSOLE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_console.log"
|
||||
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_perf.log"
|
||||
export LOGFILE_PRODUCT_EDITOR="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_productEditor.log"
|
||||
|
||||
# can we write to log directory
|
||||
if [ -w ${LOGDIR} ]; then
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.viz.gfe.dialogs.formatterlauncher;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
|
@ -35,6 +36,7 @@ import org.eclipse.swt.graphics.Point;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 05 Jan 2008 1784 lvenable Initial creation
|
||||
* 28 Jan 2015 4018 randerso Code cleanup
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,12 +53,12 @@ public class ProductDataStruct {
|
|||
/**
|
||||
* HashMap of ci text index points.
|
||||
*/
|
||||
private HashMap<String, TextIndexPoints> ci;
|
||||
private Map<String, TextIndexPoints> ci;
|
||||
|
||||
/**
|
||||
* HashMap of mnd text index points.
|
||||
*/
|
||||
private HashMap<String, TextIndexPoints> mnd;
|
||||
private Map<String, TextIndexPoints> mnd;
|
||||
|
||||
/**
|
||||
* Array of segment data.
|
||||
|
@ -66,7 +68,7 @@ public class ProductDataStruct {
|
|||
/**
|
||||
* Parsed map containing the parsed product text.
|
||||
*/
|
||||
private HashMap<String, Object> parsedMap;
|
||||
private Map<String, Object> parsedMap;
|
||||
|
||||
/**
|
||||
* A String array containing the product text. Each element in the array is
|
||||
|
@ -89,8 +91,7 @@ public class ProductDataStruct {
|
|||
* @param productText
|
||||
* Product text.
|
||||
*/
|
||||
public ProductDataStruct(HashMap<String, Object> parsedMap,
|
||||
String productText) {
|
||||
public ProductDataStruct(Map<String, Object> parsedMap, String productText) {
|
||||
this.parsedMap = parsedMap;
|
||||
|
||||
this.productText = productText;
|
||||
|
@ -121,21 +122,20 @@ public class ProductDataStruct {
|
|||
return;
|
||||
}
|
||||
|
||||
if (parsedMap.get("frames") instanceof List == false) {
|
||||
if ((parsedMap.get("frames") instanceof List) == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
frames = new ArrayList<TextIndexPoints>();
|
||||
|
||||
List<?> parseFrames = (List<?>) parsedMap.get("frames");
|
||||
|
||||
for (Object object : parseFrames) {
|
||||
HashMap frameMap = (HashMap) object;
|
||||
List<Map<String, List<List<Integer>>>> parseFrames = (List<Map<String, List<List<Integer>>>>) parsedMap
|
||||
.get("frames");
|
||||
|
||||
for (Map<String, List<List<Integer>>> frameMap : parseFrames) {
|
||||
Set<String> keys = frameMap.keySet();
|
||||
|
||||
for (String key : keys) {
|
||||
List<?> frameIndexes = (List<?>) frameMap.get(key);
|
||||
List<List<Integer>> frameIndexes = frameMap.get(key);
|
||||
|
||||
TextIndexPoints tip = createTextIndexPoints(frameIndexes);
|
||||
|
||||
|
@ -156,15 +156,16 @@ public class ProductDataStruct {
|
|||
return;
|
||||
}
|
||||
|
||||
List<?> tmpArray;
|
||||
List<List<Integer>> tmpArray;
|
||||
TextIndexPoints tip;
|
||||
|
||||
HashMap parsedCi = (HashMap) parsedMap.get("ci");
|
||||
Map<String, List<List<Integer>>> parsedCi = (Map<String, List<List<Integer>>>) parsedMap
|
||||
.get("ci");
|
||||
|
||||
Set<String> keys = parsedCi.keySet();
|
||||
|
||||
for (String key : keys) {
|
||||
tmpArray = (List<?>) parsedCi.get(key);
|
||||
tmpArray = parsedCi.get(key);
|
||||
tip = createTextIndexPoints(tmpArray);
|
||||
ci.put(key, tip);
|
||||
}
|
||||
|
@ -181,19 +182,18 @@ public class ProductDataStruct {
|
|||
return;
|
||||
}
|
||||
|
||||
List<?> tmpArray;
|
||||
List<List<Integer>> tmpArray;
|
||||
TextIndexPoints tip;
|
||||
|
||||
HashMap parsedMnd = (HashMap) parsedMap.get("mnd");
|
||||
Map<String, List<List<Integer>>> parsedMnd = (Map<String, List<List<Integer>>>) parsedMap
|
||||
.get("mnd");
|
||||
|
||||
Set<String> keys = parsedMnd.keySet();
|
||||
|
||||
for (String key : keys) {
|
||||
tmpArray = (List<?>) parsedMnd.get(key);
|
||||
tmpArray = parsedMnd.get(key);
|
||||
tip = createTextIndexPoints(tmpArray);
|
||||
|
||||
// TODO : remove
|
||||
// System.out.println("mnd key = " + key + "\t\t" + tip.getText());
|
||||
mnd.put(key, tip);
|
||||
}
|
||||
}
|
||||
|
@ -210,36 +210,36 @@ public class ProductDataStruct {
|
|||
}
|
||||
|
||||
TextIndexPoints tip;
|
||||
List<?> tmpArray;
|
||||
List<List<Integer>> tmpArray;
|
||||
|
||||
// Get the Array of segments from the parsed map.
|
||||
List<?> parsedSegs = (List<?>) parsedMap.get("segs");
|
||||
List<Map<String, Object>> parsedSegs = (List<Map<String, Object>>) parsedMap
|
||||
.get("segs");
|
||||
|
||||
// Loop through each segment.
|
||||
for (Object seg : parsedSegs) {
|
||||
|
||||
HashMap curSegMap = (HashMap) seg;
|
||||
for (Map<String, Object> curSegMap : parsedSegs) {
|
||||
|
||||
Set<String> keys = curSegMap.keySet();
|
||||
|
||||
SegmentData segData = new SegmentData();
|
||||
|
||||
for (String key : keys) {
|
||||
if (key.compareTo("headInfo") == 0) {
|
||||
List<?> headInfoArray = (List<?>) curSegMap.get(key);
|
||||
if (key.equals("headInfo")) {
|
||||
List<Map<String, List<List<Integer>>>> headInfoArray = (List<Map<String, List<List<Integer>>>>) curSegMap
|
||||
.get(key);
|
||||
|
||||
for (Object hiObj : headInfoArray) {
|
||||
HashMap headInfoMap = (HashMap) hiObj;
|
||||
Map<String, List<List<Integer>>> headInfoMap = (Map<String, List<List<Integer>>>) hiObj;
|
||||
|
||||
Set<String> headInfoKeys = headInfoMap.keySet();
|
||||
for (String hiKey : headInfoKeys) {
|
||||
tmpArray = (List<?>) headInfoMap.get(hiKey);
|
||||
tmpArray = headInfoMap.get(hiKey);
|
||||
tip = createTextIndexPoints(tmpArray);
|
||||
segData.addToHeadInfoMap(hiKey, tip);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tmpArray = (List<?>) curSegMap.get(key);
|
||||
tmpArray = (List<List<Integer>>) curSegMap.get(key);
|
||||
tip = createTextIndexPoints(tmpArray);
|
||||
segData.addToSegmentMap(key, tip);
|
||||
}
|
||||
|
@ -256,19 +256,18 @@ public class ProductDataStruct {
|
|||
* Array of indexes.
|
||||
* @return TextIndexPoint data.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private TextIndexPoints createTextIndexPoints(List tmpArray) {
|
||||
private TextIndexPoints createTextIndexPoints(List<List<Integer>> tmpArray) {
|
||||
TextIndexPoints tip = new TextIndexPoints();
|
||||
|
||||
// Get the starting index
|
||||
List<?> startPoints = (List<?>) tmpArray.get(0);
|
||||
int startLine = ((Integer) startPoints.get(0)) - 1;
|
||||
int startCol = (Integer) startPoints.get(1);
|
||||
List<Integer> startPoints = tmpArray.get(0);
|
||||
int startLine = (startPoints.get(0)) - 1;
|
||||
int startCol = startPoints.get(1);
|
||||
|
||||
// Get the ending index
|
||||
List<?> endPoints = (List<?>) tmpArray.get(1);
|
||||
int endLine = ((Integer) endPoints.get(0)) - 1;
|
||||
int endCol = ((Integer) endPoints.get(1));
|
||||
List<Integer> endPoints = tmpArray.get(1);
|
||||
int endLine = (endPoints.get(0)) - 1;
|
||||
int endCol = (endPoints.get(1));
|
||||
|
||||
String text = getIndexString(startLine, startCol, endLine, endCol);
|
||||
|
||||
|
@ -320,7 +319,7 @@ public class ProductDataStruct {
|
|||
} else {
|
||||
|
||||
int endColOffset = 0;
|
||||
if (endCol - 1 == productTextArray[i].length()) {
|
||||
if ((endCol - 1) == productTextArray[i].length()) {
|
||||
endColOffset = -1;
|
||||
}
|
||||
|
||||
|
@ -363,7 +362,7 @@ public class ProductDataStruct {
|
|||
*
|
||||
* @return The CI map.
|
||||
*/
|
||||
public HashMap<String, TextIndexPoints> getCiMap() {
|
||||
public Map<String, TextIndexPoints> getCiMap() {
|
||||
return ci;
|
||||
}
|
||||
|
||||
|
@ -372,7 +371,7 @@ public class ProductDataStruct {
|
|||
*
|
||||
* @return The MND map.
|
||||
*/
|
||||
public HashMap<String, TextIndexPoints> getMndMap() {
|
||||
public Map<String, TextIndexPoints> getMndMap() {
|
||||
return mnd;
|
||||
}
|
||||
|
||||
|
@ -412,72 +411,70 @@ public class ProductDataStruct {
|
|||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void printData() {
|
||||
// System.out.println("**** PRINT START ********************************");
|
||||
// System.out.println("****");
|
||||
System.out.println("**** PRINT START ********************************");
|
||||
System.out.println("****");
|
||||
|
||||
/*
|
||||
* Print the Frames information.
|
||||
*/
|
||||
// System.out.println("");
|
||||
// System.out.println("--- frames");
|
||||
System.out.println("");
|
||||
System.out.println("--- frames");
|
||||
for (TextIndexPoints frameData : frames) {
|
||||
// System.out.println("frame text = " + frameData.getText());
|
||||
System.out.println("frame text = " + frameData.getText());
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the CI information.
|
||||
*/
|
||||
// System.out.println("");
|
||||
// System.out.println("--- ci");
|
||||
System.out.println("");
|
||||
System.out.println("--- ci");
|
||||
Set<String> ciKeys = ci.keySet();
|
||||
|
||||
for (String key : ciKeys) {
|
||||
// System.out.println("key = " + key);
|
||||
// System.out.println("text = " + ci.get(key).getText());
|
||||
System.out.println("key = " + key);
|
||||
System.out.println("text = " + ci.get(key).getText());
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the MND information.
|
||||
*/
|
||||
// System.out.println("");
|
||||
// System.out.println("--- mnd");
|
||||
System.out.println("");
|
||||
System.out.println("--- mnd");
|
||||
Set<String> mndKeys = mnd.keySet();
|
||||
|
||||
for (String key : mndKeys) {
|
||||
// System.out.println("key = " + key);
|
||||
// System.out.println("text = " + mnd.get(key).getText());
|
||||
System.out.println("key = " + key);
|
||||
System.out.println("text = " + mnd.get(key).getText());
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the Segments information.
|
||||
*/
|
||||
// System.out.println("");
|
||||
// System.out.println("--- segments");
|
||||
System.out.println("");
|
||||
System.out.println("--- segments");
|
||||
for (SegmentData segData : segments) {
|
||||
// System.out.println("++++++ segment map");
|
||||
HashMap<String, TextIndexPoints> segMap = segData.getSementMap();
|
||||
System.out.println("++++++ segment map");
|
||||
Map<String, TextIndexPoints> segMap = segData.getSementMap();
|
||||
|
||||
Set<String> segMapKeys = segMap.keySet();
|
||||
for (String segMapKey : segMapKeys) {
|
||||
// TextIndexPoints tip = segMap.get(segMapKey);
|
||||
// System.out.println("SegMapKey = " + segMapKey);
|
||||
// System.out.println("Text = " +
|
||||
// segMap.get(segMapKey).getText());
|
||||
TextIndexPoints tip = segMap.get(segMapKey);
|
||||
System.out.println("SegMapKey = " + segMapKey);
|
||||
System.out.println("Text = " + segMap.get(segMapKey).getText());
|
||||
}
|
||||
|
||||
// System.out.println("++++++ headinfo map");
|
||||
HashMap<String, TextIndexPoints> headInfoMap = segData
|
||||
.getHeadInfoMap();
|
||||
System.out.println("++++++ headinfo map");
|
||||
Map<String, TextIndexPoints> headInfoMap = segData.getHeadInfoMap();
|
||||
|
||||
Set<String> headInfoKeys = headInfoMap.keySet();
|
||||
for (String headInfoKey : headInfoKeys) {
|
||||
// System.out.println("headInfoKey = " + headInfoKey);
|
||||
// System.out.println("Text = "
|
||||
// + headInfoMap.get(headInfoKey).getText());
|
||||
System.out.println("headInfoKey = " + headInfoKey);
|
||||
System.out.println("Text = "
|
||||
+ headInfoMap.get(headInfoKey).getText());
|
||||
}
|
||||
}
|
||||
|
||||
// System.out.println("**** PRINT END **********************************");
|
||||
System.out.println("**** PRINT END **********************************");
|
||||
}
|
||||
|
||||
public String getWmoId() {
|
||||
|
@ -505,7 +502,7 @@ public class ProductDataStruct {
|
|||
return mnd.get("pline");
|
||||
}
|
||||
|
||||
public TextIndexPoints getFunnyFiled() {
|
||||
public TextIndexPoints getFunnyField() {
|
||||
return ci.get("funnyfield");
|
||||
}
|
||||
|
||||
|
@ -535,8 +532,9 @@ public class ProductDataStruct {
|
|||
int column = 0;
|
||||
for (line = 0; line < productTextArray.length; line++) {
|
||||
int llen = productTextArray[line].length() + 1;
|
||||
if (offset < llen)
|
||||
if (offset < llen) {
|
||||
break;
|
||||
}
|
||||
offset -= llen;
|
||||
}
|
||||
column = offset;
|
||||
|
|
|
@ -163,7 +163,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* 12/01/2014 #624 zhao Modified saveFile()
|
||||
* 12/16/2014 #14946 ryu Modified updateIssueExpireTimes() so issuance time is displayed
|
||||
* for the local time zones for each segment.
|
||||
*
|
||||
* 01/28/2015 #4018 randerso Code cleanup.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -957,10 +957,7 @@ public class ProductEditorComp extends Composite implements
|
|||
*/
|
||||
private void createTextControl() {
|
||||
|
||||
textComp = new StyledTextComp(this);
|
||||
textComp.setWrapColumn(wrapColumn);
|
||||
|
||||
textComp.setAutoWrapMode(wrapMode);
|
||||
textComp = new StyledTextComp(this, wrapColumn, wrapMode);
|
||||
|
||||
createEditorPopupMenu();
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ import org.eclipse.swt.widgets.Listener;
|
|||
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
|
||||
import com.raytheon.uf.common.python.PythonScript;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.ProductEditorLogger;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.RGBColors;
|
||||
|
@ -84,6 +85,9 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
|
|||
* 29 AUG 2013 #2250 dgilling Better error handling for parseProductText().
|
||||
* 04 SEP 2013 16534 ryu Fixed word wrap to not insert duplicate text; refactor.
|
||||
* 20 DEC 2013 16854 ryu Force re-parsing of text on type change.
|
||||
* 28 JAN 2015 4018 randerso Code cleanup. Fixed reparsing when framing codes are cut
|
||||
* or pasted instead of just typed over.
|
||||
* Added logging of text changes to help diagnose future issues.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -124,7 +128,7 @@ public class StyledTextComp extends Composite {
|
|||
/**
|
||||
* Parent composite.
|
||||
*/
|
||||
private Composite parent;
|
||||
private ProductEditorComp parent;
|
||||
|
||||
/**
|
||||
* Styled text editor.
|
||||
|
@ -157,7 +161,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
private boolean autoWrapMode;
|
||||
|
||||
private int wrapColumn = 80; // TODO: get from external
|
||||
private int wrapColumn;
|
||||
|
||||
private boolean dirty = false;
|
||||
|
||||
|
@ -175,6 +179,8 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
private boolean updatingForCor = false;
|
||||
|
||||
private ProductEditorLogger peLog;
|
||||
|
||||
private static final String NORM_SEP = "^\\s*$";
|
||||
|
||||
private static final String FUNNY_SEP = "^(\\s*)\\*(\\s*)";
|
||||
|
@ -197,11 +203,18 @@ public class StyledTextComp extends Composite {
|
|||
*
|
||||
* @param parent
|
||||
* Parent composite.
|
||||
* @param wrapMode
|
||||
* @param wrapColumn
|
||||
*/
|
||||
public StyledTextComp(Composite parent) {
|
||||
public StyledTextComp(ProductEditorComp parent, int wrapColumn,
|
||||
boolean wrapMode) {
|
||||
super(parent, SWT.BORDER);
|
||||
|
||||
this.parent = parent;
|
||||
this.wrapColumn = wrapColumn;
|
||||
this.autoWrapMode = wrapMode;
|
||||
|
||||
this.peLog = new ProductEditorLogger(parent.getProductName());
|
||||
|
||||
init();
|
||||
}
|
||||
|
@ -294,6 +307,7 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
@Override
|
||||
public void modifyText(ExtendedModifyEvent event) {
|
||||
logTextChange(event);
|
||||
updateTextStyle(event);
|
||||
checkAutoWrap(event);
|
||||
|
||||
|
@ -362,7 +376,7 @@ public class StyledTextComp extends Composite {
|
|||
/*
|
||||
* Lock the ci block text.
|
||||
*/
|
||||
HashMap<String, TextIndexPoints> ciMap = prodDataStruct.getCiMap();
|
||||
Map<String, TextIndexPoints> ciMap = prodDataStruct.getCiMap();
|
||||
TextIndexPoints ciBlockTip = ciMap.get("ciblock");
|
||||
|
||||
if (ciBlockTip != null) {
|
||||
|
@ -374,7 +388,7 @@ public class StyledTextComp extends Composite {
|
|||
/*
|
||||
* Lock the mnd text.
|
||||
*/
|
||||
HashMap<String, TextIndexPoints> mndMap = prodDataStruct.getMndMap();
|
||||
Map<String, TextIndexPoints> mndMap = prodDataStruct.getMndMap();
|
||||
TextIndexPoints mndTip = mndMap.get("mnd");
|
||||
|
||||
if (mndTip != null) {
|
||||
|
@ -502,11 +516,11 @@ public class StyledTextComp extends Composite {
|
|||
* If python throws an Error trying to parse the product.
|
||||
*/
|
||||
private void parseProductText(String productText) throws JepException {
|
||||
HashMap<String, Object> fmtResult = TextFmtParserUtil
|
||||
Map<String, Object> fmtResult = TextFmtParserUtil
|
||||
.parseText(productText);
|
||||
prodDataStruct = new ProductDataStruct(fmtResult, productText);
|
||||
|
||||
prodDataStruct.printData();
|
||||
// prodDataStruct.printData();
|
||||
}
|
||||
|
||||
public void patchMND(String tag) {
|
||||
|
@ -565,7 +579,7 @@ public class StyledTextComp extends Composite {
|
|||
}
|
||||
|
||||
// Find the code and the pit
|
||||
TextIndexPoints ff = prodDataStruct.getFunnyFiled();
|
||||
TextIndexPoints ff = prodDataStruct.getFunnyField();
|
||||
TextIndexPoints pit = prodDataStruct.getPIT();
|
||||
|
||||
if (ff == null) {
|
||||
|
@ -620,7 +634,7 @@ public class StyledTextComp extends Composite {
|
|||
}
|
||||
|
||||
private void makeCorrections() {
|
||||
((ProductEditorComp) parent).setPTypeCategory(PTypeCategory.COR);
|
||||
parent.setPTypeCategory(PTypeCategory.COR);
|
||||
List<SegmentData> segs = prodDataStruct.getSegmentsArray();
|
||||
for (SegmentData seg : segs) {
|
||||
if (seg.getSementMap().keySet().contains("vtec")) {
|
||||
|
@ -642,8 +656,7 @@ public class StyledTextComp extends Composite {
|
|||
int offset = textEditorST.getCaretOffset();
|
||||
Pattern codePattern = Pattern.compile("\\.([A-Z]{3})\\.");
|
||||
for (SegmentData segData : segs) {
|
||||
HashMap<String, TextIndexPoints> segMap = segData
|
||||
.getSementMap();
|
||||
Map<String, TextIndexPoints> segMap = segData.getSementMap();
|
||||
TextIndexPoints tipUgc = segMap.get("ugc");
|
||||
int start = prodDataStruct.positionToOffset(tipUgc
|
||||
.getStartIndex());
|
||||
|
@ -697,8 +710,10 @@ public class StyledTextComp extends Composite {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle the verify key event. This event fires after a change has been
|
||||
* made to the control (after the text has been updated, for example)
|
||||
* Handle the verify key event. Sent when the text is about to be modified.
|
||||
* A verify event occurs after the user has done something to modify the
|
||||
* text (typically typed a key), but before the text is modified. The doit
|
||||
* field in the verify event indicates whether or not to modify the text.
|
||||
*
|
||||
* @param event
|
||||
* Verify event that was fired.
|
||||
|
@ -754,10 +769,6 @@ public class StyledTextComp extends Composite {
|
|||
+ event.length + 1);
|
||||
StyleRange startRange = textEditorST.getStyleRangeAtOffset(start);
|
||||
StyleRange endRange = textEditorST.getStyleRangeAtOffset(end);
|
||||
// StyleRange startRange = textEditorST
|
||||
// .getStyleRangeAtOffset(event.start - 1);
|
||||
// StyleRange endRange = textEditorST
|
||||
// .getStyleRangeAtOffset(event.start + event.length + 1);
|
||||
|
||||
// if it's in a framing code, turn it red
|
||||
if ((startRange != null) && (endRange != null)
|
||||
|
@ -773,13 +784,14 @@ public class StyledTextComp extends Composite {
|
|||
|
||||
// framing code was deleted, need to turn it black
|
||||
boolean framingCodeChange = false;
|
||||
if (("*").equals(event.replacedText)
|
||||
|| ("|").equals(event.replacedText)) {
|
||||
if (event.replacedText.contains("*")
|
||||
|| event.replacedText.contains("|")) {
|
||||
framingCodeChange = true;
|
||||
}
|
||||
// framing code was added, need to turn it red
|
||||
char newText = textEditorST.getText().charAt(event.start);
|
||||
if ((newText == '*') || (newText == '|')) {
|
||||
String newText = textEditorST.getText().substring(event.start,
|
||||
event.start + event.length);
|
||||
if (newText.contains("*") || newText.contains("|")) {
|
||||
framingCodeChange = true;
|
||||
}
|
||||
|
||||
|
@ -1530,4 +1542,17 @@ public class StyledTextComp extends Composite {
|
|||
return new int[] { startIndex, endIndex, text.length() };
|
||||
}
|
||||
|
||||
protected void logTextChange(ExtendedModifyEvent event) {
|
||||
StyledText st = ((StyledText) event.widget);
|
||||
String oldText = event.replacedText;
|
||||
String newText = "";
|
||||
if (event.length > 0) {
|
||||
newText = st.getText(event.start, (event.start + event.length) - 1);
|
||||
}
|
||||
|
||||
if (!newText.equals(oldText)) {
|
||||
peLog.logEdit(event.start, oldText, newText);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue