Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Ruiz2012-02-23 16:17:23 -0500
committerSergey Prigogin2012-02-23 16:17:23 -0500
commitb25c644007819f436d503d7e329f81533ecdd7d6 (patch)
tree9c202476b3c646442a9880e7bee480f71778a652 /codan/org.eclipse.cdt.codan.ui.cxx
parenta631e47e437dfe02bf91f3c0afae98b5269eb05a (diff)
downloadorg.eclipse.cdt-b25c644007819f436d503d7e329f81533ecdd7d6.tar.gz
org.eclipse.cdt-b25c644007819f436d503d7e329f81533ecdd7d6.tar.xz
org.eclipse.cdt-b25c644007819f436d503d7e329f81533ecdd7d6.zip
* Enabled correct API baseline (3.7) and fixed related API-check errors.
* Moved classes that are not part of the API to "internal" packages. * Removed unnecessary classes. * Simplified creation of checkers by providing alternative super class and constructors.
Diffstat (limited to 'codan/org.eclipse.cdt.codan.ui.cxx')
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/AbstractCxxExternalToolBasedChecker.java63
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CEditors.java9
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CxxSupportedResourceVerifier.java4
3 files changed, 71 insertions, 5 deletions
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
new file mode 100644
index 0000000000..199267b0d0
--- /dev/null
+++ b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/AbstractCxxExternalToolBasedChecker.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.ui.cxx.externaltool;
+
+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.ui.externaltool.CommandLauncher;
+
+/**
+ * Base class for checkers that invoke external command-line tools to perform code checking
+ * on C++ files.
+ * <p>
+ * A file, to be processed by this type of checker, must:
+ * <ol>
+ * <li>a C++ file</li>
+ * <li>be in the current active editor</li>
+ * <li>not have any unsaved changes</li>
+ * </ol>
+ * </p>
+ * By default, implementations of this checker are not allowed to run while the user types, since
+ * external tools cannot see unsaved changes.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public abstract class AbstractCxxExternalToolBasedChecker extends AbstractExternalToolBasedChecker {
+ /**
+ * Constructor
+ * @param configurationSettings user-configurable external tool configuration settings.
+ */
+ public AbstractCxxExternalToolBasedChecker(ConfigurationSettings configurationSettings) {
+ this(new InvocationParametersProvider(), new CxxSupportedResourceVerifier(),
+ new SpaceDelimitedArgsSeparator(), 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 CommandLauncher(),
+ configurationSettings);
+ }
+}
diff --git a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CEditors.java b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CEditors.java
index b9b3c9e902..1ab541ca65 100644
--- a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CEditors.java
+++ b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CEditors.java
@@ -24,9 +24,12 @@ import org.eclipse.ui.editors.text.TextEditor;
* @author alruiz@google.com (Alex Ruiz)
*/
@SuppressWarnings("restriction") // CEditor is internal API
-final class CEditors {
-
- static TextEditor activeCEditor() {
+public final class CEditors {
+ /**
+ * Finds the current {@code CEditor}.
+ * @return the current {@code CEditor}, or {@code null} if one cannot be found.
+ */
+ public static TextEditor activeCEditor() {
IWorkbench workbench = PlatformUI.getWorkbench();
for (IWorkbenchWindow w : workbench.getWorkbenchWindows()) {
IWorkbenchPage activePage = w.getActivePage();
diff --git a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CxxSupportedResourceVerifier.java b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CxxSupportedResourceVerifier.java
index 4667d3b973..d5a3c4b38c 100644
--- a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CxxSupportedResourceVerifier.java
+++ b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/CxxSupportedResourceVerifier.java
@@ -20,11 +20,11 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.ui.editors.text.TextEditor;
/**
- * Implemenation of <code>{@link ISupportedResourceVerifier}</code> for C/C++ files.
+ * Implementation of <code>{@link ISupportedResourceVerifier}</code> for C/C++ files.
*
* @author alruiz@google.com (Alex Ruiz)
*/
-public class CxxSupportedResourceVerifier implements ISupportedResourceVerifier {
+class CxxSupportedResourceVerifier implements ISupportedResourceVerifier {
/**
* Indicates whether the external tool is capable of processing the given
* <code>{@link IResource}</code>.

Back to the top