Revision: 6519
http://pmd.svn.sourceforge.net/pmd/?rev=6519&view=rev
Author: xlv
Date: 2008-09-26 20:34:37 +0000 (Fri, 26 Sep 2008)
Log Message:
-----------
code cleanup: plugin activator renamed PMDPlugin and all older PMD<xxx>Plugin classes removed
Modified Paths:
--------------
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/META-INF/MANIFEST.MF
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/name/herlin/command/DefaultCommandProcessor.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/core/ext/RuleSetsExtensionProcessor.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/PMDRuntimeConstants.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/builder/PMDBuilder.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/AbstractDefaultCommand.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/BaseVisitor.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/BuildProjectCommand.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/DetectCutAndPasteCmd.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/JobCommandProcessor.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/RenderReportCmd.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/ReviewCodeCmd.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/preferences/impl/PreferencesManagerImpl.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/properties/impl/ProjectPropertiesImpl.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/properties/impl/ProjectPropertiesManagerImpl.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/actions/CPDCheckProjectAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/actions/ClearReviewsAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/actions/GenerateReportAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/actions/PMDCheckAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/actions/PMDGenerateASTAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/actions/PMDRemoveMarkersAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/actions/ShowDataflowAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/dialogs/CPDCheckDialog.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/model/DataflowMethodRecord.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/model/FileRecord.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/model/PackageRecord.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/model/ProjectRecord.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/nls/StringTable.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/CPDPreferencePage.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/GeneralPreferencesPage.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/PMDPreferencePage.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/RuleCellModifier.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/RuleDialog.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/RuleLabelProvider.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/preferences/RuleSetSelectionDialog.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/properties/PMDPropertyPage.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/properties/PMDPropertyPageController.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/properties/UpdateProjectPropertiesCmd.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/quickfix/PMDResolution.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/quickfix/PMDResolutionGenerator.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/CPDView.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/CPDViewDoubleClickEventListener.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/DataflowAnomalyTableLabelProvider.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/DataflowAnomalyTableViewer.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/DataflowGraphViewer.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/DataflowView.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/DataflowViewPage.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/PriorityFilter.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/TableColumnSorter.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/ViewMemento.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/ViolationOutline.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/ViolationOutlineLabelProvider.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/ViolationOutlinePage.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/ViolationOverview.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/ViolationOverviewDoubleClickListener.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/ViolationOverviewLabelProvider.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/ViolationOverviewMenuManager.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/CalculateStatisticsAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/CollapseAllAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/PackageSwitchAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/PriorityFilterAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/ProjectFilterAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/QuickFixAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/RemoveViolationAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/ReviewAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/ReviewResourceAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/ShowRuleAction.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/views/actions/ViolationPresentationTypeAction.java
Added Paths:
-----------
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDPlugin.java
Removed Paths:
-------------
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/core/PMDCorePlugin.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDActivator.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/PMDRuntimePlugin.java
trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/ui/PMDUiPlugin.java
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/META-INF/MANIFEST.MF
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/META-INF/MANIFEST.MF 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/META-INF/MANIFEST.MF 2008-09-26 20:34:37 UTC (rev 6519)
@@ -2,8 +2,8 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: net.sourceforge.pmd.eclipse.plugin;singleton:=true
-Bundle-Version: 3.2.5.v200809252340
-Bundle-Activator: net.sourceforge.pmd.eclipse.plugin.PMDActivator
+Bundle-Version: 3.2.5.v200809261135
+Bundle-Activator: net.sourceforge.pmd.eclipse.plugin.PMDPlugin
Require-Bundle: org.eclipse.core.resources;bundle-version="3.4.0",
org.eclipse.core.runtime,
org.eclipse.jdt.core;bundle-version="3.4.0",
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/name/herlin/command/DefaultCommandProcessor.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/name/herlin/command/DefaultCommandProcessor.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/name/herlin/command/DefaultCommandProcessor.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -1,6 +1,6 @@
/*
* Patterns Library - Implementation of various design patterns
- * Copyright (C) 2004 Philippe Herlin
+ * Copyright (C) 2004 Philippe Herlin
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
@@ -13,14 +13,14 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Contact: phi...@ya...
- *
+ * Contact: phi...@ya...
+ *
*/
package name.herlin.command;
-import net.sourceforge.pmd.runtime.PMDRuntimePlugin;
+import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
import org.apache.log4j.Logger;
@@ -34,11 +34,11 @@
/**
* Execute the command.
- *
+ *
* @param aCommand
* the command to execute
* @throws CommandException
- * if an unexpected condidition occurred.
+ * if an unexpected condition occurred.
*/
public void processCommand(final AbstractProcessableCommand aCommand) throws CommandException {
log.debug("Beginning command " + aCommand.getName());
@@ -46,7 +46,7 @@
Timer timer = new Timer();
aCommand.execute();
timer.stop();
- PMDRuntimePlugin.getDefault().logInformation("Command " + aCommand.getName() + " excecuted in " + timer.getDuration() + "ms");
+ PMDPlugin.getDefault().logInformation("Command " + aCommand.getName() + " excecuted in " + timer.getDuration() + "ms");
} else {
throw new UnsetInputPropertiesException();
}
Deleted: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/core/PMDCorePlugin.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/core/PMDCorePlugin.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/core/PMDCorePlugin.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -1,74 +0,0 @@
-/*
- * Created on 7 juin 2005
- *
- * Copyright (c) 2005, PMD for Eclipse Development Team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * The end-user documentation included with the redistribution, if
- * any, must include the following acknowledgement:
- * "This product includes software developed in part by support from
- * the Defense Advanced Research Project Agency (DARPA)"
- * * Neither the name of "PMD for Eclipse Development Team" nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package net.sourceforge.pmd.core;
-
-import net.sourceforge.pmd.eclipse.plugin.PMDActivator;
-
-/**
- * The plugin class for the Core PMD Plugin.
- *
- * @author Philippe Herlin
- * @version $Revision$
- *
- * $Log: PMDCorePlugin.java,v $
- * Revision 1.6 2007/06/24 15:07:29 phherlin
- * Integrate PMD v4.0rc1
- *
- * Revision 1.5 2007/01/18 20:58:27 phherlin
- * Integrate PMD v3.9
- * Revision 1.4 2006/06/20 21:04:49 phherlin Enable
- * PMD and fix error level violations
- *
- * Revision 1.3 2006/04/10 20:58:18 phherlin Update to PMD 3.6
- *
- * Revision 1.2 2005/07/02 14:33:05 phherlin Implement the RuleSets extension
- * point
- *
- * Revision 1.1 2005/06/07 22:39:57 phherlin Implementing extra ruleset
- * declaration
- *
- *
- */
-public class PMDCorePlugin {
-
- /**
- * Returns the shared instance.
- */
- public static PMDActivator getDefault() {
- return PMDActivator.getDefault();
- }
-
-}
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/core/ext/RuleSetsExtensionProcessor.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/core/ext/RuleSetsExtensionProcessor.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/core/ext/RuleSetsExtensionProcessor.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -7,7 +7,7 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
@@ -20,7 +20,7 @@
* * Neither the name of "PMD for Eclipse Development Team" nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
@@ -38,7 +38,7 @@
import net.sourceforge.pmd.core.IRuleSetManager;
import net.sourceforge.pmd.core.IRuleSetsExtension;
-import net.sourceforge.pmd.core.PMDCorePlugin;
+import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -49,10 +49,10 @@
/**
* This class processes the AdditionalRuleSets extension point
- *
+ *
* @author Herlin
* @version $Revision$
- *
+ *
* $Log$
* Revision 1.3 2006/06/20 21:04:24 phherlin
* Enable PMD and fix error level violations
@@ -70,7 +70,7 @@
private static final String EXTENTION_POINT = "net.sourceforge.pmd.eclipse.plugin.rulesets";
private static final String CLASS_ATTRIBUTE = "class";
final private IRuleSetManager ruleSetManager;
-
+
/**
* Constructor
* @param ruleSetManager the plugin RuleSetManager
@@ -78,7 +78,7 @@
public RuleSetsExtensionProcessor(IRuleSetManager ruleSetManager) {
this.ruleSetManager = ruleSetManager;
}
-
+
/**
* Process the extension point
*/
@@ -90,7 +90,7 @@
processExecutableExtension(elements[i]);
}
}
-
+
/**
* Process an extension
* @param element the extension to process
@@ -99,12 +99,12 @@
final Object object = element.createExecutableExtension(CLASS_ATTRIBUTE);
if (object instanceof IRuleSetsExtension) {
final IRuleSetsExtension extension = (IRuleSetsExtension) object;
-
- extension.registerRuleSets(this.ruleSetManager.getRegisteredRuleSets());
+
+ extension.registerRuleSets(this.ruleSetManager.getRegisteredRuleSets());
extension.registerDefaultRuleSets(this.ruleSetManager.getDefaultRuleSets());
-
+
} else {
- PMDCorePlugin.getDefault().log(IStatus.ERROR, "Extension " + element.getName() + " is not an instance of IRuleSetsExtension", null);
+ PMDPlugin.getDefault().log(IStatus.ERROR, "Extension " + element.getName() + " is not an instance of IRuleSetsExtension", null);
}
}
Deleted: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDActivator.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDActivator.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDActivator.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -1,361 +0,0 @@
-package net.sourceforge.pmd.eclipse.plugin;
-
-import java.io.IOException;
-
-import net.sourceforge.pmd.RuleSet;
-import net.sourceforge.pmd.RuleSetFactory;
-import net.sourceforge.pmd.RuleSetNotFoundException;
-import net.sourceforge.pmd.core.IRuleSetManager;
-import net.sourceforge.pmd.core.PluginConstants;
-import net.sourceforge.pmd.core.ext.RuleSetsExtensionProcessor;
-import net.sourceforge.pmd.core.impl.RuleSetManagerImpl;
-import net.sourceforge.pmd.runtime.preferences.IPreferences;
-import net.sourceforge.pmd.runtime.preferences.IPreferencesFactory;
-import net.sourceforge.pmd.runtime.preferences.IPreferencesManager;
-import net.sourceforge.pmd.runtime.preferences.impl.PreferencesFactoryImpl;
-import net.sourceforge.pmd.runtime.properties.IProjectProperties;
-import net.sourceforge.pmd.runtime.properties.IProjectPropertiesManager;
-import net.sourceforge.pmd.runtime.properties.IPropertiesFactory;
-import net.sourceforge.pmd.runtime.properties.PropertiesException;
-import net.sourceforge.pmd.runtime.properties.impl.PropertiesFactoryImpl;
-import net.sourceforge.pmd.runtime.writer.IAstWriter;
-import net.sourceforge.pmd.runtime.writer.IRuleSetWriter;
-import net.sourceforge.pmd.runtime.writer.impl.WriterFactoryImpl;
-import net.sourceforge.pmd.ui.nls.StringKeys;
-import net.sourceforge.pmd.ui.nls.StringTable;
-
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Layout;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.RollingFileAppender;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class PMDActivator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "net.sourceforge.pmd.eclipse.plugin";
-
- // The shared instance
- private static PMDActivator plugin;
-
- /**
- * The constructor
- */
- public PMDActivator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- configureLogs(loadPreferences());
- this.registerStandardRuleSets();
- this.registerAdditionalRuleSets();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 PMDActivator getDefault() {
- return plugin;
- }
-
- private static final Logger log = Logger.getLogger(PMDActivator.class);
-
- private StringTable stringTable; // NOPMD by Herlin on 11/10/06 00:22
- private String[] priorityLabels; // NOPMD by Herlin on 11/10/06 00:22
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin("net.sourceforge.pmd.eclipse.plugin", path);
- }
-
- /**
- * Get an image corresponding to the severity
- */
- public Image getImage(String key, String iconPath) {
- final ImageRegistry registry = getImageRegistry();
- Image image = registry.get(key);
- if (image == null) {
- final ImageDescriptor descriptor = getImageDescriptor(iconPath);
- if (descriptor != null) {
- registry.put(key, descriptor);
- image = registry.get(key);
- }
- }
-
- return image;
- }
-
- /**
- * Helper method to log error
- *
- * @see IStatus
- */
- public void logError(String message, Throwable t) {
- getLog().log(new Status(IStatus.ERROR, getBundle().getSymbolicName(), 0, message + t.getMessage(), t));
- if (log != null) {
- log.error(message, t);
- }
- }
-
- /**
- * Helper method to log error
- *
- * @see IStatus
- */
- public void logError(IStatus status) {
- getLog().log(status);
- if (log != null) {
- log.error(status.getMessage(), status.getException());
- }
- }
-
- /**
- * Helper method to display error
- */
- public void showError(final String message, final Throwable t) {
- logError(message, t);
- Display.getDefault().syncExec(new Runnable() {
-
- public void run() {
-
- MessageDialog.openError(Display.getCurrent().getActiveShell(), getStringTable().getString(StringKeys.MSGKEY_ERROR_TITLE), message
- + String.valueOf(t));
- }
- });
- }
-
- /**
- * @return an instance of the string table
- */
- public StringTable getStringTable() {
- if (this.stringTable == null) {
- this.stringTable = new StringTable();
- }
-
- return this.stringTable;
- }
-
- /**
- * @return the priority values
- */
- public Integer[] getPriorityValues() {
- return new Integer[] {
- new Integer(1),
- new Integer(2),
- new Integer(3),
- new Integer(4),
- new Integer(5)
- };
- }
-
- /**
- * Return the priority labels
- */
- public String[] getPriorityLabels() {
- if (this.priorityLabels == null) {
- final StringTable stringTable = getStringTable();
- this.priorityLabels = new String[]{
- stringTable.getString(StringKeys.MSGKEY_PRIORITY_ERROR_HIGH),
- stringTable.getString(StringKeys.MSGKEY_PRIORITY_ERROR),
- stringTable.getString(StringKeys.MSGKEY_PRIORITY_WARNING_HIGH),
- stringTable.getString(StringKeys.MSGKEY_PRIORITY_WARNING),
- stringTable.getString(StringKeys.MSGKEY_PRIORITY_INFORMATION)
- };
- }
-
- return this.priorityLabels; // NOPMD by Herlin on 11/10/06 00:22
- }
-
- public static final String ROOT_LOG_ID = "net.sourceforge.pmd";
- private static final String PMD_ECLIPSE_APPENDER_NAME = "PMDEclipseAppender";
- private IPreferencesFactory preferencesFactory = new PreferencesFactoryImpl();
- private IPropertiesFactory propertiesFactory = new PropertiesFactoryImpl();
-
- /**
- * Load the PMD plugin preferences
- */
- public IPreferences loadPreferences() {
- return getPreferencesManager().loadPreferences();
- }
-
- /**
- * @return the plugin preferences manager
- */
- public IPreferencesManager getPreferencesManager() {
- return this.preferencesFactory.getPreferencesManager();
- }
-
- /**
- * @return the plugin project properties manager
- */
- public IProjectPropertiesManager getPropertiesManager() {
- return this.propertiesFactory.getProjectPropertiesManager();
- }
-
- /**
- * @param project a workspace project
- * @return the PMD properties for that project
- */
- public IProjectProperties loadProjectProperties(IProject project) throws PropertiesException {
- return getPropertiesManager().loadProjectProperties(project);
- }
-
- /**
- * Helper method to log information
- *
- * @see IStatus
- */
- public void logInformation(String message) {
- getLog().log(new Status(IStatus.INFO, getBundle().getSymbolicName(), 0, message, null));
- }
-
- /**
- * @return an instance of an AST writer
- */
- public IAstWriter getAstWriter() {
- return new WriterFactoryImpl().getAstWriter();
- }
-
- /**
- * @return an instance of a ruleset writer
- */
- public IRuleSetWriter getRuleSetWriter() {
- return new WriterFactoryImpl().getRuleSetWriter();
- }
-
- /**
- * Apply the log preferencs
- */
- public void applyLogPreferences(IPreferences preferences) {
- Logger log = Logger.getLogger(ROOT_LOG_ID);
- log.setLevel(preferences.getLogLevel());
- RollingFileAppender appender = (RollingFileAppender) log.getAppender(PMD_ECLIPSE_APPENDER_NAME);
- if (appender == null) {
- configureLogs(preferences);
- } else if (!appender.getFile().equals(preferences.getLogFileName())) {
- appender.setFile(preferences.getLogFileName());
- appender.activateOptions();
- }
- }
-
- /**
- * Configure the logging
- *
- */
- private void configureLogs(IPreferences preferences) {
- try {
- Layout layout = new PatternLayout("%d{yyyy/MM/dd HH:mm:ss,SSS} %-5p %-32c{1} %m%n");
-
- RollingFileAppender appender = new RollingFileAppender(layout, preferences.getLogFileName());
- appender.setName(PMD_ECLIPSE_APPENDER_NAME);
- appender.setMaxBackupIndex(1);
- appender.setMaxFileSize("10MB");
-
- Logger.getRootLogger().addAppender(new ConsoleAppender(layout));
- Logger.getRootLogger().setLevel(Level.WARN);
- Logger.getRootLogger().setAdditivity(false);
-
- Logger.getLogger(ROOT_LOG_ID).addAppender(appender);
- Logger.getLogger(ROOT_LOG_ID).setLevel(preferences.getLogLevel());
- Logger.getLogger(ROOT_LOG_ID).setAdditivity(false);
-
- } catch (IOException e) {
- logError("IO Exception when configuring logging.", e);
- }
- }
-
- private final IRuleSetManager ruleSetManager = new RuleSetManagerImpl(); // NOPMD:SingularField
-
- /**
- * @return the ruleset manager instance
- */
- public final IRuleSetManager getRuleSetManager() {
- return this.ruleSetManager;
- }
-
- /**
- * Logs inside the Eclipse environment
- *
- * @param severity the severity of the log (IStatus code)
- * @param message the message to log
- * @param t a possible throwable, may be null
- */
- public final void log(final int severity, final String message, final Throwable t) {
- final Bundle bundle = getBundle();
- if (bundle != null) {
- getLog().log(new Status(severity, bundle.getSymbolicName(), 0, message, t));
- }
-
- // TODO : when bundle is not created yet (ie at startup), we cannot log ; find a way to log.
- }
-
- /**
- * Registering the standard rulesets
- *
- */
- private void registerStandardRuleSets() {
- final RuleSetFactory factory = new RuleSetFactory();
- for (int i = 0; i < PluginConstants.PMD_RULESETS.length; i++) {
- try {
- final RuleSet ruleSet = factory.createRuleSets(PluginConstants.PMD_RULESETS[i]).getAllRuleSets()[0];
- getRuleSetManager().registerRuleSet(ruleSet);
- getRuleSetManager().registerDefaultRuleSet(ruleSet);
- } catch (RuleSetNotFoundException e) {
- this.log(IStatus.WARNING, "The RuleSet \"" + PluginConstants.PMD_RULESETS[i] + "\" cannot be found", e);
- }
- }
- }
-
- /**
- * Register additional rulesets that may be provided by a fragment. Find
- * extension points implementation and call them
- *
- */
- private void registerAdditionalRuleSets() {
- try {
- final RuleSetsExtensionProcessor processor = new RuleSetsExtensionProcessor(getRuleSetManager());
- processor.process();
- } catch (CoreException e) {
- log(IStatus.ERROR, "Error when processing RuleSets extensions", e);
- }
- }
-}
-
Copied: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDPlugin.java (from rev 6518, trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDActivator.java)
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDPlugin.java (rev 0)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDPlugin.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -0,0 +1,361 @@
+package net.sourceforge.pmd.eclipse.plugin;
+
+import java.io.IOException;
+
+import net.sourceforge.pmd.RuleSet;
+import net.sourceforge.pmd.RuleSetFactory;
+import net.sourceforge.pmd.RuleSetNotFoundException;
+import net.sourceforge.pmd.core.IRuleSetManager;
+import net.sourceforge.pmd.core.PluginConstants;
+import net.sourceforge.pmd.core.ext.RuleSetsExtensionProcessor;
+import net.sourceforge.pmd.core.impl.RuleSetManagerImpl;
+import net.sourceforge.pmd.runtime.preferences.IPreferences;
+import net.sourceforge.pmd.runtime.preferences.IPreferencesFactory;
+import net.sourceforge.pmd.runtime.preferences.IPreferencesManager;
+import net.sourceforge.pmd.runtime.preferences.impl.PreferencesFactoryImpl;
+import net.sourceforge.pmd.runtime.properties.IProjectProperties;
+import net.sourceforge.pmd.runtime.properties.IProjectPropertiesManager;
+import net.sourceforge.pmd.runtime.properties.IPropertiesFactory;
+import net.sourceforge.pmd.runtime.properties.PropertiesException;
+import net.sourceforge.pmd.runtime.properties.impl.PropertiesFactoryImpl;
+import net.sourceforge.pmd.runtime.writer.IAstWriter;
+import net.sourceforge.pmd.runtime.writer.IRuleSetWriter;
+import net.sourceforge.pmd.runtime.writer.impl.WriterFactoryImpl;
+import net.sourceforge.pmd.ui.nls.StringKeys;
+import net.sourceforge.pmd.ui.nls.StringTable;
+
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.Layout;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.apache.log4j.RollingFileAppender;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class PMDPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "net.sourceforge.pmd.eclipse.plugin";
+
+ // The shared instance
+ private static PMDPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public PMDPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ configureLogs(loadPreferences());
+ this.registerStandardRuleSets();
+ this.registerAdditionalRuleSets();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 PMDPlugin getDefault() {
+ return plugin;
+ }
+
+ private static final Logger log = Logger.getLogger(PMDPlugin.class);
+
+ private StringTable stringTable; // NOPMD by Herlin on 11/10/06 00:22
+ private String[] priorityLabels; // NOPMD by Herlin on 11/10/06 00:22
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin("net.sourceforge.pmd.eclipse.plugin", path);
+ }
+
+ /**
+ * Get an image corresponding to the severity
+ */
+ public Image getImage(String key, String iconPath) {
+ final ImageRegistry registry = getImageRegistry();
+ Image image = registry.get(key);
+ if (image == null) {
+ final ImageDescriptor descriptor = getImageDescriptor(iconPath);
+ if (descriptor != null) {
+ registry.put(key, descriptor);
+ image = registry.get(key);
+ }
+ }
+
+ return image;
+ }
+
+ /**
+ * Helper method to log error
+ *
+ * @see IStatus
+ */
+ public void logError(String message, Throwable t) {
+ getLog().log(new Status(IStatus.ERROR, getBundle().getSymbolicName(), 0, message + t.getMessage(), t));
+ if (log != null) {
+ log.error(message, t);
+ }
+ }
+
+ /**
+ * Helper method to log error
+ *
+ * @see IStatus
+ */
+ public void logError(IStatus status) {
+ getLog().log(status);
+ if (log != null) {
+ log.error(status.getMessage(), status.getException());
+ }
+ }
+
+ /**
+ * Helper method to display error
+ */
+ public void showError(final String message, final Throwable t) {
+ logError(message, t);
+ Display.getDefault().syncExec(new Runnable() {
+
+ public void run() {
+
+ MessageDialog.openError(Display.getCurrent().getActiveShell(), getStringTable().getString(StringKeys.MSGKEY_ERROR_TITLE), message
+ + String.valueOf(t));
+ }
+ });
+ }
+
+ /**
+ * @return an instance of the string table
+ */
+ public StringTable getStringTable() {
+ if (this.stringTable == null) {
+ this.stringTable = new StringTable();
+ }
+
+ return this.stringTable;
+ }
+
+ /**
+ * @return the priority values
+ */
+ public Integer[] getPriorityValues() {
+ return new Integer[] {
+ new Integer(1),
+ new Integer(2),
+ new Integer(3),
+ new Integer(4),
+ new Integer(5)
+ };
+ }
+
+ /**
+ * Return the priority labels
+ */
+ public String[] getPriorityLabels() {
+ if (this.priorityLabels == null) {
+ final StringTable stringTable = getStringTable();
+ this.priorityLabels = new String[]{
+ stringTable.getString(StringKeys.MSGKEY_PRIORITY_ERROR_HIGH),
+ stringTable.getString(StringKeys.MSGKEY_PRIORITY_ERROR),
+ stringTable.getString(StringKeys.MSGKEY_PRIORITY_WARNING_HIGH),
+ stringTable.getString(StringKeys.MSGKEY_PRIORITY_WARNING),
+ stringTable.getString(StringKeys.MSGKEY_PRIORITY_INFORMATION)
+ };
+ }
+
+ return this.priorityLabels; // NOPMD by Herlin on 11/10/06 00:22
+ }
+
+ public static final String ROOT_LOG_ID = "net.sourceforge.pmd";
+ private static final String PMD_ECLIPSE_APPENDER_NAME = "PMDEclipseAppender";
+ private IPreferencesFactory preferencesFactory = new PreferencesFactoryImpl();
+ private IPropertiesFactory propertiesFactory = new PropertiesFactoryImpl();
+
+ /**
+ * Load the PMD plugin preferences
+ */
+ public IPreferences loadPreferences() {
+ return getPreferencesManager().loadPreferences();
+ }
+
+ /**
+ * @return the plugin preferences manager
+ */
+ public IPreferencesManager getPreferencesManager() {
+ return this.preferencesFactory.getPreferencesManager();
+ }
+
+ /**
+ * @return the plugin project properties manager
+ */
+ public IProjectPropertiesManager getPropertiesManager() {
+ return this.propertiesFactory.getProjectPropertiesManager();
+ }
+
+ /**
+ * @param project a workspace project
+ * @return the PMD properties for that project
+ */
+ public IProjectProperties loadProjectProperties(IProject project) throws PropertiesException {
+ return getPropertiesManager().loadProjectProperties(project);
+ }
+
+ /**
+ * Helper method to log information
+ *
+ * @see IStatus
+ */
+ public void logInformation(String message) {
+ getLog().log(new Status(IStatus.INFO, getBundle().getSymbolicName(), 0, message, null));
+ }
+
+ /**
+ * @return an instance of an AST writer
+ */
+ public IAstWriter getAstWriter() {
+ return new WriterFactoryImpl().getAstWriter();
+ }
+
+ /**
+ * @return an instance of a ruleset writer
+ */
+ public IRuleSetWriter getRuleSetWriter() {
+ return new WriterFactoryImpl().getRuleSetWriter();
+ }
+
+ /**
+ * Apply the log preferencs
+ */
+ public void applyLogPreferences(IPreferences preferences) {
+ Logger log = Logger.getLogger(ROOT_LOG_ID);
+ log.setLevel(preferences.getLogLevel());
+ RollingFileAppender appender = (RollingFileAppender) log.getAppender(PMD_ECLIPSE_APPENDER_NAME);
+ if (appender == null) {
+ configureLogs(preferences);
+ } else if (!appender.getFile().equals(preferences.getLogFileName())) {
+ appender.setFile(preferences.getLogFileName());
+ appender.activateOptions();
+ }
+ }
+
+ /**
+ * Configure the logging
+ *
+ */
+ private void configureLogs(IPreferences preferences) {
+ try {
+ Layout layout = new PatternLayout("%d{yyyy/MM/dd HH:mm:ss,SSS} %-5p %-32c{1} %m%n");
+
+ RollingFileAppender appender = new RollingFileAppender(layout, preferences.getLogFileName());
+ appender.setName(PMD_ECLIPSE_APPENDER_NAME);
+ appender.setMaxBackupIndex(1);
+ appender.setMaxFileSize("10MB");
+
+ Logger.getRootLogger().addAppender(new ConsoleAppender(layout));
+ Logger.getRootLogger().setLevel(Level.WARN);
+ Logger.getRootLogger().setAdditivity(false);
+
+ Logger.getLogger(ROOT_LOG_ID).addAppender(appender);
+ Logger.getLogger(ROOT_LOG_ID).setLevel(preferences.getLogLevel());
+ Logger.getLogger(ROOT_LOG_ID).setAdditivity(false);
+
+ } catch (IOException e) {
+ logError("IO Exception when configuring logging.", e);
+ }
+ }
+
+ private final IRuleSetManager ruleSetManager = new RuleSetManagerImpl(); // NOPMD:SingularField
+
+ /**
+ * @return the ruleset manager instance
+ */
+ public final IRuleSetManager getRuleSetManager() {
+ return this.ruleSetManager;
+ }
+
+ /**
+ * Logs inside the Eclipse environment
+ *
+ * @param severity the severity of the log (IStatus code)
+ * @param message the message to log
+ * @param t a possible throwable, may be null
+ */
+ public final void log(final int severity, final String message, final Throwable t) {
+ final Bundle bundle = getBundle();
+ if (bundle != null) {
+ getLog().log(new Status(severity, bundle.getSymbolicName(), 0, message, t));
+ }
+
+ // TODO : when bundle is not created yet (ie at startup), we cannot log ; find a way to log.
+ }
+
+ /**
+ * Registering the standard rulesets
+ *
+ */
+ private void registerStandardRuleSets() {
+ final RuleSetFactory factory = new RuleSetFactory();
+ for (int i = 0; i < PluginConstants.PMD_RULESETS.length; i++) {
+ try {
+ final RuleSet ruleSet = factory.createRuleSets(PluginConstants.PMD_RULESETS[i]).getAllRuleSets()[0];
+ getRuleSetManager().registerRuleSet(ruleSet);
+ getRuleSetManager().registerDefaultRuleSet(ruleSet);
+ } catch (RuleSetNotFoundException e) {
+ this.log(IStatus.WARNING, "The RuleSet \"" + PluginConstants.PMD_RULESETS[i] + "\" cannot be found", e);
+ }
+ }
+ }
+
+ /**
+ * Register additional rulesets that may be provided by a fragment. Find
+ * extension points implementation and call them
+ *
+ */
+ private void registerAdditionalRuleSets() {
+ try {
+ final RuleSetsExtensionProcessor processor = new RuleSetsExtensionProcessor(getRuleSetManager());
+ processor.process();
+ } catch (CoreException e) {
+ log(IStatus.ERROR, "Error when processing RuleSets extensions", e);
+ }
+ }
+}
+
Property changes on: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDPlugin.java
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/PMDRuntimeConstants.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/PMDRuntimeConstants.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/PMDRuntimeConstants.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -1,12 +1,14 @@
package net.sourceforge.pmd.runtime;
+import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
+
/**
* This interface groups all plugin constants
- *
+ *
* @author Philippe Herlin
* @version $Revision$
- *
+ *
* $Log$
* Revision 1.4 2006/11/16 16:54:41 holobender
* - changed command for the new cpd view
@@ -60,20 +62,20 @@
*/
public class PMDRuntimeConstants {
- public static final String PMD_MARKER = PMDRuntimePlugin.PLUGIN_ID + ".pmdMarker";
- public static final String PMD_DFA_MARKER = PMDRuntimePlugin.PLUGIN_ID + ".pmdDFAMarker";
- public static final String PMD_TASKMARKER = PMDRuntimePlugin.PLUGIN_ID + ".pmdTaskMarker";
-
+ public static final String PMD_MARKER = PMDPlugin.PLUGIN_ID + ".pmdMarker";
+ public static final String PMD_DFA_MARKER = PMDPlugin.PLUGIN_ID + ".pmdDFAMarker";
+ public static final String PMD_TASKMARKER = PMDPlugin.PLUGIN_ID + ".pmdTaskMarker";
+
public static final String RULE_PROPERTY_MAXVIOLATIONS = "maxviolations";
-
+
public static final String ID_PERSPECTIVE = "net.sourceforge.pmd.ui.views.pmdPerspective";
-
+
public static final String KEY_MARKERATT_RULENAME = "rulename";
public static final String KEY_MARKERATT_PRIORITY = "pmd_priority";
public static final String KEY_MARKERATT_LINE2 = "line2";
public static final String KEY_MARKERATT_VARIABLE = "variable";
public static final String KEY_MARKERATT_METHODNAME = "method";
-
+
public static final String PLUGIN_STYLE_REVIEW_COMMENT = "// @PMD:REVIEWED:";
public static final String PMD_STYLE_REVIEW_COMMENT = "// NOPMD";
@@ -86,12 +88,12 @@
public static final String SIMPLE_CPDREPORT_NAME = "cpd-report.txt";
public static final String XML_CPDREPORT_NAME = "cpd-report.xml";
public static final String CSV_CPDREPORT_NAME = "cpd-report.csv";
-
+
public static final int PROPERTY_CPD = 1111;
public static final int PROPERTY_REVIEW = 1112;
-
+
/**
- * This class is not meant to be instanciated
+ * This class is not meant to be instantiated
*
*/
private PMDRuntimeConstants() {
Deleted: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/PMDRuntimePlugin.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/PMDRuntimePlugin.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/PMDRuntimePlugin.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -1,63 +0,0 @@
-/*
- * Created on 7 mai 2006
- *
- * Copyright (c) 2006, PMD for Eclipse Development Team
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * The end-user documentation included with the redistribution, if
- * any, must include the following acknowledgement:
- * "This product includes software developed in part by support from
- * the Defense Advanced Research Project Agency (DARPA)"
- * * Neither the name of "PMD for Eclipse Development Team" nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package net.sourceforge.pmd.runtime;
-
-import net.sourceforge.pmd.eclipse.plugin.PMDActivator;
-
-/**
- * Plugin class for the PMD for Eclipse Runtime plugin. This is the entry point to get access to that plugin features, such as
- * preferences and project proerties.
- *
- * @author Herlin
- * @version $Revision$ $Log$
- * @version $Revision: $ Revision 1.1 2006/05/22 21:37:36 phherlin
- * @version $Revision: $ Refactor the plug-in architecture to better support future evolutions
- * @version $Revision: $
- */
-
-public class PMDRuntimePlugin {
-
- public static final String PLUGIN_ID = PMDActivator.PLUGIN_ID;
-
- /**
- * Returns the shared instance.
- */
- public static PMDActivator getDefault() {
- return PMDActivator.getDefault();
- }
-
-}
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/builder/PMDBuilder.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/builder/PMDBuilder.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/builder/PMDBuilder.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -3,7 +3,7 @@
import java.util.Map;
import name.herlin.command.CommandException;
-import net.sourceforge.pmd.runtime.PMDRuntimePlugin;
+import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
import net.sourceforge.pmd.runtime.cmd.ReviewCodeCmd;
import org.apache.log4j.Logger;
@@ -82,7 +82,7 @@
log.warn("This kind of build is not supported : " + kind);
}
} catch (CommandException e) {
- throw new CoreException(new Status(IStatus.ERROR, PMDRuntimePlugin.getDefault().getBundle().getSymbolicName(), 0, e.getMessage(), e));
+ throw new CoreException(new Status(IStatus.ERROR, PMDPlugin.getDefault().getBundle().getSymbolicName(), 0, e.getMessage(), e));
}
log.info("Build done.");
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/AbstractDefaultCommand.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/AbstractDefaultCommand.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/AbstractDefaultCommand.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -39,7 +39,7 @@
import name.herlin.command.CommandException;
import net.sourceforge.pmd.PMD;
import net.sourceforge.pmd.SourceType;
-import net.sourceforge.pmd.runtime.PMDRuntimePlugin;
+import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
import net.sourceforge.pmd.runtime.preferences.IPreferences;
import org.apache.log4j.Logger;
@@ -298,7 +298,7 @@
} else {
throw new CommandException("The target JDK, " + compilerCompliance + " is not yet supported"); // TODO NLS
}
- final IPreferences preferences = PMDRuntimePlugin.getDefault().loadPreferences();
+ final IPreferences preferences = PMDPlugin.getDefault().loadPreferences();
if (preferences.isProjectBuildPathEnabled()) {
pmdEngine.setClassLoader(new JavaProjectClassLoader(pmdEngine.getClassLoader(), javaProject));
}
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/BaseVisitor.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/BaseVisitor.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/BaseVisitor.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -43,7 +43,7 @@
import net.sourceforge.pmd.RuleSet;
import net.sourceforge.pmd.RuleViolation;
import net.sourceforge.pmd.runtime.PMDRuntimeConstants;
-import net.sourceforge.pmd.runtime.PMDRuntimePlugin;
+import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
import net.sourceforge.pmd.runtime.preferences.IPreferences;
import net.sourceforge.pmd.runtime.properties.IProjectProperties;
import net.sourceforge.pmd.runtime.properties.PropertiesException;
@@ -364,7 +364,7 @@
final List reviewsList = findReviewedViolations(file);
final Review review = new Review();
final Iterator iter = context.getReport().iterator();
- final IPreferences preferences = PMDRuntimePlugin.getDefault().loadPreferences();
+ final IPreferences preferences = PMDPlugin.getDefault().loadPreferences();
final int maxViolationsPerFilePerRule = preferences.getMaxViolationsPerFilePerRule();
final Map violationsCounter = new HashMap();
@@ -466,9 +466,9 @@
// }
} catch (CoreException e) {
- PMDRuntimePlugin.getDefault().logError("Core Exception when searching reviewed violations", e);
+ PMDPlugin.getDefault().logError("Core Exception when searching reviewed violations", e);
} catch (IOException e) {
- PMDRuntimePlugin.getDefault().logError("IO Exception when searching reviewed violations", e);
+ PMDPlugin.getDefault().logError("IO Exception when searching reviewed violations", e);
}
return reviewsList;
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/BuildProjectCommand.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/BuildProjectCommand.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/BuildProjectCommand.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -36,7 +36,7 @@
package net.sourceforge.pmd.runtime.cmd;
import name.herlin.command.CommandException;
-import net.sourceforge.pmd.runtime.PMDRuntimePlugin;
+import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
import net.sourceforge.pmd.runtime.properties.IProjectProperties;
import net.sourceforge.pmd.runtime.properties.PropertiesException;
@@ -104,7 +104,7 @@
try {
this.project.build(IncrementalProjectBuilder.FULL_BUILD, this.getMonitor());
- final IProjectProperties properties = PMDRuntimePlugin.getDefault().loadProjectProperties(this.project);
+ final IProjectProperties properties = PMDPlugin.getDefault().loadProjectProperties(this.project);
properties.setNeedRebuild(false);
} catch (CoreException e) {
throw new CommandException(e);
Modified: trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/DetectCutAndPasteCmd.java
===================================================================
--- trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/DetectCutAndPasteCmd.java 2008-09-26 20:00:51 UTC (rev 6518)
+++ trunk/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/runtime/cmd/DetectCutAndPasteCmd.java 2008-09-26 20:34:37 UTC (rev 6519)
@@ -49,7 +49,7 @@
import net.sourceforge.pmd.cpd.LanguageFactory;
import net.sourceforge.pmd.cpd.Renderer;
import net.sourceforge.pmd.runtime.PMDRuntimeConstants;
-import net.sourceforge.pmd.runtime.PMDRuntimePlugin;
+import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
import net.sourceforge.pmd.runtime.properties.IProjectProperties;
import net.sourceforge.pmd.runtime.properties.PropertiesException;
@@ -124,9 +124,9 @@
final List files = findFiles();
if (files.size() == 0) {
- PMDRuntimePlugin.getDefault().logInformation("No files found to specified language.");
+ PMDPlugin.getDefault().logInformation("No files found to specified language.");
} else {
- PMDRuntimePlugin.getDefault().logInformation("Found " + files.size() + " files to the specified language. Performing CPD.");
+ PMDPlugin.getDefault().logInformation("Found " + files.size() + " files to the specified language. Performing CPD.");
}
setStepsCount(files.size());
beginTask("Finding suspect Cut And Paste", getStepsCount()*2);
@@ -174,7 +174,7 @@
this.setReportName(null);
this.setRenderer(null);
this.setLanguage("java");
- this.setMinTileSize(PMDRuntimePlugin.getDefault().loadPreferences().getMinTileSize());
+ this.setMinTileSize(PMDPlugin.getDefault().loadPreferences().getMinTileSize());
this.setCreateReport(false);
this.addPropertyListener(null);
this.listenerList = new ArrayList();
@@ -248,7 +248,7 @@
* @throws CoreException
*/
private List findFiles() throws PropertiesException, CoreException {
- final IProjectProperties properties = PMDRuntimePlugin.getDefault...
[truncated message content] |