Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2012-02-23 14:45:19 -0500
committerSergey Prigogin2012-02-23 16:26:43 -0500
commit934adecf4823e3920b8781cc7e0d1cc5a7d35938 (patch)
tree5d91b863e038a277e6dd0ef166f5a12d04adbc92
parentd7f5c2bd7cad5b922d205a1f3f832d7d07576d92 (diff)
downloadorg.eclipse.cdt-934adecf4823e3920b8781cc7e0d1cc5a7d35938.tar.gz
org.eclipse.cdt-934adecf4823e3920b8781cc7e0d1cc5a7d35938.tar.xz
org.eclipse.cdt-934adecf4823e3920b8781cc7e0d1cc5a7d35938.zip
Adjustments to Alex's contribution.
-rw-r--r--codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/CppcheckChecker.java6
-rw-r--r--codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParser.java7
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParserTest.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvokerTest.java24
-rw-r--r--codan/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs21
-rw-r--r--codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF4
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/AbstractExternalToolBasedChecker.java (renamed from codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractExternalToolBasedChecker.java)51
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/AbstractOutputParser.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/ConfigurationSettings.java14
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IArgsSeparator.java7
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinter.java15
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinterProvider.java9
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IInvocationParametersProvider.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IProblemDisplay.java11
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/ISupportedResourceVerifier.java42
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationFailure.java10
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParameters.java16
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParametersProvider.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SingleConfigurationSetting.java4
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SpaceArgsSeparator.java (renamed from codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SpaceDelimitedArgsSeparator.java)11
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java8
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java6
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ConsoleOutputSetting.java (renamed from codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ShouldDisplayOutputSetting.java)10
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvoker.java29
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.java13
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.properties10
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/PathSetting.java10
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ProcessInvoker.java10
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/externaltool/CxxSupportedResourceVerifier.java59
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/AbstractCxxExternalToolBasedChecker.java61
-rw-r--r--codan/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF2
-rw-r--r--codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/externaltool/ConsolePrinter.java (renamed from codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/externaltool/ConsolePrinter.java)16
-rw-r--r--codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/externaltool/ConsolePrinterProvider.java (renamed from codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/externaltool/ConsolePrinterProvider.java)9
-rw-r--r--codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/externaltool/NullConsolePrinter.java (renamed from codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/externaltool/NullConsolePrinter.java)18
35 files changed, 240 insertions, 293 deletions
diff --git a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/CppcheckChecker.java b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/CppcheckChecker.java
index 1c5f672a89..d29d1a7db4 100644
--- a/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/CppcheckChecker.java
+++ b/codan/org.eclipse.cdt.codan.checkers.ui/src/org/eclipse/cdt/codan/internal/checkers/ui/CppcheckChecker.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers.ui;
@@ -41,11 +41,13 @@ public class CppcheckChecker extends AbstractCxxExternalToolBasedChecker {
// key: severity (error, warning, etc.) - value : problem ID associated to severity
private static final Map<String, String> PROBLEM_IDS = new HashMap<String, String>();
+
static {
ERROR_PROBLEM_ID = addProblemId("error"); //$NON-NLS-1$
addProblemId("warning"); //$NON-NLS-1$
addProblemId("style"); //$NON-NLS-1$
}
+
private static String addProblemId(String severity) {
String problemId = "org.eclipse.cdt.codan.checkers.cppcheck." + severity; //$NON-NLS-1$
PROBLEM_IDS.put(severity, problemId);
diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParser.java b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParser.java
index 53295324f1..05ef14e3a4 100644
--- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParser.java
+++ b/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParser.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers.externaltool;
@@ -78,5 +78,6 @@ public class CppcheckOutputParser extends AbstractOutputParser {
}
@Override
- public void reset() {}
+ public void reset() {
+ }
}
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java
index 7f700eaea0..ff27692d4b 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/core/test/AutomatedIntegrationSuite.java
@@ -30,10 +30,12 @@ import org.eclipse.cdt.codan.core.internal.checkers.StatementHasNoEffectCheckerT
import org.eclipse.cdt.codan.core.internal.checkers.SuggestedParenthesisCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.SuspiciousSemicolonCheckerTest;
import org.eclipse.cdt.codan.core.internal.checkers.UnusedSymbolInFileScopeCheckerTest;
+import org.eclipse.cdt.codan.internal.checkers.externaltool.CppcheckOutputParserTest;
import org.eclipse.cdt.codan.internal.checkers.ui.quickfix.CaseBreakQuickFixTest;
import org.eclipse.cdt.codan.internal.checkers.ui.quickfix.CatchByReferenceQuickFixTest;
import org.eclipse.cdt.codan.internal.checkers.ui.quickfix.CreateLocalVariableQuickFixTest;
import org.eclipse.cdt.codan.internal.checkers.ui.quickfix.SuggestedParenthesisQuickFixTest;
+import org.eclipse.cdt.codan.internal.core.externaltool.ExternalToolInvokerTest;
public class AutomatedIntegrationSuite extends TestSuite {
public AutomatedIntegrationSuite() {
@@ -69,6 +71,8 @@ public class AutomatedIntegrationSuite extends TestSuite {
suite.addTestSuite(SuggestedParenthesisCheckerTest.class);
suite.addTestSuite(SuspiciousSemicolonCheckerTest.class);
suite.addTestSuite(UnusedSymbolInFileScopeCheckerTest.class);
+ suite.addTestSuite(ExternalToolInvokerTest.class);
+ suite.addTestSuite(CppcheckOutputParserTest.class);
// framework
suite.addTest(CodanFastTestSuite.suite());
// quick fixes
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParserTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParserTest.java
index aa08d16bd7..ef58bc6b77 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParserTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/checkers/externaltool/CppcheckOutputParserTest.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.checkers.externaltool;
diff --git a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvokerTest.java b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvokerTest.java
index 87f88f6f51..e45341b9a8 100644
--- a/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvokerTest.java
+++ b/codan/org.eclipse.cdt.codan.core.test/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvokerTest.java
@@ -1,25 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.externaltool;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertArrayEquals;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.cdt.codan.core.externaltool.AbstractOutputParser;
import org.eclipse.cdt.codan.core.externaltool.ConfigurationSettings;
import org.eclipse.cdt.codan.core.externaltool.IArgsSeparator;
@@ -27,7 +20,7 @@ import org.eclipse.cdt.codan.core.externaltool.IConsolePrinter;
import org.eclipse.cdt.codan.core.externaltool.IConsolePrinterProvider;
import org.eclipse.cdt.codan.core.externaltool.InvocationFailure;
import org.eclipse.cdt.codan.core.externaltool.InvocationParameters;
-import org.eclipse.cdt.codan.core.externaltool.SpaceDelimitedArgsSeparator;
+import org.eclipse.cdt.codan.core.externaltool.SpaceArgsSeparator;
import org.eclipse.cdt.codan.core.param.BasicProblemPreference;
import org.eclipse.cdt.codan.core.param.IProblemPreference;
import org.eclipse.cdt.codan.core.param.MapProblemPreference;
@@ -35,6 +28,13 @@ import org.eclipse.cdt.codan.core.test.CodanTestCase;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Tests for <code>{@link ExternalToolInvoker}</code>.
*
@@ -73,7 +73,7 @@ public class ExternalToolInvokerTest extends CodanTestCase {
MapProblemPreference preferences = createPreferences(new File(externalToolPath),
"--include=all --debug=true", shouldDisplayOutput);
settings.updateValuesFrom(preferences);
- argsSeparator = new SpaceDelimitedArgsSeparator();
+ argsSeparator = new SpaceArgsSeparator();
externalToolInvoker = new ExternalToolInvoker(consolePrinterProvider, processInvoker);
}
@@ -83,7 +83,7 @@ public class ExternalToolInvokerTest extends CodanTestCase {
preferences.addChildDescriptor(createPreference(PathSetting.KEY, executablePath));
preferences.addChildDescriptor(createPreference(ArgsSetting.KEY, args));
preferences.addChildDescriptor(
- createPreference(ShouldDisplayOutputSetting.KEY, shouldDisplayOutput));
+ createPreference(ConsoleOutputSetting.KEY, shouldDisplayOutput));
return preferences;
}
diff --git a/codan/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs b/codan/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs
index 8f13f952a7..53ac0b012e 100644
--- a/codan/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs
+++ b/codan/org.eclipse.cdt.codan.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,5 +1,9 @@
-#Wed Feb 23 19:43:25 EST 2011
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
@@ -19,6 +23,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
@@ -26,6 +31,7 @@ org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
@@ -38,11 +44,12 @@ org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
@@ -53,20 +60,30 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
diff --git a/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF b/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
index 632bdbb384..a49d2de3aa 100644
--- a/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
+++ b/codan/org.eclipse.cdt.codan.core/META-INF/MANIFEST.MF
@@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.cdt.codan.core,
- org.eclipse.cdt.codan.core.externaltool,
+ org.eclipse.cdt.codan.core.externaltool;x-friends:="org.eclipse.cdt.codan.ui,org.eclipse.cdt.codan.core.test",
org.eclipse.cdt.codan.core.model,
org.eclipse.cdt.codan.core.model.cfg;x-friends:="org.eclipse.cdt.codan.core.cxx,org.eclipse.cdt.codan.checkers",
org.eclipse.cdt.codan.core.param,
@@ -20,5 +20,5 @@ Export-Package: org.eclipse.cdt.codan.core,
org.eclipse.cdt.codan.core.test,
org.eclipse.cdt.codan.ui",
org.eclipse.cdt.codan.internal.core.cfg;x-friends:="org.eclipse.cdt.codan.core.cxx",
- org.eclipse.cdt.codan.internal.core.externaltool,
+ org.eclipse.cdt.codan.internal.core.externaltool;x-friends:="org.eclipse.cdt.codan.core.test",
org.eclipse.cdt.codan.internal.core.model;x-friends:="org.eclipse.cdt.codan.core.cxx,org.eclipse.cdt.codan.core.test,org.eclipse.cdt.codan.ui"
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractExternalToolBasedChecker.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/AbstractExternalToolBasedChecker.java
index 818a947662..911def9299 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractExternalToolBasedChecker.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/AbstractExternalToolBasedChecker.java
@@ -1,20 +1,20 @@
-// Copyright 2012 Google Inc. All Rights Reserved.
-
-package org.eclipse.cdt.codan.core.model;
-
-import java.util.List;
+/*******************************************************************************
+ * Copyright (c) 2012 Google, Inc and others.
+ * 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:
+ * Alex Ruiz (Google) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.codan.core.externaltool;
import org.eclipse.cdt.codan.core.CodanCorePlugin;
-import org.eclipse.cdt.codan.core.externaltool.AbstractOutputParser;
-import org.eclipse.cdt.codan.core.externaltool.ConfigurationSettings;
-import org.eclipse.cdt.codan.core.externaltool.IArgsSeparator;
-import org.eclipse.cdt.codan.core.externaltool.IConsolePrinterProvider;
-import org.eclipse.cdt.codan.core.externaltool.IInvocationParametersProvider;
-import org.eclipse.cdt.codan.core.externaltool.IProblemDisplay;
-import org.eclipse.cdt.codan.core.externaltool.ISupportedResourceVerifier;
-import org.eclipse.cdt.codan.core.externaltool.InvocationFailure;
-import org.eclipse.cdt.codan.core.externaltool.InvocationParameters;
-import org.eclipse.cdt.codan.core.externaltool.SingleConfigurationSetting;
+import org.eclipse.cdt.codan.core.model.AbstractCheckerWithProblemPreferences;
+import org.eclipse.cdt.codan.core.model.IProblem;
+import org.eclipse.cdt.codan.core.model.IProblemLocation;
+import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
import org.eclipse.cdt.codan.core.param.IProblemPreference;
import org.eclipse.cdt.codan.core.param.MapProblemPreference;
import org.eclipse.cdt.codan.core.param.RootProblemPreference;
@@ -22,6 +22,8 @@ import org.eclipse.cdt.codan.core.param.SharedRootProblemPreference;
import org.eclipse.cdt.codan.internal.core.externaltool.ExternalToolInvoker;
import org.eclipse.core.resources.IResource;
+import java.util.List;
+
/**
* Base class for checkers that invoke external command-line tools to perform code checking.
* <p>
@@ -43,7 +45,6 @@ public abstract class AbstractExternalToolBasedChecker extends AbstractCheckerWi
private static final boolean DO_NOT_TRAVERSE_CHILDREN = false;
private final IInvocationParametersProvider parametersProvider;
- private final ISupportedResourceVerifier supportedResourceVerifier;
private final IArgsSeparator argsSeparator;
private final ConfigurationSettings settings;
private final ExternalToolInvoker externalToolInvoker;
@@ -52,8 +53,6 @@ public abstract class AbstractExternalToolBasedChecker extends AbstractCheckerWi
/**
* Constructor.
* @param parametersProvider provides the parameters to pass when invoking the external tool.
- * @param supportedResourceVerifier indicates whether a resource can be processed by the
- * external tool.
* @param argsSeparator separates the arguments to pass to the external tool executable. These
* arguments are stored in a single {@code String}.
* @param consolePrinterProvider creates an Eclipse console that uses the name of an external
@@ -61,10 +60,9 @@ public abstract class AbstractExternalToolBasedChecker extends AbstractCheckerWi
* @param settings user-configurable external tool configuration settings.
*/
public AbstractExternalToolBasedChecker(IInvocationParametersProvider parametersProvider,
- ISupportedResourceVerifier supportedResourceVerifier, IArgsSeparator argsSeparator,
- IConsolePrinterProvider consolePrinterProvider, ConfigurationSettings settings) {
+ IArgsSeparator argsSeparator, IConsolePrinterProvider consolePrinterProvider,
+ ConfigurationSettings settings) {
this.parametersProvider = parametersProvider;
- this.supportedResourceVerifier = supportedResourceVerifier;
this.argsSeparator = argsSeparator;
this.settings = settings;
externalToolInvoker = new ExternalToolInvoker(consolePrinterProvider);
@@ -72,17 +70,6 @@ public abstract class AbstractExternalToolBasedChecker extends AbstractCheckerWi
}
/**
- * Indicates whether this checker can process the given resource. For more details, please
- * see <code>{@link ISupportedResourceVerifier#isSupported(IResource)}</code>.
- * @param resource the given resource.
- * @return {@code true} if this checker can process the given resource, {@code false} otherwise.
- */
- @Override
- public boolean enabledInContext(IResource resource) {
- return supportedResourceVerifier.isSupported(resource);
- }
-
- /**
* Indicates whether this checker is enabled to run while the user types. By default, this
* method returns {@code false}.
* <p>
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/AbstractOutputParser.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/AbstractOutputParser.java
index 2e78ae8ab1..66a29ca2e6 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/AbstractOutputParser.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/AbstractOutputParser.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/ConfigurationSettings.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/ConfigurationSettings.java
index 16d6e7e0ab..4cad52dfa8 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/ConfigurationSettings.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/ConfigurationSettings.java
@@ -1,21 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
-import java.io.File;
-
import org.eclipse.cdt.codan.core.param.MapProblemPreference;
import org.eclipse.cdt.codan.internal.core.externaltool.ArgsSetting;
import org.eclipse.cdt.codan.internal.core.externaltool.PathSetting;
-import org.eclipse.cdt.codan.internal.core.externaltool.ShouldDisplayOutputSetting;
+import org.eclipse.cdt.codan.internal.core.externaltool.ConsoleOutputSetting;
+
+import java.io.File;
/**
* User-configurable external tool settings.
@@ -27,7 +27,7 @@ import org.eclipse.cdt.codan.internal.core.externaltool.ShouldDisplayOutputSetti
public final class ConfigurationSettings {
private final PathSetting path;
private final ArgsSetting args;
- private final ShouldDisplayOutputSetting shouldDisplayOutput;
+ private final ConsoleOutputSetting shouldDisplayOutput;
private final String externalToolName;
/**
@@ -43,7 +43,7 @@ public final class ConfigurationSettings {
this.externalToolName = externalToolName;
this.path = new PathSetting(externalToolName, defaultPath);
this.args = new ArgsSetting(externalToolName, defaultArgs);
- this.shouldDisplayOutput = new ShouldDisplayOutputSetting(defaultShouldDisplayOutput);
+ this.shouldDisplayOutput = new ConsoleOutputSetting(defaultShouldDisplayOutput);
}
/**
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IArgsSeparator.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IArgsSeparator.java
index 85afa587f2..2b37d538bd 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IArgsSeparator.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IArgsSeparator.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
@@ -22,8 +22,7 @@ public interface IArgsSeparator {
/**
* Parses a given {@code String} containing the arguments to pass to an external tool and
* separates them into individual values.
- * @param args contains the arguments to pass to the external tool
- * executable.
+ * @param args contains the arguments to pass to the external tool executable.
* @return the separated argument values.
*/
String[] separateArgs(String args);
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinter.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinter.java
index b12669d1b2..e174be9279 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinter.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinter.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
@@ -14,6 +14,9 @@ package org.eclipse.cdt.codan.core.externaltool;
* Prints the output of an external tool to an Eclipse console. It uses the name of the external
* tool as the console ID.
*
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ *
* @author alruiz@google.com (Alex Ruiz)
*
* @since 2.1
@@ -22,21 +25,21 @@ public interface IConsolePrinter {
/**
* Clears the contents of the console.
*/
- void clear();
+ public void clear();
/**
* Prints the specified message to the console, followed by a line separator string.
* @param message the message to print.
*/
- void println(String message);
+ public void println(String message);
/**
* Prints a line separator to the console.
*/
- void println();
+ public void println();
/**
* Closes the output stream of the console.
*/
- void close();
+ public void close();
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinterProvider.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinterProvider.java
index 3b388a5652..8c7e5375e9 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinterProvider.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IConsolePrinterProvider.java
@@ -1,18 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
/**
* Creates or finds an Eclipse console that uses the name of an external tool as its own.
*
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ *
* @author alruiz@google.com (Alex Ruiz)
*
* @since 2.1
@@ -26,5 +29,5 @@ public interface IConsolePrinterProvider {
* tool in the console.
* @return the created or found console.
*/
- IConsolePrinter createConsole(String externalToolName, boolean shouldDisplayOutput);
+ public IConsolePrinter createConsole(String externalToolName, boolean shouldDisplayOutput);
} \ No newline at end of file
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IInvocationParametersProvider.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IInvocationParametersProvider.java
index 8d67dad391..8dce431db2 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IInvocationParametersProvider.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IInvocationParametersProvider.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IProblemDisplay.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IProblemDisplay.java
index 49ce23b008..60176209b1 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IProblemDisplay.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/IProblemDisplay.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
@@ -15,6 +15,9 @@ import org.eclipse.cdt.codan.core.model.IProblemLocation;
/**
* Reports problems found in code, reported by an external tool.
*
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @noextend This interface is not intended to be extended by clients.
+ *
* @author alruiz@google.com (Alex Ruiz)
*
* @since 2.1
@@ -25,7 +28,7 @@ public interface IProblemDisplay {
* @param location the problem's location (e.g. file and line number.)
* @param description the description of the problem.
*/
- void reportProblem(IProblemLocation location, String description);
+ public void reportProblem(IProblemLocation location, String description);
/**
* Reports a problem found by an external tool.
@@ -33,5 +36,5 @@ public interface IProblemDisplay {
* @param description the description of the problem.
* @param severity the problem's severity (e.g. "error", "warning", etc.)
*/
- void reportProblem(IProblemLocation location, String description, String severity);
+ public void reportProblem(IProblemLocation location, String description, String severity);
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/ISupportedResourceVerifier.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/ISupportedResourceVerifier.java
deleted file mode 100644
index bc3db8f102..0000000000
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/ISupportedResourceVerifier.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Google, 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:
- * Alex Ruiz - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.codan.core.externaltool;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-
-/**
- * Verifies that a <code>{@link IResource}</code> can be processed by an external tool.
- *
- * @author alruiz@google.com (Alex Ruiz)
- *
- * @since 2.1
- */
-public interface ISupportedResourceVerifier {
- /**
- * Indicates whether the external tool is capable of processing the given
- * <code>{@link IResource}</code>.
- * <p>
- * The minimum requirements that the given {@code IResource} should satisfy
- * are:
- * <ul>
- * <li>should be an <code>{@link IFile}</code></li>
- * <li>should be displayed in the current active editor</li>
- * <li>should not have any unsaved changes</li>
- * </ul>
- * </p>
- *
- * @param resource the given {@code IResource}.
- * @return {@code true} if the external tool is capable of processing the
- * given file, {@code false} otherwise.
- */
- boolean isSupported(IResource resource);
-}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationFailure.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationFailure.java
index 9c2f2df456..ac2a3310d0 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationFailure.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationFailure.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
@@ -18,7 +18,7 @@ package org.eclipse.cdt.codan.core.externaltool;
* @since 2.1
*/
public class InvocationFailure extends Exception {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 6727101323050538885L;
/**
* Constructor.
@@ -31,8 +31,8 @@ public class InvocationFailure extends Exception {
/**
* Constructor.
* @param message the detail message.
- * @param cause the cause (which is saved for later retrieval by the
- * <code>{@link #getCause()}</code> method.)
+ * @param cause the cause (which is saved for later retrieval by
+ * the <code>{@link #getCause()}</code> method.)
*/
public InvocationFailure(String message, Throwable cause) {
super(message, cause);
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParameters.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParameters.java
index 58faad2c0d..b7a68abd81 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParameters.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParameters.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
@@ -45,8 +45,8 @@ public final class InvocationParameters {
}
/**
- * Returns the original file to process. This is the file that triggered execution of a
- * command-line tool when saved.
+ * Returns the original file to process. This is the file that triggered execution of
+ * a command-line tool when saved.
* @return the original file to process.
*/
public IResource getOriginalFile() {
@@ -55,11 +55,11 @@ public final class InvocationParameters {
/**
* Returns the actual file to process. It may not be the same as
- * <code>{@link #getActualFile()}</code>, depending on how the external tool works.
+ * <code>{@link #getOriginalFile()}</code>, depending on how the external tool works.
* <p>
- * A good example is an external tool that can only process C++ files but header files. If the
- * <em>original</em> file is a header file, the checker could potentially find a C++ file that
- * includes such header and use it as the <em>actual</em> file to process.
+ * A good example is an external tool that can only process C++ source files but not header
+ * files. If the <em>original</em> file is a header file, the checker could potentially find
+ * a C++ file that includes such header and use it as the <em>actual</em> file to process.
* </p>
* <p>
* We still need to keep a reference to the <em>actual</em> file, in order to add markers to
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParametersProvider.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParametersProvider.java
index db9867c422..b5593c0ac3 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParametersProvider.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/InvocationParametersProvider.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SingleConfigurationSetting.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SingleConfigurationSetting.java
index 7ae5a4e0db..0b04cf8a3f 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SingleConfigurationSetting.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SingleConfigurationSetting.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SpaceDelimitedArgsSeparator.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SpaceArgsSeparator.java
index 8e9f092c5c..eff95236fa 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SpaceDelimitedArgsSeparator.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/externaltool/SpaceArgsSeparator.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core.externaltool;
@@ -20,13 +20,10 @@ import java.util.regex.Pattern;
*
* @since 2.1
*/
-public final class SpaceDelimitedArgsSeparator implements IArgsSeparator {
- private static final String[] NO_ARGS = new String[0];
+public final class SpaceArgsSeparator implements IArgsSeparator {
+ private static final String[] NO_ARGS = {};
private static final Pattern EMPTY_SPACE_PATTERN = Pattern.compile("\\s+"); //$NON-NLS-1$
- /**
- * {@inheritDoc}
- */
@Override
public String[] separateArgs(String args) {
if (args == null || args.isEmpty()) {
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java
index 13425b8ed4..cd60472d62 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/AbstractChecker.java
@@ -11,15 +11,15 @@
*******************************************************************************/
package org.eclipse.cdt.codan.core.model;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.cdt.codan.core.CodanRuntime;
import org.eclipse.cdt.codan.internal.core.CheckersRegistry;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.OperationCanceledException;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Convenience implementation of IChecker interface. Has a default
* implementation for common methods.
@@ -43,7 +43,7 @@ public abstract class AbstractChecker implements IChecker {
*/
@Override
public boolean enabledInContext(IResource res) {
- return res instanceof IFile;
+ return res.getType() == IResource.FILE;
}
/**
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java
index 61f0f9a4e4..4634728085 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ArgsSetting.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.externaltool;
@@ -22,8 +22,6 @@ import org.eclipse.cdt.codan.core.param.IProblemPreferenceDescriptor;
* The arguments are stored in a single {@code String}.
*
* @author alruiz@google.com (Alex Ruiz)
- *
- * @since 2.1
*/
public class ArgsSetting extends SingleConfigurationSetting<String> {
static final String KEY = "externalToolArgs"; //$NON-NLS-1$
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ShouldDisplayOutputSetting.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ConsoleOutputSetting.java
index 77c3ce5a95..a51f671de3 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ShouldDisplayOutputSetting.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ConsoleOutputSetting.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.externaltool;
@@ -22,17 +22,15 @@ import org.eclipse.cdt.codan.core.param.IProblemPreferenceDescriptor;
* displayed in an Eclipse console.
*
* @author alruiz@google.com (Alex Ruiz)
- *
- * @since 2.1
*/
-public class ShouldDisplayOutputSetting extends SingleConfigurationSetting<Boolean> {
+public class ConsoleOutputSetting extends SingleConfigurationSetting<Boolean> {
static final String KEY = "externalToolShouldDisplayOutput"; //$NON-NLS-1$
/**
* Constructor.
* @param defaultValue the default value of the setting.
*/
- public ShouldDisplayOutputSetting(boolean defaultValue) {
+ public ConsoleOutputSetting(boolean defaultValue) {
super(newPreferenceDescriptor(), defaultValue, Boolean.class);
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvoker.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvoker.java
index 1743ed39d3..e59426d69d 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvoker.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ExternalToolInvoker.java
@@ -1,39 +1,37 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.externaltool;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.List;
-
+import org.eclipse.cdt.codan.core.externaltool.IConsolePrinter;
+import org.eclipse.cdt.codan.core.externaltool.IConsolePrinterProvider;
import org.eclipse.cdt.codan.core.externaltool.AbstractOutputParser;
import org.eclipse.cdt.codan.core.externaltool.ConfigurationSettings;
import org.eclipse.cdt.codan.core.externaltool.IArgsSeparator;
-import org.eclipse.cdt.codan.core.externaltool.IConsolePrinter;
-import org.eclipse.cdt.codan.core.externaltool.IConsolePrinterProvider;
import org.eclipse.cdt.codan.core.externaltool.InvocationFailure;
import org.eclipse.cdt.codan.core.externaltool.InvocationParameters;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.List;
+
/**
* Invokes an external tool to perform checks on a single file.
*
* @author alruiz@google.com (Alex Ruiz)
- *
- * @since 2.1
*/
public class ExternalToolInvoker {
private final IConsolePrinterProvider consolePrinterProvider;
@@ -164,7 +162,8 @@ public class ExternalToolInvoker {
if (reader != null) {
try {
reader.close();
- } catch (IOException ignored) {}
+ } catch (IOException ignored) {
+ }
}
}
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.java
index 6adbbc2dbc..d2c66896b6 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.externaltool;
@@ -14,19 +14,16 @@ import org.eclipse.osgi.util.NLS;
/**
* @author alruiz@google.com (Alex Ruiz)
- *
- * @since 2.1
*/
-@SuppressWarnings("javadoc")
public class Messages extends NLS {
public static String ConfigurationSettings_args_format;
public static String ConfigurationSettings_path_format;
public static String ConfigurationSettings_should_display_output;
static {
- Class<Messages> clazz = Messages.class;
- NLS.initializeMessages(clazz.getName(), clazz);
+ NLS.initializeMessages(Messages.class.getName(), Messages.class);
}
- private Messages() {}
+ private Messages() {
+ }
}
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.properties b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.properties
index fefe189a58..577aec794f 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.properties
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/Messages.properties
@@ -1,3 +1,13 @@
+###############################################################################
+# Copyright (c) 2012 Google, Inc and others.
+# 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:
+# Alex Ruiz (Google) - initial API and implementation
+###############################################################################
ConfigurationSettings_args_format=%s Args:
ConfigurationSettings_path_format=%s Path:
ConfigurationSettings_should_display_output=Display Output in Console
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/PathSetting.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/PathSetting.java
index 91864b1d14..1f48ff3118 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/PathSetting.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/PathSetting.java
@@ -1,30 +1,28 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.externaltool;
import static org.eclipse.cdt.codan.core.param.IProblemPreferenceDescriptor.PreferenceType.TYPE_FILE;
import static org.eclipse.cdt.codan.internal.core.externaltool.Messages.ConfigurationSettings_path_format;
-import java.io.File;
-
import org.eclipse.cdt.codan.core.externaltool.SingleConfigurationSetting;
import org.eclipse.cdt.codan.core.param.BasicProblemPreference;
import org.eclipse.cdt.codan.core.param.IProblemPreferenceDescriptor;
+import java.io.File;
+
/**
* User-configurable setting that specifies the path and name of an external tool's executable.
*
* @author alruiz@google.com (Alex Ruiz)
- *
- * @since 2.1
*/
public class PathSetting extends SingleConfigurationSetting<File> {
static final String KEY = "externalToolPath"; //$NON-NLS-1$
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ProcessInvoker.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ProcessInvoker.java
index dddc8d9a91..77e5be0bc9 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ProcessInvoker.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/externaltool/ProcessInvoker.java
@@ -1,26 +1,24 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.core.externaltool;
-import java.io.IOException;
-
import org.eclipse.cdt.codan.core.externaltool.InvocationFailure;
import org.eclipse.core.runtime.IPath;
+import java.io.IOException;
+
/**
* Executes a command in a separate process.
*
* @author alruiz@google.com (Alex Ruiz)
- *
- * @since 2.1
*/
public class ProcessInvoker {
private static final String[] ENVIRONMENT_VARIABLE_SETTINGS = {};
diff --git a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/externaltool/CxxSupportedResourceVerifier.java b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/externaltool/CxxSupportedResourceVerifier.java
deleted file mode 100644
index 02f56458af..0000000000
--- a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/internal/ui/cxx/externaltool/CxxSupportedResourceVerifier.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Google, 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:
- * Alex Ruiz - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.codan.internal.ui.cxx.externaltool;
-
-import static org.eclipse.cdt.codan.core.cxx.util.FileTypes.isCppFile;
-import static org.eclipse.cdt.codan.core.cxx.util.FileTypes.isHeaderFile;
-import static org.eclipse.cdt.codan.ui.CodanEditorUtility.isResourceOpenInEditor;
-import static org.eclipse.cdt.codan.ui.cxx.util.CEditors.activeCEditor;
-
-import org.eclipse.cdt.codan.core.externaltool.ISupportedResourceVerifier;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.ui.editors.text.TextEditor;
-
-/**
- * Implementation of <code>{@link ISupportedResourceVerifier}</code> for C/C++ files.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class CxxSupportedResourceVerifier implements ISupportedResourceVerifier {
- /**
- * Indicates whether the external tool is capable of processing the given
- * <code>{@link IResource}</code>.
- * <p>
- * The minimum requirements that the given {@code IResource} should satisfy are:
- * <ul>
- * <li>should be C/C++ file</li>
- * <li>should be displayed in the current active {@code CEditor}</li>
- * <li>should not have any unsaved changes</li>
- * </ul>
- * </p>
- * @param resource the given {@code IResource}.
- * @return {@code true} if the external tool is capable of processing the given file,
- * {@code false} otherwise.
- */
- @Override
- public boolean isSupported(IResource resource) {
- return isFileOfSupportedType(resource) && isOpenInActiveCEditor(resource);
- }
-
- private boolean isFileOfSupportedType(IResource resource) {
- return isCppFile(resource) || isHeaderFile(resource);
- }
-
- private boolean isOpenInActiveCEditor(IResource resource) {
- TextEditor activeCEditor = activeCEditor();
- if (activeCEditor == null) {
- return false;
- }
- return !activeCEditor.isDirty() && isResourceOpenInEditor(resource, activeCEditor);
- }
-}
diff --git a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/AbstractCxxExternalToolBasedChecker.java b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/AbstractCxxExternalToolBasedChecker.java
index b77e913b39..4329fddd93 100644
--- a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/AbstractCxxExternalToolBasedChecker.java
+++ b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/AbstractCxxExternalToolBasedChecker.java
@@ -1,24 +1,27 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.ui.cxx.externaltool;
+import org.eclipse.cdt.codan.core.cxx.util.FileTypes;
+import org.eclipse.cdt.codan.core.externaltool.AbstractExternalToolBasedChecker;
import org.eclipse.cdt.codan.core.externaltool.ConfigurationSettings;
import org.eclipse.cdt.codan.core.externaltool.IArgsSeparator;
import org.eclipse.cdt.codan.core.externaltool.IInvocationParametersProvider;
-import org.eclipse.cdt.codan.core.externaltool.ISupportedResourceVerifier;
import org.eclipse.cdt.codan.core.externaltool.InvocationParametersProvider;
-import org.eclipse.cdt.codan.core.externaltool.SpaceDelimitedArgsSeparator;
-import org.eclipse.cdt.codan.core.model.AbstractExternalToolBasedChecker;
-import org.eclipse.cdt.codan.internal.ui.cxx.externaltool.CxxSupportedResourceVerifier;
-import org.eclipse.cdt.codan.ui.externaltool.ConsolePrinterProvider;
+import org.eclipse.cdt.codan.core.externaltool.SpaceArgsSeparator;
+import org.eclipse.cdt.codan.internal.ui.externaltool.ConsolePrinterProvider;
+import org.eclipse.cdt.codan.ui.CodanEditorUtility;
+import org.eclipse.cdt.codan.ui.cxx.util.CEditors;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.ui.editors.text.TextEditor;
/**
* Base class for checkers that invoke external command-line tools to perform code checking
@@ -42,23 +45,51 @@ public abstract class AbstractCxxExternalToolBasedChecker extends AbstractExtern
* @param configurationSettings user-configurable external tool configuration settings.
*/
public AbstractCxxExternalToolBasedChecker(ConfigurationSettings configurationSettings) {
- this(new InvocationParametersProvider(), new CxxSupportedResourceVerifier(),
- new SpaceDelimitedArgsSeparator(), configurationSettings);
+ this(new InvocationParametersProvider(), new SpaceArgsSeparator(), configurationSettings);
}
/**
* Constructor.
* @param parametersProvider provides the parameters to pass when invoking the external tool.
- * @param supportedResourceVerifier indicates whether a resource can be processed by the
- * external tool.
* @param argsSeparator separates the arguments to pass to the external tool executable. These
* arguments are stored in a single {@code String}.
* @param configurationSettings user-configurable external tool configuration settings.
*/
public AbstractCxxExternalToolBasedChecker(IInvocationParametersProvider parametersProvider,
- ISupportedResourceVerifier supportedResourceVerifier, IArgsSeparator argsSeparator,
- ConfigurationSettings configurationSettings) {
- super(parametersProvider, supportedResourceVerifier, argsSeparator,
- new ConsolePrinterProvider(), configurationSettings);
+ IArgsSeparator argsSeparator, ConfigurationSettings configurationSettings) {
+ super(parametersProvider, argsSeparator, new ConsolePrinterProvider(),
+ configurationSettings);
+ }
+
+ /**
+ * Indicates whether the external tool is capable of processing the given
+ * <code>{@link IResource}</code>.
+ * <p>
+ * The minimum requirements that the given {@code IResource} should satisfy are:
+ * <ul>
+ * <li>should be C/C++ file</li>
+ * <li>should be displayed in the current active {@code CEditor}</li>
+ * <li>should not have any unsaved changes</li>
+ * </ul>
+ * </p>
+ * @param resource the given {@code IResource}.
+ * @return {@code true} if the external tool is capable of processing the given file,
+ * {@code false} otherwise.
+ */
+ @Override
+ public boolean enabledInContext(IResource resource) {
+ return isFileOfSupportedType(resource) && isOpenInActiveCleanEditor(resource);
+ }
+
+ private boolean isFileOfSupportedType(IResource resource) {
+ return FileTypes.isCppFile(resource) || FileTypes.isHeaderFile(resource);
+ }
+
+ private boolean isOpenInActiveCleanEditor(IResource resource) {
+ TextEditor editor = CEditors.activeCEditor();
+ if (editor == null) {
+ return false;
+ }
+ return !editor.isDirty() && CodanEditorUtility.isResourceOpenInEditor(resource, editor);
}
}
diff --git a/codan/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF b/codan/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF
index 03165322a3..8a4b1f95a8 100644
--- a/codan/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF
+++ b/codan/org.eclipse.cdt.codan.ui/META-INF/MANIFEST.MF
@@ -20,10 +20,10 @@ Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.cdt.codan.internal.ui;x-friends:="org.eclipse.cdt.codan.ui.cxx",
org.eclipse.cdt.codan.internal.ui.actions;x-friends:="org.eclipse.cdt.codan.ui.cxx",
org.eclipse.cdt.codan.internal.ui.dialogs;x-friends:="org.eclipse.cdt.codan.ui.cxx",
+ org.eclipse.cdt.codan.internal.ui.externaltool;x-friends:="org.eclipse.cdt.codan.ui.cxx",
org.eclipse.cdt.codan.internal.ui.preferences;x-friends:="org.eclipse.cdt.codan.ui.cxx",
org.eclipse.cdt.codan.internal.ui.views;x-internal:=true,
org.eclipse.cdt.codan.internal.ui.widgets;x-internal:=true,
org.eclipse.cdt.codan.ui,
- org.eclipse.cdt.codan.ui.externaltool,
org.eclipse.cdt.codan.ui.handlers
diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/externaltool/ConsolePrinter.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/externaltool/ConsolePrinter.java
index a10c751003..f7f2218593 100644
--- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/externaltool/ConsolePrinter.java
+++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/externaltool/ConsolePrinter.java
@@ -1,27 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.codan.ui.externaltool;
-
-import java.io.IOException;
+package org.eclipse.cdt.codan.internal.ui.externaltool;
import org.eclipse.cdt.codan.core.externaltool.IConsolePrinter;
import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.console.MessageConsoleStream;
+import java.io.IOException;
+
/**
* Default implementation of <code>{@link IConsolePrinter}</code>.
*
* @author alruiz@google.com (Alex Ruiz)
- *
- * @since 2.1
*/
class ConsolePrinter implements IConsolePrinter {
private final MessageConsole console;
@@ -32,18 +30,22 @@ class ConsolePrinter implements IConsolePrinter {
out = console.newMessageStream();
}
+ @Override
public void clear() {
console.clearConsole();
}
+ @Override
public void println(String s) {
out.println(s);
}
+ @Override
public void println() {
out.println();
}
+ @Override
public void close() {
try {
out.close();
diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/externaltool/ConsolePrinterProvider.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/externaltool/ConsolePrinterProvider.java
index 65cee6024f..14e6b763b6 100644
--- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/externaltool/ConsolePrinterProvider.java
+++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/externaltool/ConsolePrinterProvider.java
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.codan.ui.externaltool;
+package org.eclipse.cdt.codan.internal.ui.externaltool;
import static org.eclipse.ui.console.IConsoleConstants.ID_CONSOLE_VIEW;
@@ -28,13 +28,10 @@ import org.eclipse.ui.console.MessageConsole;
* Default implementation of <code>{@link IConsolePrinterProvider}</code>.
*
* @author alruiz@google.com (Alex Ruiz)
- *
- * @since 2.1
*/
public class ConsolePrinterProvider implements IConsolePrinterProvider {
private static final NullConsolePrinter NULL_CONSOLE = new NullConsolePrinter();
- /** {@inheritDoc} */
@Override
public IConsolePrinter createConsole(String externalToolName, boolean shouldDisplayOutput) {
if (shouldDisplayOutput) {
diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/externaltool/NullConsolePrinter.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/externaltool/NullConsolePrinter.java
index 022ff99bb6..bab9f02959 100644
--- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/externaltool/NullConsolePrinter.java
+++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/externaltool/NullConsolePrinter.java
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2012 Google, Inc.
+ * Copyright (c) 2012 Google, Inc and others.
* 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:
- * Alex Ruiz - initial API and implementation
+ * Alex Ruiz (Google) - initial API and implementation
*******************************************************************************/
-package org.eclipse.cdt.codan.ui.externaltool;
+package org.eclipse.cdt.codan.internal.ui.externaltool;
import org.eclipse.cdt.codan.core.externaltool.IConsolePrinter;
@@ -19,14 +19,18 @@ import org.eclipse.cdt.codan.core.externaltool.IConsolePrinter;
*/
class NullConsolePrinter implements IConsolePrinter {
@Override
- public void clear() {}
+ public void clear() {
+ }
@Override
- public void println(String message) {}
+ public void println(String message) {
+ }
@Override
- public void println() {}
+ public void println() {
+ }
@Override
- public void close() {}
+ public void close() {
+ }
}

Back to the top