Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2012-03-13 21:42:16 -0400
committerSergey Prigogin2012-03-13 21:42:16 -0400
commitada23a9a2f553630410d3765c9086b8b163ee815 (patch)
tree87137ada1645f93c582dbbb658c9ed3e5a4972bc /codan/org.eclipse.cdt.codan.ui.cxx
parentc510e7ad5b2edf4fa6d1a80eee209caa4a10f275 (diff)
downloadorg.eclipse.cdt-ada23a9a2f553630410d3765c9086b8b163ee815.tar.gz
org.eclipse.cdt-ada23a9a2f553630410d3765c9086b8b163ee815.tar.xz
org.eclipse.cdt-ada23a9a2f553630410d3765c9086b8b163ee815.zip
Bug 372551. Removed the external tool checker support until all design
issues are resolved.
Diffstat (limited to 'codan/org.eclipse.cdt.codan.ui.cxx')
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/META-INF/MANIFEST.MF3
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/AbstractCxxExternalToolBasedChecker.java97
-rw-r--r--codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/util/CEditors.java45
3 files changed, 1 insertions, 144 deletions
diff --git a/codan/org.eclipse.cdt.codan.ui.cxx/META-INF/MANIFEST.MF b/codan/org.eclipse.cdt.codan.ui.cxx/META-INF/MANIFEST.MF
index 80bc1e757d..abedd163a0 100644
--- a/codan/org.eclipse.cdt.codan.ui.cxx/META-INF/MANIFEST.MF
+++ b/codan/org.eclipse.cdt.codan.ui.cxx/META-INF/MANIFEST.MF
@@ -19,5 +19,4 @@ Require-Bundle: org.eclipse.ui,
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.cdt.codan.internal.ui.cxx;x-internal:=true,
- org.eclipse.cdt.codan.ui,
- org.eclipse.cdt.codan.ui.cxx.externaltool
+ org.eclipse.cdt.codan.ui
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
deleted file mode 100644
index ea4df5f20d..0000000000
--- a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/externaltool/AbstractCxxExternalToolBasedChecker.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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.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.InvocationParametersProvider;
-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
- * 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)
- *
- * @since 3.0
- */
-public abstract class AbstractCxxExternalToolBasedChecker extends AbstractExternalToolBasedChecker {
- /**
- * Constructor
- * @param configurationSettings user-configurable external tool configuration settings.
- */
- public AbstractCxxExternalToolBasedChecker(ConfigurationSettings configurationSettings) {
- this(new InvocationParametersProvider(), new SpaceArgsSeparator(), configurationSettings);
- }
-
- /**
- * Constructor.
- * @param parametersProvider provides the parameters to pass when invoking 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,
- 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.cxx/src/org/eclipse/cdt/codan/ui/cxx/util/CEditors.java b/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/util/CEditors.java
deleted file mode 100644
index 39c4a216b4..0000000000
--- a/codan/org.eclipse.cdt.codan.ui.cxx/src/org/eclipse/cdt/codan/ui/cxx/util/CEditors.java
+++ /dev/null
@@ -1,45 +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.ui.cxx.util;
-
-import org.eclipse.cdt.internal.ui.editor.CEditor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.editors.text.TextEditor;
-
-/**
- * Utility methods related to <code>{@link CEditor}</code>.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-@SuppressWarnings("restriction") // CEditor is internal API
-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();
- IEditorPart editor = activePage.getActiveEditor();
- if (editor instanceof CEditor) {
- return (CEditor) editor;
- }
- }
- return null;
- }
-
- private CEditors() {}
-}

Back to the top