Omaha #4018 Formatted all formatter launcher code to make later code reviews easier

Change-Id: Iaf415b8bdd3e8fdc46b8ea66e066b9c2ce3b6f7a

Former-commit-id: 8a86832fb2 [formerly 5c08543da0 [formerly 99ae51d268e784461c0686a9d86d512049a501ac]]
Former-commit-id: 5c08543da0
Former-commit-id: a7ab638203
This commit is contained in:
Ron Anderson 2015-01-27 13:40:56 -06:00
parent 70b40e76fb
commit ef1afbaa0c
8 changed files with 243 additions and 231 deletions

View file

@ -548,7 +548,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
this.searchOptions.remove(FindReplaceOptions.SEARCH_POS_END);
int[] matchRange = findString(searchString);
while (!(matchRange[0] == 0 && matchRange[1] == 0)) {
while (!((matchRange[0] == 0) && (matchRange[1] == 0))) {
int newOffset = matchRange[1];
editorST.replaceTextRange(matchRange[0], searchString.length(),
@ -607,7 +607,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
int[] replaceMatch = findString(replaceString,
selectionToBeReplaced.x);
if (!(replaceMatch[0] == 0 && replaceMatch[1] == 0)) {
if (!((replaceMatch[0] == 0) && (replaceMatch[1] == 0))) {
editorComp.reParse();
editorST.setCaretOffset(replaceMatch[1]);
}
@ -630,8 +630,9 @@ public class FindReplaceDlg extends CaveSWTDialog {
*
*/
private void handleClickFind(SelectionEvent event) {
if (findTF.getText().equals(""))
if (findTF.getText().equals("")) {
return;
}
cursorOffset = editorST.getCaretOffset();
@ -639,8 +640,8 @@ public class FindReplaceDlg extends CaveSWTDialog {
// For BACKWARD_SEARCH option:
// Need skip the previously found string
if (searchOptions.contains(FindReplaceOptions.BACKWARD_SEARCH)) {
if (editorST.getSelectionRange() != null
&& editorST.getSelectionRange().y > 0) {
if ((editorST.getSelectionRange() != null)
&& (editorST.getSelectionRange().y > 0)) {
cursorOffset -= editorST.getSelectionRange().y;
if (cursorOffset < 0) {
cursorOffset = 0;
@ -671,7 +672,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
private boolean findAndSelectString(String searchString) {
int[] matchRange = findString(searchString);
if (!(matchRange[0] == 0 && matchRange[1] == 0)) {
if (!((matchRange[0] == 0) && (matchRange[1] == 0))) {
editorST.setSelection(matchRange[0], matchRange[1]);
editorST.showSelection();
cursorOffset = editorST.getCaretOffset();
@ -744,8 +745,9 @@ public class FindReplaceDlg extends CaveSWTDialog {
// if (searchOptions.contains(FindReplaceOptions.EXACT_MATCH)
// && !searchOptions.contains(FindReplaceOptions.REGEX_SEARCH))
// searchRegex = "\\b" + searchRegex + "\\b";
if (searchOptions.contains(FindReplaceOptions.IGNORE_CASE))
if (searchOptions.contains(FindReplaceOptions.IGNORE_CASE)) {
regexFlags |= Pattern.CASE_INSENSITIVE;
}
// Need handle the PatternSyntaxException when user searches meta
// character(s) but forgot to toggle on the regex option.
@ -761,10 +763,11 @@ public class FindReplaceDlg extends CaveSWTDialog {
match[0] = matcher.start();
match[1] = matcher.end();
if (searchOptions
.contains(FindReplaceOptions.FORWARD_SEARCH))
.contains(FindReplaceOptions.FORWARD_SEARCH)) {
break;
}
}
}
} catch (PatternSyntaxException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to parse the search string", e);
@ -829,7 +832,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
int searchEndIndex;
int[] match = { 0, 0 };
if (searchString == null || searchString.equals("")) {
if ((searchString == null) || searchString.equals("")) {
return match;
}

View file

@ -35,7 +35,6 @@ package com.raytheon.viz.gfe.dialogs.formatterlauncher;
* @author lvenable
* @version 1.0
*/
public interface ITransmissionState
{
public interface ITransmissionState {
void setTransmissionState(ConfigData.productStateEnum state);
}

View file

@ -2015,8 +2015,7 @@ public class ProductEditorComp extends Composite implements
if (pds != null) {
String officeTimeZone = dm.getParmManager()
.compositeGridLocation()
.getTimeZone();
.compositeGridLocation().getTimeZone();
int numSegments = pds.getSegmentsArray().size();
SimpleDateFormat fmt = new SimpleDateFormat(longLocalFmtStr);
fmt.setTimeZone(localTimeZone);
@ -2025,8 +2024,7 @@ public class ProductEditorComp extends Composite implements
for (int i = 0; i < numSegments; i++) {
textComp.startUpdate();
HashMap<String, TextIndexPoints> segMap = pds
.getSegmentsArray()
.get(i).getSementMap();
.getSegmentsArray().get(i).getSementMap();
TextIndexPoints tip = segMap.get("purgeT");
if (tip != null) {
@ -2046,10 +2044,10 @@ public class ProductEditorComp extends Composite implements
// vtecs are fixed length and this is variable length,
// which ensures we only need to reParse() once per
// segment
List<String> zones = decodeUGCs(pds.getSegmentsArray().get(i));
List<String> zones = decodeUGCs(pds.getSegmentsArray()
.get(i));
List<String> timeZones = dm.getTextProductMgr()
.getTimeZones(zones,
officeTimeZone);
.getTimeZones(zones, officeTimeZone);
StringBuilder sb = new StringBuilder();
for (String tz : timeZones) {
@ -2256,9 +2254,9 @@ public class ProductEditorComp extends Composite implements
private void saveFile() {
String fname = null;
if ( productDefinition.get("outputFile") != null ) {
if (productDefinition.get("outputFile") != null) {
fname = getDefString("outputFile");
if ( fname.equals(EMPTY) ) {
if (fname.equals(EMPTY)) {
return;
}
} else {

View file

@ -58,8 +58,11 @@ public class SegmentData {
/**
* Add entry into the segment map.
* @param key Map key.
* @param tip Text index point data.
*
* @param key
* Map key.
* @param tip
* Text index point data.
*/
public void addToSegmentMap(String key, TextIndexPoints tip) {
segMap.put(key, tip);
@ -67,8 +70,11 @@ public class SegmentData {
/**
* Add entry into the head info map.
* @param key Map key.
* @param tip Text index point data.
*
* @param key
* Map key.
* @param tip
* Text index point data.
*/
public void addToHeadInfoMap(String key, TextIndexPoints tip) {
headInfoMap.put(key, tip);
@ -76,7 +82,9 @@ public class SegmentData {
/**
* Get a text index point data from the segment map.
* @param key Map key.
*
* @param key
* Map key.
* @return Segment text index point data.
*/
public TextIndexPoints getSegmentDataIndexPoints(String key) {
@ -85,7 +93,9 @@ public class SegmentData {
/**
* Get a text index point data from the head info map.
* @param key Map key.
*
* @param key
* Map key.
* @return Segment text index point data.
*/
public TextIndexPoints getHeadInfoDataIndexPoints(String key) {
@ -94,6 +104,7 @@ public class SegmentData {
/**
* Get the segment map.
*
* @return The segment map.
*/
public HashMap<String, TextIndexPoints> getSementMap() {
@ -102,6 +113,7 @@ public class SegmentData {
/**
* Get the head info map.
*
* @return The head info map.
*/
public HashMap<String, TextIndexPoints> getHeadInfoMap() {

View file

@ -148,8 +148,7 @@ public class StoreTransmitCountdownThread extends Thread {
return;
}
// Increment the progress bar
progressBar
.setSelection(progressBar.getSelection() + 1);
progressBar.setSelection(progressBar.getSelection() + 1);
countdownLbl.setText(countdownPrefix + counter
+ " seconds...");
--counter;

View file

@ -410,7 +410,8 @@ public class StyledTextComp extends Composite {
// should be unlocked. Cities list is unlocked for editing
// when framing codes are present.
if (newProduct) {
if (cityTip != null && cityTip.getText().indexOf("|*") > 0) {
if ((cityTip != null)
&& (cityTip.getText().indexOf("|*") > 0)) {
unlockCitySegs.add(ugc);
}
}
@ -448,7 +449,7 @@ public class StyledTextComp extends Composite {
* correct the end value.
*/
int endLineOffset = 0;
if (endLine == productTextArray.length - 1) {
if (endLine == (productTextArray.length - 1)) {
++endLineOffset;
}
@ -568,7 +569,7 @@ public class StyledTextComp extends Composite {
TextIndexPoints pit = prodDataStruct.getPIT();
if (ff == null) {
if (pit == null || newfield.length() == 0) {
if ((pit == null) || (newfield.length() == 0)) {
return; // No typecode or ci block found
} else {
ff = new TextIndexPoints();
@ -608,8 +609,7 @@ public class StyledTextComp extends Composite {
// only reparse if we replaced with different length text or forced
// else, replace StyleRanges since the operation is safe
if ((tip.getText().length() != text.length())
|| forceReparse) {
if ((tip.getText().length() != text.length()) || forceReparse) {
dirty = true;
} else {
for (StyleRange range : ranges) {
@ -635,7 +635,7 @@ public class StyledTextComp extends Composite {
try {
startUpdate();
List<SegmentData> segs = prodDataStruct.getSegmentsArray();
if (segs == null || segs.size() == 0) {
if ((segs == null) || (segs.size() == 0)) {
return;
}
@ -648,7 +648,7 @@ public class StyledTextComp extends Composite {
int start = prodDataStruct.positionToOffset(tipUgc
.getStartIndex());
int end = prodDataStruct.positionToOffset(tipUgc.getEndIndex());
if (offset <= start || offset >= end) {
if ((offset <= start) || (offset >= end)) {
continue;
}
TextIndexPoints tipVtec = segMap.get("vtec");
@ -735,8 +735,8 @@ public class StyledTextComp extends Composite {
// this is specifically to handle the case of deleting line breaks
// between two separate locked sections so a locked section cannot be
// moved onto the end of an unlocked line
if (length == 1 && event.text.length() == 0) {
if (offset + 2 < textEditorST.getCharCount()
if ((length == 1) && (event.text.length() == 0)) {
if (((offset + 2) < textEditorST.getCharCount())
&& rangeHasLockedText(offset, 2)) {
event.doit = false;
return;
@ -748,7 +748,7 @@ public class StyledTextComp extends Composite {
}
private void updateTextStyle(ExtendedModifyEvent event) {
if (event.start + event.length + 1 < textEditorST.getCharCount()) {
if ((event.start + event.length + 1) < textEditorST.getCharCount()) {
int start = Math.max(0, event.start - 1);
int end = Math.min(textEditorST.getCharCount() - 1, event.start
+ event.length + 1);
@ -760,9 +760,9 @@ public class StyledTextComp extends Composite {
// .getStyleRangeAtOffset(event.start + event.length + 1);
// if it's in a framing code, turn it red
if (startRange != null && endRange != null
&& event.start > startRange.start
&& event.start + event.length < endRange.start
if ((startRange != null) && (endRange != null)
&& (event.start > startRange.start)
&& ((event.start + event.length) < endRange.start)
&& startRange.similarTo(endRange)
&& startRange.foreground.equals(frameColor)) {
StyleRange style = (StyleRange) startRange.clone();
@ -779,7 +779,7 @@ public class StyledTextComp extends Composite {
}
// framing code was added, need to turn it red
char newText = textEditorST.getText().charAt(event.start);
if (newText == '*' || newText == '|') {
if ((newText == '*') || (newText == '|')) {
framingCodeChange = true;
}
@ -801,8 +801,8 @@ public class StyledTextComp extends Composite {
StyleRange[] srArray = textEditorST.getStyleRanges(true);
for (int i = 0; i < srArray.length; i++) {
if (srArray[i].start <= offset
&& offset <= srArray[i].start + srArray[i].length) {
if ((srArray[i].start <= offset)
&& (offset <= (srArray[i].start + srArray[i].length))) {
if (srArray[i].foreground == frameColor) {
inFramingCode(srArray[i]);
}
@ -868,10 +868,11 @@ public class StyledTextComp extends Composite {
* @return True if the key is an arrow or "non-edit" key.
*/
private boolean isNonEditKey(KeyEvent event) {
if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN
|| event.keyCode == SWT.ARROW_LEFT
|| event.keyCode == SWT.ARROW_RIGHT
|| event.keyCode == SWT.SHIFT) {
if ((event.keyCode == SWT.ARROW_UP)
|| (event.keyCode == SWT.ARROW_DOWN)
|| (event.keyCode == SWT.ARROW_LEFT)
|| (event.keyCode == SWT.ARROW_RIGHT)
|| (event.keyCode == SWT.SHIFT)) {
return true;
}
@ -943,8 +944,8 @@ public class StyledTextComp extends Composite {
StyleRange[] sr = textEditorST.getStyleRanges(true);
for (int i = 0; i < sr.length; i++) {
if (sr[i].start <= offset
&& offset <= sr[i].start + sr[i].length) {
if ((sr[i].start <= offset)
&& (offset <= (sr[i].start + sr[i].length))) {
if (sr[i].foreground == frameColor) {
inFramingCode(sr[i]);
}
@ -1110,15 +1111,15 @@ public class StyledTextComp extends Composite {
int lineNum = textEditorST.getLineAtOffset(event.start);
int lineLength = textEditorST.getLine(lineNum).length();
if (lineLength < wrapColumn
&& event.length >= event.replacedText.length()) {
if ((lineLength < wrapColumn)
&& (event.length >= event.replacedText.length())) {
return;
}
String NL = textEditorST.getLineDelimiter();
String line = textEditorST.getLine(lineNum)
+ ((lineNum + 1 < totalLines) ? NL : EMPTY);
+ (((lineNum + 1) < totalLines) ? NL : EMPTY);
lineLength = line.length();
if (NL.equals(line) || EMPTY.equals(line)) {
return;
@ -1148,14 +1149,14 @@ public class StyledTextComp extends Composite {
// check for locked text
StyleRange styleRange = textEditorST.getStyleRangeAtOffset(lineOff
+ index);
if (styleRange != null && styleRange.foreground == lockColor) {
if ((styleRange != null) && (styleRange.foreground == lockColor)) {
return;
}
// deal with programmatic changes distant from the cursor
int eventCursor = cursorOffset;
if (eventCursor < event.start
|| eventCursor > event.start + event.length) {
if ((eventCursor < event.start)
|| (eventCursor > (event.start + event.length))) {
eventCursor = event.start + event.length;
}
@ -1233,7 +1234,7 @@ public class StyledTextComp extends Composite {
insertColor, lockColor };
String[] labels = new String[] { "Background", "Foreground", "Frame",
"Insert", "Locked" };
for (int i = 0; i < colors.length - 1; i++) {
for (int i = 0; i < (colors.length - 1); i++) {
for (int j = i + 1; j < colors.length; j++) {
warnIfEqual(colors[i], colors[j], labels[i], labels[j]);
}
@ -1417,7 +1418,7 @@ public class StyledTextComp extends Composite {
lineCursorPos = 0;
// remember last good endIndex
endIndex = lineStartOffset + line.length() - 1;
endIndex = (lineStartOffset + line.length()) - 1;
}
if (endIndex < 0) {
@ -1446,7 +1447,7 @@ public class StyledTextComp extends Composite {
// get the text from the caret to the end of the block
String post = "";
if (endIndex >= cursorIndex && cursorIndex < st.getCharCount()) {
if ((endIndex >= cursorIndex) && (cursorIndex < st.getCharCount())) {
post = st.getText(cursorIndex, endIndex);
}
@ -1455,7 +1456,7 @@ public class StyledTextComp extends Composite {
if (cursorIndex > 0) {
lchar = st.getTextRange(cursorIndex - 1, 1);
char lchar0 = lchar.charAt(0);
if (Character.isSpaceChar(lchar0) && lchar0 != NL.charAt(0)) {
if (Character.isSpaceChar(lchar0) && (lchar0 != NL.charAt(0))) {
lchar = " ";
} else {
lchar = "";
@ -1465,7 +1466,7 @@ public class StyledTextComp extends Composite {
String rchar = "";
if (post.length() > 0) {
char post0 = post.charAt(0);
if (Character.isSpaceChar(post0) && post0 != NL.charAt(0)) {
if (Character.isSpaceChar(post0) && (post0 != NL.charAt(0))) {
rchar = " ";
}
}
@ -1522,7 +1523,7 @@ public class StyledTextComp extends Composite {
post = post.replaceAll("^\\s*", "");
String text = pre + rchar + post;
st.replaceTextRange(startIndex, 1 + endIndex - startIndex, text);
st.replaceTextRange(startIndex, (1 + endIndex) - startIndex, text);
int newCaretOffset = startIndex + pre.length();
st.setCaretOffset(newCaretOffset);