Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2014-04-29 07:03:26 +0000
committerAlexander Kurtakov2014-04-29 18:03:19 +0000
commit4f338c8d058add881bde9463f3d3b4bfcb979f9d (patch)
treeff12cb5738fbd7f1aca8e22b199ed833dff7b390 /systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools
parentb6129d7f949767d84bf3d3c35a16f61d20d11312 (diff)
downloadorg.eclipse.linuxtools-4f338c8d058add881bde9463f3d3b4bfcb979f9d.tar.gz
org.eclipse.linuxtools-4f338c8d058add881bde9463f3d3b4bfcb979f9d.tar.xz
org.eclipse.linuxtools-4f338c8d058add881bde9463f3d3b4bfcb979f9d.zip
More cleanups.
* Empty statements * This final field could be made static * Member could be replaced by local variable * 'static' modifier out of order with the JLS suggestions. * strings handling * unused parameters * unnecessary local before return Change-Id: I7e6b45466178696345a057f75278c6c5c8a670ad Signed-off-by: Alexander Kurtakov <akurtako@redhat.com> Reviewed-on: https://git.eclipse.org/r/25708 Tested-by: Hudson CI
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools')
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPerspective.java2
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java11
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IndentHandler.java15
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/IndentUtil.java16
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPAutoEditStrategy.java66
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPCompletionProcessor.java3
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPConfiguration.java7
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java3
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPIndenter.java18
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitionScanner.java12
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPProbeScanner.java12
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java21
12 files changed, 94 insertions, 92 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPerspective.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPerspective.java
index 2fd6152339..6a9d12e262 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPerspective.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPerspective.java
@@ -29,7 +29,7 @@ import org.eclipse.ui.console.IConsoleConstants;
* @author Ryan Morse
*/
public class IDEPerspective implements IPerspectiveFactory {
- public static String ID = "org.eclipse.linuxtools.systemtap.ui.ide.IDEPerspective"; //$NON-NLS-1$
+ public static final String ID = "org.eclipse.linuxtools.systemtap.ui.ide.IDEPerspective"; //$NON-NLS-1$
@Override
public void createInitialLayout(IPageLayout layout) {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java
index efcf6ebe28..52ace35be4 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/IDEPlugin.java
@@ -100,8 +100,7 @@ public class IDEPlugin extends AbstractUIPlugin {
path = ""; //$NON-NLS-1$
}
try {
- URI uri = new URI("ssh", user, host, -1, path, null, null); //$NON-NLS-1$
- return uri;
+ return new URI("ssh", user, host, -1, path, null, null); //$NON-NLS-1$
} catch (URISyntaxException uri) {
return null;
}
@@ -112,13 +111,15 @@ public class IDEPlugin extends AbstractUIPlugin {
}
public static void log(Throwable e) {
- if (e instanceof InvocationTargetException)
+ if (e instanceof InvocationTargetException) {
e = ((InvocationTargetException) e).getTargetException();
+ }
IStatus status = null;
- if (e instanceof CoreException)
+ if (e instanceof CoreException) {
status = ((CoreException) e).getStatus();
- else
+ } else {
status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getMessage(), e);
+ }
log(status);
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IndentHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IndentHandler.java
index 449ee316c4..5684166c8f 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IndentHandler.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/IndentHandler.java
@@ -381,8 +381,7 @@ public class IndentHandler extends AbstractHandler {
* @return the tab size as defined in the current formatter preferences
*/
private int getTabSize() {
- return getCoreFormatterOption(
- STPDefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, 4);
+ return getCoreFormatterOption(4);
}
/**
@@ -394,7 +393,7 @@ public class IndentHandler extends AbstractHandler {
*/
private boolean indentEmptyLines() {
return STPDefaultCodeFormatterConstants.TRUE
- .equals(getCoreFormatterOption(STPDefaultCodeFormatterConstants.FORMATTER_INDENT_EMPTY_LINES));
+ .equals(getCoreFormatterOption());
}
/**
@@ -406,7 +405,7 @@ public class IndentHandler extends AbstractHandler {
*/
private boolean indentInsideLineComments() {
return STPDefaultCodeFormatterConstants.TRUE
- .equals(getCoreFormatterOption(STPDefaultCodeFormatterConstants.FORMATTER_INDENT_INSIDE_LINE_COMMENTS));
+ .equals(getCoreFormatterOption());
}
/**
@@ -417,7 +416,7 @@ public class IndentHandler extends AbstractHandler {
* the key of the preference
* @return the value of the preference
*/
- private String getCoreFormatterOption(String key) {
+ private String getCoreFormatterOption() {
return "false"; //$NON-NLS-1$
}
@@ -425,15 +424,13 @@ public class IndentHandler extends AbstractHandler {
* Returns the possibly project-specific core preference defined under
* <code>key</code>, or <code>def</code> if the value is not a integer.
*
- * @param key
- * the key of the preference
* @param def
* the default value
* @return the value of the preference
*/
- private int getCoreFormatterOption(String key, int def) {
+ private int getCoreFormatterOption(int def) {
try {
- return Integer.parseInt(getCoreFormatterOption(key));
+ return Integer.parseInt(getCoreFormatterOption());
} catch (NumberFormatException e) {
return def;
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/IndentUtil.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/IndentUtil.java
index 15d6e125ea..c33193ad2a 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/IndentUtil.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/IndentUtil.java
@@ -226,10 +226,11 @@ public final class IndentUtil {
// standard C code indentation
if (indent == null) {
StringBuilder computed= indenter.computeIndentation(offset);
- if (computed != null)
+ if (computed != null) {
indent= computed.toString();
- else
- indent= new String();
+ } else {
+ indent= ""; //$NON-NLS-1$
+ }
}
return indent;
}
@@ -245,8 +246,9 @@ public final class IndentUtil {
* @throws BadLocationException
*/
public static String computeCommentIndent(IDocument document, int line, STPHeuristicScanner scanner, ITypedRegion partition) throws BadLocationException {
- if (line == 0) // impossible - the first line is never inside a comment
+ if (line == 0) { // impossible - the first line is never inside a comment
return null;
+ }
// don't make any assumptions if the line does not start with \s*\* - it might be
// commented out code, for which we don't want to change the indent
@@ -256,8 +258,9 @@ public final class IndentUtil {
final int lineEnd= lineStart + lineLength;
int nonWS= scanner.findNonWhitespaceForwardInAnyPartition(lineStart, lineEnd);
if (nonWS == STPHeuristicScanner.NOT_FOUND || document.getChar(nonWS) != '*') {
- if (nonWS == STPHeuristicScanner.NOT_FOUND)
+ if (nonWS == STPHeuristicScanner.NOT_FOUND) {
return document.get(lineStart, lineLength);
+ }
return document.get(lineStart, nonWS - lineStart);
}
@@ -276,8 +279,9 @@ public final class IndentUtil {
previousLineLength= previousLine.getLength();
previousLineEnd= previousLineStart + previousLineLength;
previousLineNonWS= scanner.findNonWhitespaceForwardInAnyPartition(previousLineStart, previousLineEnd);
- if (previousLineNonWS == STPHeuristicScanner.NOT_FOUND)
+ if (previousLineNonWS == STPHeuristicScanner.NOT_FOUND) {
previousLineNonWS= previousLineEnd;
+ }
// add the initial space
// TODO this may be controlled by a formatter preference in the future
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPAutoEditStrategy.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPAutoEditStrategy.java
index 11efa8bcc1..fe56a2b6e2 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPAutoEditStrategy.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPAutoEditStrategy.java
@@ -49,14 +49,15 @@ public class STPAutoEditStrategy extends
*
* @param document
* @param offset
- * @param partitioning
* @return the block balance
*/
- private static int getBlockBalance(IDocument document, int offset, String partitioning) {
- if (offset < 1)
+ private static int getBlockBalance(IDocument document, int offset) {
+ if (offset < 1) {
return -1;
- if (offset >= document.getLength())
+ }
+ if (offset >= document.getLength()) {
return 1;
+ }
int begin = offset;
int end = offset - 1;
@@ -213,7 +214,7 @@ public class STPAutoEditStrategy extends
// copy old content of line behind insertion point to new line
// unless we think we are inserting an anonymous type definition
- if (c.offset == 0 || !(computeAnonymousPosition(d, c.offset - 1, fPartitioning, lineEnd) != -1)) {
+ if (c.offset == 0 || !(computeAnonymousPosition(d, c.offset - 1, lineEnd) != -1)) {
if (lineEnd - contentStart > 0) {
c.length = lineEnd - c.offset;
buf.append(d.get(contentStart, lineEnd - contentStart).toCharArray());
@@ -223,12 +224,14 @@ public class STPAutoEditStrategy extends
buf.append(TextUtilities.getDefaultLineDelimiter(d));
StringBuilder reference = null;
int nonWS = findEndOfWhiteSpace(d, start, lineEnd);
- if (nonWS < c.offset && d.getChar(nonWS) == '{')
+ if (nonWS < c.offset && d.getChar(nonWS) == '{') {
reference = new StringBuilder(d.get(start, nonWS - start));
- else
+ } else {
reference = indenter.getReferenceIndentation(c.offset);
- if (reference != null)
+ }
+ if (reference != null) {
buf.append(reference);
+ }
buf.append('}');
int bound= c.offset > 200 ? c.offset - 200 : STPHeuristicScanner.UNBOUND;
int bracePos = scanner.findOpeningPeer(c.offset - 1, bound, '{', '}');
@@ -248,15 +251,17 @@ public class STPAutoEditStrategy extends
StringBuilder reference = null;
int nonWS = findEndOfWhiteSpace(d, start, lineEnd);
- if (nonWS < c.offset && d.getChar(nonWS) == '{')
+ if (nonWS < c.offset && d.getChar(nonWS) == '{') {
reference = new StringBuilder(d.get(start, nonWS - start));
- else
+ } else {
reference = indenter.getReferenceIndentation(c.offset);
+ }
buf.append(TextUtilities.getDefaultLineDelimiter(d));
- if (reference != null)
+ if (reference != null) {
buf.append(reference);
+ }
}
}
c.text = buf.toString();
@@ -267,8 +272,9 @@ public class STPAutoEditStrategy extends
}
private void smartIndentUponE(IDocument doc, DocumentCommand c) {
- if (c.offset < 4 || doc.getLength() == 0)
+ if (c.offset < 4 || doc.getLength() == 0) {
return;
+ }
try {
String content = doc.get(c.offset - 3, 3);
@@ -281,21 +287,24 @@ public class STPAutoEditStrategy extends
int lineOffset = doc.getLineOffset(line);
// make sure we don't have any leading comments etc.
- if (doc.get(lineOffset, p - lineOffset).trim().length() != 0)
+ if (doc.get(lineOffset, p - lineOffset).trim().length() != 0) {
return;
+ }
// Line of last C code
int pos = scanner.findNonWhitespaceBackward(p - 1, STPHeuristicScanner.UNBOUND);
- if (pos == -1)
+ if (pos == -1) {
return;
+ }
int lastLine = doc.getLineOfOffset(pos);
// Only shift if the last C line is further up and is a braceless block candidate
if (lastLine < line) {
STPIndenter indenter = new STPIndenter(doc, scanner, fProject);
int ref = indenter.findReferencePosition(p, true, MatchMode.REGULAR);
- if (ref == STPHeuristicScanner.NOT_FOUND)
+ if (ref == STPHeuristicScanner.NOT_FOUND) {
return;
+ }
int refLine = doc.getLineOfOffset(ref);
String indent = getIndentOfLine(doc, refLine);
@@ -305,7 +314,6 @@ public class STPAutoEditStrategy extends
c.offset = lineOffset;
}
}
-
return;
}
@@ -318,31 +326,35 @@ public class STPAutoEditStrategy extends
int lineOffset = doc.getLineOffset(line);
// make sure we don't have any leading comments etc.
- if (doc.get(lineOffset, p - lineOffset).trim().length() != 0)
+ if (doc.get(lineOffset, p - lineOffset).trim().length() != 0) {
return;
+ }
// Line of last C code
int pos = scanner.findNonWhitespaceBackward(p - 1, STPHeuristicScanner.UNBOUND);
- if (pos == -1)
+ if (pos == -1) {
return;
+ }
int lastLine = doc.getLineOfOffset(pos);
// Only shift if the last C line is further up and is a braceless block candidate
if (lastLine < line) {
STPIndenter indenter = new STPIndenter(doc, scanner, fProject);
int ref = indenter.findReferencePosition(p, false, MatchMode.MATCH_CASE);
- if (ref == STPHeuristicScanner.NOT_FOUND)
+ if (ref == STPHeuristicScanner.NOT_FOUND) {
return;
+ }
int refLine = doc.getLineOfOffset(ref);
int nextToken = scanner.nextToken(ref, STPHeuristicScanner.UNBOUND);
String indent;
- if (nextToken == STPSymbols.TokenCASE || nextToken == STPSymbols.TokenDEFAULT)
+ if (nextToken == STPSymbols.TokenCASE || nextToken == STPSymbols.TokenDEFAULT) {
indent = getIndentOfLine(doc, refLine);
- else // at the brace of the switch
+ } else {// at the brace of the switch
indent = indenter.computeIndentation(p).toString();
+ }
if (indent != null) {
- c.text = indent.toString() + "case"; //$NON-NLS-1$
+ c.text = indent + "case"; //$NON-NLS-1$
c.length += c.offset - lineOffset;
c.offset = lineOffset;
}
@@ -360,11 +372,10 @@ public class STPAutoEditStrategy extends
*
* @param document the document being modified
* @param offset the offset of the caret position, relative to the line start.
- * @param partitioning the document partitioning
* @param max the max position
* @return an insert position relative to the line start if <code>line</code> contains a parenthesized expression that can be followed by a block, -1 otherwise
*/
- private static int computeAnonymousPosition(IDocument document, int offset, String partitioning, int max) {
+ private static int computeAnonymousPosition(IDocument document, int offset, int max) {
// find the opening parenthesis for every closing parenthesis on the current line after offset
// return the position behind the closing parenthesis if it looks like a method declaration
// or an expression for an if, while, for, catch statement
@@ -373,8 +384,9 @@ public class STPAutoEditStrategy extends
int pos = offset;
int length = max;
int scanTo = scanner.scanForward(pos, length, '}');
- if (scanTo == -1)
+ if (scanTo == -1) {
scanTo = length;
+ }
int closingParen = findClosingParenToLeft(scanner, pos) - 1;
@@ -416,7 +428,7 @@ public class STPAutoEditStrategy extends
}
private boolean isClosedBrace(IDocument document, int offset) {
- return getBlockBalance(document, offset, fPartitioning) <= 0;
+ return getBlockBalance(document, offset) <= 0;
}
private void smartIndentOnKeypress(IDocument document, DocumentCommand command) {
@@ -1082,4 +1094,4 @@ public class STPAutoEditStrategy extends
}
}
}
-} \ No newline at end of file
+}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPCompletionProcessor.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPCompletionProcessor.java
index feb2a11635..0ef28f1db3 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPCompletionProcessor.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPCompletionProcessor.java
@@ -349,8 +349,7 @@ public class STPCompletionProcessor implements IContentAssistProcessor, ITextHov
for (int n = offset - 1; n >= 0; n--) {
char c = doc.getChar(n);
if (isTokenDelimiter(c)) {
- String word = doc.get(n + 1, offset - n - 1);
- return word;
+ return doc.get(n + 1, offset - n - 1);
}
}
return ""; //$NON-NLS-1$
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPConfiguration.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPConfiguration.java
index 498aa99bbb..afef2384b7 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPConfiguration.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPConfiguration.java
@@ -100,8 +100,7 @@ public class STPConfiguration extends SourceViewerConfiguration {
{
STPReconcilingStrategy strategy = new STPReconcilingStrategy();
strategy.setEditor(editor);
- MonoReconciler reconciler = new MonoReconciler(strategy,false);
- return reconciler;
+ return new MonoReconciler(strategy,false);
}
/**
@@ -116,10 +115,6 @@ public class STPConfiguration extends SourceViewerConfiguration {
return doubleClickStrategy;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
- */
@Override
public IPresentationReconciler getPresentationReconciler(
ISourceViewer sourceViewer) {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java
index 045cfd537b..8a812fe752 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java
@@ -38,7 +38,6 @@ public class STPEditor extends SimpleEditor {
private ColorManager colorManager;
- private ProjectionSupport stpProjectionSupport;
private Annotation[] stpOldAnnotations;
private ProjectionAnnotationModel stpAnnotationModel;
@@ -69,7 +68,7 @@ public class STPEditor extends SimpleEditor {
{
super.createPartControl(parent);
ProjectionViewer viewer =(ProjectionViewer)getSourceViewer();
- stpProjectionSupport = new ProjectionSupport(viewer,getAnnotationAccess(),getSharedColors());
+ ProjectionSupport stpProjectionSupport = new ProjectionSupport(viewer,getAnnotationAccess(),getSharedColors());
stpProjectionSupport.install();
viewer.doOperation(ProjectionViewer.TOGGLE);
stpAnnotationModel = viewer.getProjectionAnnotationModel();
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPIndenter.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPIndenter.java
index 743a5adc17..e5d2efcafc 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPIndenter.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPIndenter.java
@@ -699,8 +699,7 @@ public final class STPIndenter {
try {
IRegion line= fDocument.getLineInformationOfOffset(offset);
int lineEnd= line.getOffset() + line.getLength();
- int next= fScanner.nextToken(offset, lineEnd);
- return next;
+ return fScanner.nextToken(offset, lineEnd);
} catch (BadLocationException e) {
}
}
@@ -720,8 +719,7 @@ public final class STPIndenter {
IRegion line= fDocument.getLineInformationOfOffset(offset);
int lineEnd= line.getOffset() + line.getLength();
fScanner.nextToken(offset, lineEnd);
- int next = fScanner.nextToken(fScanner.getPosition(), lineEnd);
- return next;
+ return fScanner.nextToken(fScanner.getPosition(), lineEnd);
} catch (BadLocationException e) {
}
}
@@ -781,15 +779,17 @@ public final class STPIndenter {
case STPSymbols.TokenCASE:
case STPSymbols.TokenDEFAULT:
- if (isFirstTokenOnLine)
+ if (isFirstTokenOnLine) {
matchMode = MatchMode.MATCH_CASE;
+ }
break;
case STPSymbols.TokenPUBLIC:
case STPSymbols.TokenPROTECTED:
case STPSymbols.TokenPRIVATE:
- if (isFirstTokenOnLine && peekSecondToken(offset) != STPSymbols.TokenIDENT)
+ if (isFirstTokenOnLine && peekSecondToken(offset) != STPSymbols.TokenIDENT) {
matchMode = MatchMode.MATCH_ACCESS_SPECIFIER;
+ }
break;
case STPSymbols.TokenLBRACE: // for opening-brace-on-new-line style
@@ -816,13 +816,15 @@ public final class STPIndenter {
break;
case STPSymbols.TokenRBRACE: // closing braces get unindented
- if (isFirstTokenOnLine || prevToken != STPSymbols.TokenLBRACE)
+ if (isFirstTokenOnLine || prevToken != STPSymbols.TokenLBRACE) {
matchMode = MatchMode.MATCH_BRACE;
+ }
break;
case STPSymbols.TokenRPAREN:
- if (isFirstTokenOnLine)
+ if (isFirstTokenOnLine) {
matchMode = MatchMode.MATCH_PAREN;
+ }
break;
}
} catch (BadLocationException e) {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitionScanner.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitionScanner.java
index de959ce0e8..8f31ec3747 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitionScanner.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitionScanner.java
@@ -24,14 +24,14 @@ import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.rules.WordRule;
public class STPPartitionScanner extends RuleBasedPartitionScanner {
- public final static String STP_PARTITIONING = "__stp_partitioning"; //$NON-NLS-1$
+ public static final String STP_PARTITIONING = "__stp_partitioning"; //$NON-NLS-1$
- public final static String STP_STRING = "__stp_string"; //$NON-NLS-1$
- public final static String STP_COMMENT = "__stp_comment"; //$NON-NLS-1$
- public final static String STP_CONDITIONAL = "__stp_conditional"; //$NON-NLS-1$
- public final static String STP_MULTILINE_COMMENT = "__stp_multiline_comment"; //$NON-NLS-1$
+ public static final String STP_STRING = "__stp_string"; //$NON-NLS-1$
+ public static final String STP_COMMENT = "__stp_comment"; //$NON-NLS-1$
+ public static final String STP_CONDITIONAL = "__stp_conditional"; //$NON-NLS-1$
+ public static final String STP_MULTILINE_COMMENT = "__stp_multiline_comment"; //$NON-NLS-1$
- public static String[] STP_PARTITION_TYPES = { IDocument.DEFAULT_CONTENT_TYPE,
+ public static final String[] STP_PARTITION_TYPES = { IDocument.DEFAULT_CONTENT_TYPE,
STP_COMMENT, STP_MULTILINE_COMMENT, STP_STRING, STP_CONDITIONAL};
/**
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPProbeScanner.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPProbeScanner.java
index 7e96af4e25..b194acfa7c 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPProbeScanner.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPProbeScanner.java
@@ -22,14 +22,14 @@ import org.eclipse.jface.text.rules.SingleLineRule;
import org.eclipse.jface.text.rules.Token;
public class STPProbeScanner extends RuleBasedPartitionScanner {
- public final static String STP_STRING = "__stp_string"; //$NON-NLS-1$
- public final static String STP_PROBE = "__stp_probe"; //$NON-NLS-1$
- public final static String STP_CONDITIONAL = "__stp_conditional"; //$NON-NLS-1$
- public final static String STP_COMMENT = "__stp_comment"; //$NON-NLS-1$
+ public static final String STP_STRING = "__stp_string"; //$NON-NLS-1$
+ public static final String STP_PROBE = "__stp_probe"; //$NON-NLS-1$
+ public static final String STP_CONDITIONAL = "__stp_conditional"; //$NON-NLS-1$
+ public static final String STP_COMMENT = "__stp_comment"; //$NON-NLS-1$
- public final static String STP_PROBE_PARTITIONING = "__stp_probe_partitioning"; //$NON-NLS-1$
+ public static final String STP_PROBE_PARTITIONING = "__stp_probe_partitioning"; //$NON-NLS-1$
- public static String[] STP_PROBE_PARTITION_TYPES = { IDocument.DEFAULT_CONTENT_TYPE,
+ public static final String[] STP_PROBE_PARTITION_TYPES = { IDocument.DEFAULT_CONTENT_TYPE,
STP_COMMENT, STP_STRING, STP_PROBE, STP_CONDITIONAL};
public STPProbeScanner() {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java
index 05321a2374..4b325e5e3f 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptGraphOptionsTab.java
@@ -112,7 +112,6 @@ public class SystemTapScriptGraphOptionsTab extends
private Combo regularExpressionCombo;
private Button removeRegexButton;
- private Button generateExpsButton;
private Text sampleOutputText;
private Composite textFieldsComposite;
@@ -124,7 +123,6 @@ public class SystemTapScriptGraphOptionsTab extends
*/
private boolean textListenersEnabled = true;
- private ScrolledComposite regexTextScrolledComposite;
private Group outputParsingGroup;
private Button runWithChartCheckButton;
@@ -155,7 +153,7 @@ public class SystemTapScriptGraphOptionsTab extends
* the names of all of a regex's groups that have been deleted, so each name may be
* restored (without having to retype it) when a group is added again.
*/
- private Stack<String> cachedNames;
+ private Stack<String> cachedNames = new Stack<>();
/**
* A list of cachedNames stacks, containing one entry for each regular expression stored.
@@ -651,7 +649,7 @@ public class SystemTapScriptGraphOptionsTab extends
topLayout.setLayout(new GridLayout(1, false));
topLayout.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
- generateExpsButton = new Button(topLayout, SWT.PUSH);
+ Button generateExpsButton = new Button(topLayout, SWT.PUSH);
generateExpsButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
generateExpsButton.setText(Messages.SystemTapScriptGraphOptionsTab_generateFromPrintsButton);
generateExpsButton.setToolTipText(Messages.SystemTapScriptGraphOptionsTab_generateFromPrintsTooltip);
@@ -768,7 +766,7 @@ public class SystemTapScriptGraphOptionsTab extends
label2.setAlignment(SWT.LEFT);
label2.setText(Messages.SystemTapScriptGraphOptionsTab_extractedValueLabel);
- this.regexTextScrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER);
+ ScrolledComposite regexTextScrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.BORDER);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
data.heightHint = 200;
regexTextScrolledComposite.setLayoutData(data);
@@ -781,7 +779,7 @@ public class SystemTapScriptGraphOptionsTab extends
// To position the column labels properly, add a dummy column and use its children's sizes for reference.
// This is necessary since expressionTableLabels can't share a layout with textFieldsComposite.
textListenersEnabled = false;
- addColumn(""); //$NON-NLS-1$
+ addColumn(null);
data = new GridData(SWT.FILL, SWT.FILL, false, false);
data.horizontalIndent = textFieldsComposite.getChildren()[2].getLocation().x;
data.widthHint = textFieldsComposite.getChildren()[2].getSize().x;
@@ -872,7 +870,7 @@ public class SystemTapScriptGraphOptionsTab extends
duplicateGraphButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- GraphData gd = ((GraphData) selectedTableItem.getData()).getCopy();
+ GraphData gd = ((GraphData) selectedTableItem.getData()).clone();
TableItem item = new TableItem(graphsTable, SWT.NONE);
graphsData.add(gd);
@@ -1085,7 +1083,7 @@ public class SystemTapScriptGraphOptionsTab extends
* the active stack of cached names, or a default name if one doesn't exist.
*/
private void addColumn(String nameToAdd) {
- // Show the "shift" buttons of the previous column, if it exists.
+ // Show the "shift" buttons of the previous column, if they exist.
if (this.numberOfVisibleColumns > 0) {
textFieldsComposite.getChildren()[(this.numberOfVisibleColumns - 1) * 4].setVisible(true);
textFieldsComposite.getChildren()[(this.numberOfVisibleColumns - 1) * 4 + 1].setVisible(true);
@@ -1125,11 +1123,6 @@ public class SystemTapScriptGraphOptionsTab extends
textFieldsComposite.layout();
textFieldsComposite.pack();
- // Special value: if an empty string is given, don't add button listeners.
- if (nameToAdd == "") { //$NON-NLS-1$
- return;
- }
-
// Add button listeners for shifting column names.
buttonUp.addSelectionListener(new SelectionAdapter() {
@Override
@@ -1176,7 +1169,7 @@ public class SystemTapScriptGraphOptionsTab extends
* @param saveNames Set to <code>true</code> if the contents of removed
* columns are to be saved in a stack for later use.
*/
- private void removeColumn(Boolean saveNames) {
+ private void removeColumn(boolean saveNames) {
Control[] children = textFieldsComposite.getChildren();
int i = this.numberOfVisibleColumns*4 - 1;

Back to the top