From bad558e232093b7b985eed2f96a171f685a4b9f3 Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Thu, 18 Mar 2010 14:33:13 +0000 Subject: [PATCH] - extracted example from real checkers --- .../org.eclipse.cdt.codan.checkers/plugin.xml | 13 ----- .../org.eclipse.cdt.codan.examples/.classpath | 7 +++ codan/org.eclipse.cdt.codan.examples/.project | 34 +++++++++++++ .../.settings/org.eclipse.jdt.core.prefs | 8 +++ .../META-INF/MANIFEST.MF | 14 ++++++ .../build.properties | 5 ++ .../org.eclipse.cdt.codan.examples/plugin.xml | 22 ++++++++ .../eclipse/cdt/codan/examples/Activator.java | 50 +++++++++++++++++++ .../NamingConventionFunctionChecker.java | 4 +- 9 files changed, 142 insertions(+), 15 deletions(-) create mode 100644 codan/org.eclipse.cdt.codan.examples/.classpath create mode 100644 codan/org.eclipse.cdt.codan.examples/.project create mode 100644 codan/org.eclipse.cdt.codan.examples/.settings/org.eclipse.jdt.core.prefs create mode 100644 codan/org.eclipse.cdt.codan.examples/META-INF/MANIFEST.MF create mode 100644 codan/org.eclipse.cdt.codan.examples/build.properties create mode 100644 codan/org.eclipse.cdt.codan.examples/plugin.xml create mode 100644 codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/Activator.java rename codan/{org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal => org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples}/checkers/NamingConventionFunctionChecker.java (94%) diff --git a/codan/org.eclipse.cdt.codan.checkers/plugin.xml b/codan/org.eclipse.cdt.codan.checkers/plugin.xml index e019352d7dd..475282f23c5 100644 --- a/codan/org.eclipse.cdt.codan.checkers/plugin.xml +++ b/codan/org.eclipse.cdt.codan.checkers/plugin.xml @@ -62,19 +62,6 @@ id="org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem" name="Suggested parenthesis around expression"> - - - - diff --git a/codan/org.eclipse.cdt.codan.examples/.classpath b/codan/org.eclipse.cdt.codan.examples/.classpath new file mode 100644 index 00000000000..64c5e31b7a2 --- /dev/null +++ b/codan/org.eclipse.cdt.codan.examples/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/codan/org.eclipse.cdt.codan.examples/.project b/codan/org.eclipse.cdt.codan.examples/.project new file mode 100644 index 00000000000..7eacfe44864 --- /dev/null +++ b/codan/org.eclipse.cdt.codan.examples/.project @@ -0,0 +1,34 @@ + + + org.eclipse.cdt.codan.examples + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + org.eclipse.pde.api.tools.apiAnalysisNature + + diff --git a/codan/org.eclipse.cdt.codan.examples/.settings/org.eclipse.jdt.core.prefs b/codan/org.eclipse.cdt.codan.examples/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..3d823e3cf64 --- /dev/null +++ b/codan/org.eclipse.cdt.codan.examples/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Mar 18 10:08:06 EDT 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/codan/org.eclipse.cdt.codan.examples/META-INF/MANIFEST.MF b/codan/org.eclipse.cdt.codan.examples/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..096f9a5604e --- /dev/null +++ b/codan/org.eclipse.cdt.codan.examples/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Code Analysis Checker Examples +Bundle-SymbolicName: org.eclipse.cdt.codan.examples;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.cdt.codan.examples.Activator +Bundle-Vendor: CDT +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.cdt.codan.core.cxx;bundle-version="1.0.0", + org.eclipse.cdt.codan.core;bundle-version="1.0.0", + org.eclipse.cdt.core;bundle-version="5.2.0", + org.eclipse.core.resources;bundle-version="3.6.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy diff --git a/codan/org.eclipse.cdt.codan.examples/build.properties b/codan/org.eclipse.cdt.codan.examples/build.properties new file mode 100644 index 00000000000..e9863e281ea --- /dev/null +++ b/codan/org.eclipse.cdt.codan.examples/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/codan/org.eclipse.cdt.codan.examples/plugin.xml b/codan/org.eclipse.cdt.codan.examples/plugin.xml new file mode 100644 index 00000000000..8d01e27f26c --- /dev/null +++ b/codan/org.eclipse.cdt.codan.examples/plugin.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + diff --git a/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/Activator.java b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/Activator.java new file mode 100644 index 00000000000..51f58149f8d --- /dev/null +++ b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/Activator.java @@ -0,0 +1,50 @@ +package org.eclipse.cdt.codan.examples; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.cdt.codan.examples"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NamingConventionFunctionChecker.java b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/NamingConventionFunctionChecker.java similarity index 94% rename from codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NamingConventionFunctionChecker.java rename to codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/NamingConventionFunctionChecker.java index 8de54135ead..54799917d94 100644 --- a/codan/org.eclipse.cdt.codan.checkers/src/org/eclipse/cdt/codan/internal/checkers/NamingConventionFunctionChecker.java +++ b/codan/org.eclipse.cdt.codan.examples/src/org/eclipse/cdt/codan/examples/checkers/NamingConventionFunctionChecker.java @@ -8,7 +8,7 @@ * Contributors: * Alena Laskavaia - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.codan.internal.checkers; +package org.eclipse.cdt.codan.examples.checkers; import java.util.regex.Pattern; @@ -30,7 +30,7 @@ public class NamingConventionFunctionChecker extends AbstractCIndexChecker implements ICheckerWithParameters { private static final String DEFAULT_PATTERN = "^[a-z]"; // name starts with english lowercase letter //$NON-NLS-1$ public static final String PARAM_KEY = "pattern"; //$NON-NLS-1$ - private static final String ER_ID = "org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionProblem"; //$NON-NLS-1$ + private static final String ER_ID = "org.eclipse.cdt.codan.examples.checkers.NamingConventionFunctionProblem"; //$NON-NLS-1$ /* * (non-Javadoc)