diff options
author | Alexander Kurtakov | 2014-04-30 09:02:11 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2014-04-30 10:20:10 +0000 |
commit | 7fcbeb21d47b1f064066609991d6dd73386da527 (patch) | |
tree | 258e6789aeb1a8825d32011987926afbb3aa5ad9 /systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools | |
parent | 79742efde535cd6b0804c4d5735da37a72b6bd14 (diff) | |
download | org.eclipse.linuxtools-7fcbeb21d47b1f064066609991d6dd73386da527.tar.gz org.eclipse.linuxtools-7fcbeb21d47b1f064066609991d6dd73386da527.tar.xz org.eclipse.linuxtools-7fcbeb21d47b1f064066609991d6dd73386da527.zip |
systemtap: Another round of code review.
* Remove dead code.
* Mark abstract methods as such.
* Multi-catch.
Change-Id: I19e22dd72b968e015b3eaffe13534b16bbc62185
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Reviewed-on: https://git.eclipse.org/r/25779
Tested-by: Hudson CI
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools')
9 files changed, 56 insertions, 167 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptHandler.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptHandler.java index d46d43094e..dbd976ab5e 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptHandler.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptHandler.java @@ -179,7 +179,7 @@ public class RunScriptHandler extends AbstractHandler { return null; } final String[] script = buildStandardScript(); - final String[] envVars = getEnvironmentVariables(); + final String[] envVars = EnvironmentVariablesPreferencePage.getEnvironmentVariables(); if (continueRun) { Display.getDefault().asyncExec(new Runnable() { @Override @@ -511,10 +511,6 @@ public class RunScriptHandler extends AbstractHandler { return script; } - private String[] getEnvironmentVariables() { - return EnvironmentVariablesPreferencePage.getEnvironmentVariables(); - } - @Override public boolean isEnabled() { return (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() instanceof STPEditor); diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/TreeExpandCollapseAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/TreeExpandCollapseAction.java index 4ff0e2ae5e..a6711d8475 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/TreeExpandCollapseAction.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/TreeExpandCollapseAction.java @@ -81,9 +81,11 @@ public class TreeExpandCollapseAction extends Action implements Object[] objs = viewer.getViewer().getVisibleExpandedElements(); boolean doExpand = true; - for(int i = 0; i < objs.length; i++) - if(objs[i] == o) + for(Object obj : objs) { + if(obj == o) { doExpand = false; + } + } if(doExpand) { viewer.getViewer().expandToLevel(o,1); 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 0ef28f1db3..19c4a7b2dd 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 @@ -71,9 +71,6 @@ public class STPCompletionProcessor implements IContentAssistProcessor, ITextHov this.stpMetadataSingleton = STPMetadataSingleton.getInstance(); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int) - */ @Override public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { @@ -99,9 +96,7 @@ public class STPCompletionProcessor implements IContentAssistProcessor, ITextHov } } } - } catch (BadLocationException e1) { - return NO_COMPLETIONS; - } catch (BadPartitioningException e) { + } catch (BadLocationException|BadPartitioningException e) { return NO_COMPLETIONS; } @@ -192,9 +187,7 @@ public class STPCompletionProcessor implements IContentAssistProcessor, ITextHov TapsetLibrary.getAndCacheDocumentation("probe::" + probe + "::" + variableName)); //$NON-NLS-1$ //$NON-NLS-2$ } return result; - } catch (BadLocationException e) { - return NO_COMPLETIONS; - } catch (BadPartitioningException e) { + } catch (BadLocationException|BadPartitioningException e) { return NO_COMPLETIONS; } } @@ -391,42 +384,27 @@ public class STPCompletionProcessor implements IContentAssistProcessor, ITextHov this.stpMetadataSingleton.waitForInitialization(); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int) - */ @Override public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { return NO_CONTEXTS; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() - */ @Override public char[] getCompletionProposalAutoActivationCharacters() { return PROPOSAL_ACTIVATION_CHARS; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters() - */ @Override public char[] getContextInformationAutoActivationCharacters() { return PROPOSAL_ACTIVATION_CHARS; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator() - */ @Override public IContextInformationValidator getContextInformationValidator() { return null; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage() - */ @Override public String getErrorMessage() { // TODO: When does this trigger? @@ -468,10 +446,8 @@ public class STPCompletionProcessor implements IContentAssistProcessor, ITextHov documentation = TapsetLibrary.getDocumentation("probe::" + probe + "::"+ keyword); //$NON-NLS-1$ //$NON-NLS-2$ } - } catch (BadLocationException e) { - // Bad hover location; just ignore it. - } catch (BadPartitioningException e) { - // Bad hover scenario, just ignore it. + } catch (BadLocationException|BadPartitioningException e) { + // Bad hover location/scenario; just ignore it. } return documentation; diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPDefaultCodeFormatterConstants.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPDefaultCodeFormatterConstants.java index f4255baa81..c96d0658a7 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPDefaultCodeFormatterConstants.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPDefaultCodeFormatterConstants.java @@ -103,19 +103,6 @@ public class STPDefaultCodeFormatterConstants { public static final String FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION = IDEPlugin.PLUGIN_ID + ".formatter.brace_position_for_method_declaration"; //$NON-NLS-1$ /** * <pre> - * FORMATTER / Option to position the braces of a switch statement - * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_switch" - * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP } - * - default: END_OF_LINE - * </pre> - * @see #END_OF_LINE - * @see #NEXT_LINE - * @see #NEXT_LINE_SHIFTED - * @see #NEXT_LINE_ON_WRAP - */ - public static final String FORMATTER_BRACE_POSITION_FOR_SWITCH = IDEPlugin.PLUGIN_ID + ".formatter.brace_position_for_switch"; //$NON-NLS-1$ - /** - * <pre> * FORMATTER / Option to position the braces of a type declaration * - option id: "org.eclipse.cdt.core.formatter.brace_position_for_type_declaration" * - possible values: { END_OF_LINE, NEXT_LINE, NEXT_LINE_SHIFTED, NEXT_LINE_ON_WRAP } @@ -183,28 +170,6 @@ public class STPDefaultCodeFormatterConstants { public static final String FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_NAMESPACE_HEADER = IDEPlugin.PLUGIN_ID + ".formatter.indent_body_declarations_compare_to_namespace_header"; //$NON-NLS-1$ /** * <pre> - * FORMATTER / Option to indent empty lines - * - option id: "org.eclipse.cdt.core.formatter.indent_empty_lines" - * - possible values: { TRUE, FALSE } - * - default: FALSE - * </pre> - * @see #TRUE - * @see #FALSE - */ - public static final String FORMATTER_INDENT_EMPTY_LINES = IDEPlugin.PLUGIN_ID + ".formatter.indent_empty_lines"; //$NON-NLS-1$ - /** - * <pre> - * FORMATTER / Option to indent inside line comments at column 0 - * - option id: "org.eclipse.cdt.core.formatter.indent_inside_line_comments" - * - possible values: { TRUE, FALSE } - * - default: FALSE - * </pre> - * @see #TRUE - * @see #FALSE - */ - public static final String FORMATTER_INDENT_INSIDE_LINE_COMMENTS = IDEPlugin.PLUGIN_ID + ".formatter.indent_inside_line_comments"; //$NON-NLS-1$ - /** - * <pre> * FORMATTER / Option to indent statements inside a block * - option id: "org.eclipse.cdt.core.formatter.indent_statements_compare_to_block" * - possible values: { TRUE, FALSE } @@ -261,15 +226,6 @@ public class STPDefaultCodeFormatterConstants { * @see #MIXED */ public static final String FORMATTER_TAB_CHAR = IDEPlugin.PLUGIN_ID + ".formatter.tabulation.char"; //$NON-NLS-1$ - /** - * <pre> - * FORMATTER / Option to specify the equivalent number of spaces that represents one tabulation - * - option id: "org.eclipse.cdt.core.formatter.tabulation.size" - * - possible values: "<n>", where n is zero or a positive integer - * - default: "4" - * </pre> - */ - public static final String FORMATTER_TAB_SIZE = IDEPlugin.PLUGIN_ID + ".formatter.tabulation.size"; //$NON-NLS-1$ /** * <pre> diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPHeuristicScanner.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPHeuristicScanner.java index 37d1161e8a..a150615599 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPHeuristicScanner.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPHeuristicScanner.java @@ -92,9 +92,6 @@ public final class STPHeuristicScanner implements STPSymbols { * Stops upon a non-whitespace (as defined by {@link Character#isWhitespace(char)}) character. */ private static class NonWhitespace extends StopCondition { - /* - * @see org.eclipse.cdt.internal.ui.text.CHeuristicScanner.StopCondition#stop(char) - */ @Override public boolean stop(char ch, int position, boolean forward) { return !Character.isWhitespace(ch); @@ -107,17 +104,11 @@ public final class STPHeuristicScanner implements STPSymbols { * @see NonWhitespace */ private final class NonWhitespaceDefaultPartition extends NonWhitespace { - /* - * @see org.eclipse.cdt.internal.ui.text.CHeuristicScanner.StopCondition#stop(char) - */ @Override public boolean stop(char ch, int position, boolean forward) { return super.stop(ch, position, true) && isDefaultPartition(position); } - /* - * @see org.eclipse.cdt.internal.ui.text.CHeuristicScanner.StopCondition#nextPosition(int, boolean) - */ @Override public int nextPosition(int position, boolean forward) { ITypedRegion partition= getPartition(position); @@ -141,9 +132,6 @@ public final class STPHeuristicScanner implements STPSymbols { * Stops upon a non-java identifier (as defined by {@link Character#isJavaIdentifierPart(char)}) character. */ private static class NonJavaIdentifierPart extends StopCondition { - /* - * @see org.eclipse.cdt.internal.ui.text.CHeuristicScanner.StopCondition#stop(char) - */ @Override public boolean stop(char ch, int position, boolean forward) { return !Character.isJavaIdentifierPart(ch); @@ -156,31 +144,28 @@ public final class STPHeuristicScanner implements STPSymbols { * @see NonJavaIdentifierPart */ private final class NonJavaIdentifierPartDefaultPartition extends NonJavaIdentifierPart { - /* - * @see org.eclipse.cdt.internal.ui.text.CHeuristicScanner.StopCondition#stop(char) - */ @Override public boolean stop(char ch, int position, boolean forward) { return super.stop(ch, position, true) || !isDefaultPartition(position); } - /* - * @see org.eclipse.cdt.internal.ui.text.CHeuristicScanner.StopCondition#nextPosition(int, boolean) - */ @Override public int nextPosition(int position, boolean forward) { ITypedRegion partition= getPartition(position); - if (fPartition.equals(partition.getType())) + if (fPartition.equals(partition.getType())) { return super.nextPosition(position, forward); + } if (forward) { int end= partition.getOffset() + partition.getLength(); - if (position < end) + if (position < end) { return end; + } } else { int offset= partition.getOffset(); - if (position > offset) + if (position > offset) { return offset - 1; + } } return super.nextPosition(position, forward); } @@ -225,17 +210,20 @@ public final class STPHeuristicScanner implements STPSymbols { @Override public int nextPosition(int position, boolean forward) { ITypedRegion partition= getPartition(position); - if (fPartition.equals(partition.getType())) + if (fPartition.equals(partition.getType())) { return super.nextPosition(position, forward); + } if (forward) { int end= partition.getOffset() + partition.getLength(); - if (position < end) + if (position < end) { return end; + } } else { int offset= partition.getOffset(); - if (position > offset) + if (position > offset) { return offset - 1; + } } return super.nextPosition(position, forward); } @@ -310,8 +298,9 @@ public final class STPHeuristicScanner implements STPSymbols { */ public int nextToken(int start, int bound) { int pos= scanForward(start, bound, fNonWS); - if (pos == NOT_FOUND) + if (pos == NOT_FOUND) { return TokenEOF; + } try { // check for string or char literal char ch = fDocument.getChar(pos); @@ -400,10 +389,11 @@ public final class STPHeuristicScanner implements STPSymbols { // assume an identifier or keyword int from= pos, to; pos= scanForward(pos + 1, bound, fNonIdent); - if (pos == NOT_FOUND) + if (pos == NOT_FOUND) { to= bound == UNBOUND ? fDocument.getLength() : bound; - else + } else { to= pos; + } String identOrKeyword; try { @@ -432,8 +422,9 @@ public final class STPHeuristicScanner implements STPSymbols { */ public int previousToken(int start, int bound) { int pos= scanBackward(start, bound, fNonWSDefaultPart); - if (pos == NOT_FOUND) + if (pos == NOT_FOUND) { return TokenEOF; + } fPos--; @@ -503,10 +494,11 @@ public final class STPHeuristicScanner implements STPSymbols { // assume an ident or keyword int from, to= pos + 1; pos= scanBackward(pos - 1, bound, fNonIdent); - if (pos == NOT_FOUND) + if (pos == NOT_FOUND) { from= bound == UNBOUND ? 0 : bound + 1; - else + } else { from= pos + 1; + } String identOrKeyword; try { @@ -681,16 +673,19 @@ public final class STPHeuristicScanner implements STPSymbols { start -= 1; while (true) { start= scanForward(start + 1, bound, new CharacterMatch(new char[] {openingPeer, closingPeer})); - if (start == NOT_FOUND) + if (start == NOT_FOUND) { return NOT_FOUND; + } - if (fDocument.getChar(start) == openingPeer) + if (fDocument.getChar(start) == openingPeer) { depth++; - else + } else { depth--; + } - if (depth == 0) + if (depth == 0) { return start; + } } } catch (BadLocationException e) { @@ -790,8 +785,9 @@ public final class STPHeuristicScanner implements STPSymbols { private int scanForward(int start, int bound, StopCondition condition) { Assert.isLegal(start >= 0); - if (bound == UNBOUND) + if (bound == UNBOUND) { bound= fDocument.getLength(); + } Assert.isLegal(bound <= fDocument.getLength()); @@ -800,8 +796,9 @@ public final class STPHeuristicScanner implements STPSymbols { while (fPos < bound) { fChar= fDocument.getChar(fPos); - if (condition.stop(fChar, fPos, true)) + if (condition.stop(fChar, fPos, true)) { return fPos; + } fPos= condition.nextPosition(fPos, true); } @@ -835,8 +832,9 @@ public final class STPHeuristicScanner implements STPSymbols { * @return the highest position in (<code>bound</code>, <code>start</code> for which <code>condition</code> holds, or <code>NOT_FOUND</code> if none can be found */ private int scanBackward(int start, int bound, StopCondition condition) { - if (bound == UNBOUND) + if (bound == UNBOUND) { bound= -1; + } Assert.isLegal(bound >= -1); Assert.isLegal(start < fDocument.getLength() ); @@ -846,8 +844,9 @@ public final class STPHeuristicScanner implements STPSymbols { while (fPos > bound) { fChar= fDocument.getChar(fPos); - if (condition.stop(fChar, fPos, false)) + if (condition.stop(fChar, fPos, false)) { return fPos; + } fPos= condition.nextPosition(fPos, false); } @@ -863,8 +862,7 @@ public final class STPHeuristicScanner implements STPSymbols { * @return <code>true</code> if <code>position</code> is in the default partition of <code>fDocument</code>, <code>false</code> otherwise */ private boolean isDefaultPartition(int position) { - String type = getPartition(position).getType(); - return fPartition.equals(type); + return fPartition.equals(getPartition(position).getType()); } /** @@ -918,8 +916,9 @@ public final class STPHeuristicScanner implements STPSymbols { * @return <code>true</code> if the code is a conditional statement or loop without a block, <code>false</code> otherwise */ public boolean isBracelessBlockStart(int position, int bound) { - if (position < 1) + if (position < 1) { return false; + } switch (previousToken(position, bound)) { case TokenDO: diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitioner.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitioner.java deleted file mode 100644 index 41643489f6..0000000000 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPPartitioner.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007 Red Hat, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Red Hat - initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp; - -import org.eclipse.jface.text.rules.FastPartitioner; -import org.eclipse.jface.text.rules.IPartitionTokenScanner; - -public class STPPartitioner extends FastPartitioner { - - /** - * Straight forward FastPartitioner, with debug output. - * - * Taken directly from org.eclipse.linuxtools.rpm.ui.editor.SpecFilePartitioner. - * No noteworthy alterations so Copyright header and license text untouched. - * - * @param scanner - * @param legalContentTypes - */ - public STPPartitioner(IPartitionTokenScanner scanner, String[] legalContentTypes) { - super(scanner, legalContentTypes); - } -} - diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPReconcilingStrategy.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPReconcilingStrategy.java index f3b3383a3b..efbf1e5407 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPReconcilingStrategy.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPReconcilingStrategy.java @@ -72,27 +72,18 @@ public class STPReconcilingStrategy implements IReconcilingStrategy, this.currentDocument = document; } - /* (non-Javadoc) - * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.IRegion) - */ @Override public void reconcile(IRegion partition) { // Just rebuild the whole document initialReconcile(); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.reconciler.IReconcilingStrategy#reconcile(org.eclipse.jface.text.reconciler.DirtyRegion, org.eclipse.jface.text.IRegion) - */ @Override public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { //Just rebuild the whole document initialReconcile(); } - /* (non-Javadoc) - * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#initialReconcile() - */ @Override public void initialReconcile() { endOfDocumentPostion = currentDocument.getLength(); @@ -104,9 +95,6 @@ public class STPReconcilingStrategy implements IReconcilingStrategy, } } - /* (non-Javadoc) - * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) - */ @Override public void setProgressMonitor(IProgressMonitor monitor) { diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/DirectoryValidator.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/DirectoryValidator.java index 8f082442bc..9c41a1fff0 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/DirectoryValidator.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/DirectoryValidator.java @@ -29,7 +29,7 @@ public class DirectoryValidator implements IInputValidator { if(null == s) { return Messages.DirectoryValidator_NotNull; } - if(s.length() < 1) { + if(s.isEmpty()) { return Messages.DirectoryValidator_FolderName; } if(!s.endsWith("/")) {//$NON-NLS-1$ diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/LocalRemoteDirectoryEditor.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/LocalRemoteDirectoryEditor.java index bed12b7c0a..3820d0e99c 100644 --- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/LocalRemoteDirectoryEditor.java +++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/preferences/LocalRemoteDirectoryEditor.java @@ -29,21 +29,24 @@ public class LocalRemoteDirectoryEditor extends DirectoryFieldEditor { public void setRemote(boolean remote, Composite parent) { this.remote = remote; Button b = getChangeControl(parent); - if (isEnabled) + if (isEnabled) { b.setEnabled(!remote); + } } @Override public String changePressed() { - if (this.remote) + if (this.remote) { return ""; //$NON-NLS-1$ + } return super.changePressed(); } @Override protected boolean doCheckState() { - if (this.remote) + if (this.remote) { return true; + } return super.doCheckState(); } |