Merge branch 'master' of github.com:pmd/pmd

This commit is contained in:
Romain PELISSE committed 2013-01-26 20:23:50 +01:00
commit 5ffb5bc8c2
91 files changed
+691 -6050

No files matched your search

-2
View File
@@ -1,2 +0,0 @@
http://cougaar.org/docman/view.php/17/58/license.html
-119
View File
@@ -1,119 +0,0 @@
#
# Plugin properties
#
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.name=PMDPlugin
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.author=Jiger Patel, Tom Copeland, Alan Ezust, Dale Anson
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.version=5.0.1
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.docs=doc/jedit.html
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.0=jdk 1.5
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.1=jedit 04.03.99.00
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.2=plugin errorlist.ErrorListPlugin 2.0
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.3=plugin CommonControlsPlugin 1.2
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.depend.3=plugin rhino.RhinoPlugin 1.7R4
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.jars=pmd-5.1.0.jar jaxen-1.1.1.jar asm-3.2.jar
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.description=The PMD plugin is a Java source code analysis tool.
#
# Menu properties
#
# set activate on startup so that PMD can check automatically on save. If the
# user unchecks the option to run on save, this setting will change to 'defer'.
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.activate=startup
# default is to run on save
pmd.runPMDOnSave=true
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.menu.label=$PMD
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.menu=pmd-check-current-buffer pmd-check-all-open-buffers pmd-check-directory pmd-clear-errorlist pmd-run-designer %pmd-cpd
pmd-cpd=cpd-currentfile cpd-dir
browser-pmd-cpd=cpd-currentfile cpd-dir cpd-dir-recursively
#Dockables and Menu Labels
pmd-check-current-buffer.label=Check current buffer
pmd-check-all-open-buffers.label=Check all open buffers
pmd-check-directory.label=Check all files in directory
pmd-check-directory-recursively.label=Check all files in directory recursively
pmd-clear-errorlist.label=Clear ErrorList
pmd-run-designer.label=Run Rule Designer
pmd-cpd.label=Detect Duplicate Code
browser-pmd-cpd.label=Detect Duplicate Code
cpd-currentfile.label=In Current File
cpd-dir.label=In Directory
cpd-dir-recursively.label=In Directory Recursively
pmd-check-file.label=Check selected file(s)
cpd-viewer.label=Copy/Paste Detector
#
# Option pane properties
#
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.option-group=pmd.general pmd.rules pmd.cpd.general
#plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.option-pane=pmd
options.pmd.general.label=PMD Settings
options.pmd.general.code=new net.sourceforge.pmd.jedit.PMDGeneralOptionPane()
options.pmd.rules.label=PMD Rules
options.pmd.rules.code=new net.sourceforge.pmd.jedit.PMDRulesOptionPane()
options.pmd.printRule=false
options.pmd.cpd.general.label=CPD Settings
options.pmd.cpd.general.code=new net.sourceforge.pmd.jedit.CPDOptionPane()
#Dockables properties.
cpd-viewer.title=Copy/Paste Detector
#FS Browser properties
plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.browser-menu=pmd-check-file pmd-check-directory pmd-check-directory-recursively %browser-pmd-cpd
#pmd properties
pmd.renderer=None
pmd.showprogress=true
pmd.progressbar.foreground=#000000
pmd.progressbar.background=#FFC800
# various strings
net.sf.pmd.CPD,_Select_File_Type=CPD, Select File Type
net.sf.pmd.CPD_does_not_yet_support_this_file_type>_=CPD does not yet support this file type:
net.sf.pmd.Cannot_run_CPD_on_Invalid_directory/files.=Cannot run CPD on Invalid directory/files.
net.sf.pmd.Clear_ErrorList_on_Save=Clear ErrorList on Save
net.sf.pmd.Copy/Paste_Detector=Copy/Paste Detector
net.sf.pmd.Copy/Paste_detection_can_not_be_performed_on_this_file\nbecause_the_mode_can_not_be_determined.=Copy/Paste detection can not be performed on this file\nbecause the mode can not be determined.
net.sf.pmd.Description=Description
net.sf.pmd.Error_Loading_Custom_Ruleset=Error Loading Custom Ruleset
net.sf.pmd.Error_Loading_Rules=Error Loading Rules
net.sf.pmd.Error_loading_rules._Check_any_custom_rulesets_for_errors.=Error loading rules. Check any custom rulesets for errors.
net.sf.pmd.Error_while_processing_=Error while processing
net.sf.pmd.Example=Example
net.sf.pmd.Exclusions=Exclusions
net.sf.pmd.Export_Output_as_=Export Output as:
net.sf.pmd.Ignore_Literals_&_identifiers_when_detecting_Duplicate_Code=Ignore Literals & identifiers when detecting Duplicate Code
net.sf.pmb.Inclustions=Inclusions
net.sf.pmd.Invalid_Renderer=Invalid Renderer
net.sf.pmd.Minimum_Tile_Size>=Minimum Tile Size:
net.sf.pmd.Minimum_Tile_size_>=Minimum Tile size :
net.sf.pmd.No_duplicates_found.=No duplicates found.
net.sf.pmd.No_problems_found=No problems found
net.sf.pmd.One_Directory_has_to_be_selected_in_which_to_detect_duplicate_code.=One Directory has to be selected in which to detect duplicate code.
net.sf.pmd.One_file_must_be_selected=One file must be selected
net.sf.pmd.PMD_Check_in_Progress=PMD Check in Progress
net.sf.pmd.PMD_General_Options=PMD General Options
net.sf.pmd.Please_see_http>//pmd.sf.net/_for_more_information=Please see http://pmd.sf.net/ for more information
net.sf.pmd.Print_Rulename_in_ErrorList=Print Rulename in ErrorList
net.sf.pmd.Recursive=Recursive
net.sf.pmd.Rules=Rules
net.sf.pmd.Run_PMD_on_Save=Run PMD on Save
net.sf.pmd.Select_default_rules=Select default rules
net.sf.pmd.Select_type_of_files_to_check>=Select type of files to check:
net.sf.pmd.Selected_file_cannot_be_a_Directory.=Selected file cannot be a Directory.
net.sf.pmd.Selected_file_must_be_a_Directory.=Selected file must be a Directory.
net.sf.pmd.Selection_must_be_a_directory=Selection must be a directory
net.sf.pmd.Selection_not_a_directory.=Selection not a directory.
net.sf.pmd.Show_PMD_Progress_Bar=Show PMD Progress Bar
net.sf.pmd.There_was_an_error_loading_one_or_more_custom_rulesets,_so_no_custom_rulesets_were_loaded=There was an error loading one or more custom rulesets, so no custom rulesets were loaded
net.sf.pmd.Unable_to_find_rulesets,_halting_PMD=Unable to find rulesets, halting PMD
-39
View File
@@ -1,39 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE ACTIONS SYSTEM "actions.dtd">
<ACTIONS>
<ACTION NAME="pmd-check-current-buffer">
<CODE>
net.sourceforge.pmd.jedit.PMDJEditPlugin.check(buffer, view);
</CODE>
</ACTION>
<ACTION NAME="pmd-check-all-open-buffers">
<CODE>
net.sourceforge.pmd.jedit.PMDJEditPlugin.checkAllOpenBuffers(view);
</CODE>
</ACTION>
<ACTION NAME="pmd-check-directory">
<CODE>
net.sourceforge.pmd.jedit.PMDJEditPlugin.checkDirectory(view);
</CODE>
</ACTION>
<ACTION NAME="pmd-clear-errorlist">
<CODE>
net.sourceforge.pmd.jedit.PMDJEditPlugin.clearErrorList();
</CODE>
</ACTION>
<ACTION NAME="pmd-run-designer">
<CODE>
net.sourceforge.pmd.jedit.PMDJEditPlugin.runDesigner();
</CODE>
</ACTION>
<ACTION NAME="cpd-currentfile">
<CODE>
net.sourceforge.pmd.jedit.PMDJEditPlugin.cpdCurrentFile(view);
</CODE>
</ACTION>
<ACTION NAME="cpd-dir">
<CODE>
net.sourceforge.pmd.jedit.PMDJEditPlugin.cpdDir(view);
</CODE>
</ACTION>
</ACTIONS>
-24
View File
@@ -1,24 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE ACTIONS SYSTEM "actions.dtd">
<ACTIONS>
<ACTION NAME="pmd-check-file">
<CODE>net.sourceforge.pmd.jedit.PMDJEditPlugin.checkFile(view,browser);</CODE>
</ACTION>
<ACTION NAME="pmd-check-directory">
<CODE>net.sourceforge.pmd.jedit.PMDJEditPlugin.checkDirectory(view, browser,false);</CODE>
</ACTION>
<ACTION NAME="pmd-check-directory-recursively">
<CODE>net.sourceforge.pmd.jedit.PMDJEditPlugin.checkDirectory(view, browser,true);</CODE>
</ACTION>
<ACTION NAME="cpd-currentfile">
<CODE>net.sourceforge.pmd.jedit.PMDJEditPlugin.cpdCurrentFile(view, browser);</CODE>
</ACTION>
<ACTION NAME="cpd-dir">
<CODE>net.sourceforge.pmd.jedit.PMDJEditPlugin.cpdDir(view,browser, false);</CODE>
</ACTION>
<ACTION NAME="cpd-dir-recursively">
<CODE>
net.sourceforge.pmd.jedit.PMDJEditPlugin.cpdDir(view,browser, true);
</CODE>
</ACTION>
</ACTIONS>
-82
View File
@@ -1,82 +0,0 @@
<project name="PMDPlugin" default="dist" basedir=".">
<!-- user defined build properties, these override any properties set below -->
<property file="build.properties"/>
<property file="../build.properties"/>
<!-- properties specific to this build file -->
<property name="build" location="build"/>
<property name="src" location="src"/>
<property name="lib" location="lib"/>
<!-- default location of jEdit installation containing jedit.jar -->
<property name="jedit.install.dir" location="../.."/>
<!-- default location of user folder containing plugin jars -->
<property name="install.dir" location="${user.home}/.jedit/jars"/>
<property name="jedit.plugins.dir" location="${install.dir}"/>
<!-- set up the classpath for the build -->
<path id="project.class.path">
<pathelement location="${jedit.install.dir}/jedit.jar"/>
<pathelement location="${jedit.plugins.dir}/ErrorList.jar"/>
<pathelement location="${jedit.plugins.dir}/CommonControls.jar"/>
<pathelement location="${jedit.plugins.dir}/kappalayout.jar"/>
<pathelement location="${build}"/>
<fileset casesensitive="false" id="pmd.libs" dir="${lib}">
<include name="*.jar"/>
</fileset>
</path>
<!-- might be able to auto-reload the plugin -->
<condition property="can.reload.plugins">
<and>
<available classname="org.gjt.sp.jedit.jEdit"/>
<available classname="ReloadPluginTask"/>
</and>
</condition>
<!-- Target: clean - delete the build directory contents -->
<target name="clean">
<delete dir="${build}"/>
<mkdir dir="${build}"/>
</target>
<!-- Target: compile -->
<target name="compile">
<mkdir dir="${build}"/>
<javac
srcdir="${src}"
destdir="${build}"
source="1.5"
target="1.5"
debug="on"
deprecation="on">
<classpath refid="project.class.path"/>
</javac>
</target>
<!-- Target: jar - create the plugin -->
<target name="dist" depends="compile">
<jar jarfile="${install.dir}/${ant.project.name}.jar">
<fileset dir="${build}"/>
<fileset dir="${basedir}">
<include name="*.props"/>
<include name="*.xml"/>
<include name="*.html"/>
<include name="doc/*"/>
</fileset>
</jar>
<copy todir="${install.dir}">
<fileset refid="pmd.libs" />
</copy>
<antcall target="reload"/>
</target>
<target name="reload" if="can.reload.plugins">
<echo>Reloading ${install.dir}/${ant.project.name}.jar</echo>
<taskdef name="reloadPlugin" classname="ReloadPluginTask"/>
<reloadPlugin jarfile="${install.dir}/${ant.project.name}.jar"/>
</target>
</project>
-238
View File
@@ -1,238 +0,0 @@
# select some default rules to help new users get started. The selected rules
# are those suggested by PMD best practices -- unused code, basic rules, some
# design rules, a few controversial rules, and imports rules.
options.pmd.rules.AbstractClassWithoutAbstractMethod=false
options.pmd.rules.AbstractClassWithoutAnyMethod=false
options.pmd.rules.AbstractNaming=false
options.pmd.rules.AccessorClassGeneration=false
options.pmd.rules.AddEmptyString=false
options.pmd.rules.AppendCharacterWithChar=true
options.pmd.rules.ArrayIsStoredDirectly=true
options.pmd.rules.AssignmentInOperand=false
options.pmd.rules.AssignmentToNonFinalStatic=false
options.pmd.rules.AtLeastOneConstructor=false
options.pmd.rules.AvoidAccessibilityAlteration=false
options.pmd.rules.AvoidArrayLoops=false
options.pmd.rules.AvoidAssertAsIdentifier=false
options.pmd.rules.AvoidCallingFinalize=false
options.pmd.rules.AvoidCatchingNPE=true
options.pmd.rules.AvoidCatchingThrowable=true
options.pmd.rules.AvoidConstantsInterface=false
options.pmd.rules.AvoidDecimalLiteralsInBigDecimalConstructor=true
options.pmd.rules.AvoidDeeplyNestedIfStmts=false
options.pmd.rules.AvoidDollarSigns=false
options.pmd.rules.AvoidDuplicateLiterals=true
options.pmd.rules.AvoidEnumAsIdentifier=false
options.pmd.rules.AvoidFieldNameMatchingMethodName=false
options.pmd.rules.AvoidFieldNameMatchingTypeName=false
options.pmd.rules.AvoidFinalLocalVariable=false
options.pmd.rules.AvoidInstanceofChecksInCatchClause=false
options.pmd.rules.AvoidInstantiatingObjectsInLoops=false
options.pmd.rules.AvoidMultipleUnaryOperators=true
options.pmd.rules.AvoidPrintStackTrace=false
options.pmd.rules.AvoidProtectedFieldInFinalClass=false
options.pmd.rules.AvoidReassigningParameters=false
options.pmd.rules.AvoidRethrowingException=true
options.pmd.rules.AvoidStringBufferField=true
options.pmd.rules.AvoidSynchronizedAtMethodLevel=false
options.pmd.rules.AvoidThreadGroup=true
options.pmd.rules.AvoidThrowingNewInstanceOfSameException=true
options.pmd.rules.AvoidThrowingNullPointerException=true
options.pmd.rules.AvoidThrowingRawExceptionTypes=true
options.pmd.rules.AvoidUsingHardCodedIP=true
options.pmd.rules.AvoidUsingNativeCode=false
options.pmd.rules.AvoidUsingOctalValues=true
options.pmd.rules.AvoidUsingShortType=false
options.pmd.rules.AvoidUsingVolatile=false
options.pmd.rules.BadComparison=false
options.pmd.rules.BeanMembersShouldSerialize=false
options.pmd.rules.BigIntegerInstantiation=true
options.pmd.rules.BooleanGetMethodName=false
options.pmd.rules.BooleanInstantiation=true
options.pmd.rules.BooleanInversion=false
options.pmd.rules.BrokenNullCheck=true
options.pmd.rules.ByteInstantiation=false
options.pmd.rules.CallSuperFirst=false
options.pmd.rules.CallSuperInConstructor=false
options.pmd.rules.CallSuperLast=false
options.pmd.rules.CheckResultSet=true
options.pmd.rules.ClassCastExceptionWithToArray=true
options.pmd.rules.ClassNamingConventions=false
options.pmd.rules.ClassWithOnlyPrivateConstructorsShouldBeFinal=false
options.pmd.rules.CloneMethodMustImplementCloneable=false
options.pmd.rules.CloneThrowsCloneNotSupportedException=false
options.pmd.rules.CloseResource=false
options.pmd.rules.CollapsibleIfStatements=true
options.pmd.rules.CompareObjectsWithEquals=false
options.pmd.rules.ConfusingTernary=false
options.pmd.rules.ConsecutiveLiteralAppends=true
options.pmd.rules.ConstructorCallsOverridableMethod=false
options.pmd.rules.CouplingBetweenObjects=false
options.pmd.rules.CyclomaticComplexity=false
options.pmd.rules.DataflowAnomalyAnalysis=false
options.pmd.rules.DefaultLabelNotLastInSwitchStmt=false
options.pmd.rules.DefaultPackage=false
options.pmd.rules.DoNotCallGarbageCollectionExplicitly=false
options.pmd.rules.DoNotCallSystemExit=false
options.pmd.rules.DoNotExtendJavaLangError=true
options.pmd.rules.DoNotThrowExceptionInFinally=true
options.pmd.rules.DoNotUseThreads=false
options.pmd.rules.DontImportJavaLang=true
options.pmd.rules.DontImportSun=false
options.pmd.rules.DoubleCheckedLocking=true
options.pmd.rules.DuplicateImports=true
options.pmd.rules.EmptyCatchBlock=true
options.pmd.rules.EmptyFinalizer=false
options.pmd.rules.EmptyFinallyBlock=true
options.pmd.rules.EmptyIfStmt=true
options.pmd.rules.EmptyInitializer=true
options.pmd.rules.EmptyMethodInAbstractClassShouldBeAbstract=false
options.pmd.rules.EmptyStatementNotInLoop=true
options.pmd.rules.EmptyStaticInitializer=true
options.pmd.rules.EmptySwitchStatements=true
options.pmd.rules.EmptySynchronizedBlock=true
options.pmd.rules.EmptyTryBlock=true
options.pmd.rules.EmptyWhileStmt=true
options.pmd.rules.EqualsNull=false
options.pmd.rules.ExceptionAsFlowControl=true
options.pmd.rules.ExcessiveClassLength=false
options.pmd.rules.ExcessiveImports=false
options.pmd.rules.ExcessiveMethodLength=false
options.pmd.rules.ExcessiveParameterList=false
options.pmd.rules.ExcessivePublicCount=false
options.pmd.rules.FinalFieldCouldBeStatic=false
options.pmd.rules.FinalizeDoesNotCallSuperFinalize=false
options.pmd.rules.FinalizeOnlyCallsSuperFinalize=false
options.pmd.rules.FinalizeOverloaded=false
options.pmd.rules.FinalizeShouldBeProtected=false
options.pmd.rules.ForLoopShouldBeWhileLoop=true
options.pmd.rules.ForLoopsMustUseBraces=false
options.pmd.rules.IdempotentOperations=false
options.pmd.rules.IfElseStmtsMustUseBraces=false
options.pmd.rules.IfStmtsMustUseBraces=false
options.pmd.rules.ImmutableField=false
options.pmd.rules.ImportFromSamePackage=true
options.pmd.rules.InefficientEmptyStringCheck=true
options.pmd.rules.InefficientStringBuffering=true
options.pmd.rules.InstantiationToGetClass=false
options.pmd.rules.InsufficientStringBufferDeclaration=true
options.pmd.rules.IntegerInstantiation=false
options.pmd.rules.JUnit4SuitesShouldUseSuiteAnnotation=false
options.pmd.rules.JUnit4TestShouldUseAfterAnnotation=false
options.pmd.rules.JUnit4TestShouldUseBeforeAnnotation=false
options.pmd.rules.JUnit4TestShouldUseTestAnnotation=false
options.pmd.rules.JUnitAssertionsShouldIncludeMessage=false
options.pmd.rules.JUnitSpelling=false
options.pmd.rules.JUnitStaticSuite=false
options.pmd.rules.JUnitTestsShouldIncludeAssert=false
options.pmd.rules.JUnitUseExpected=false
options.pmd.rules.JumbledIncrementer=true
options.pmd.rules.LocalHomeNamingConvention=false
options.pmd.rules.LocalInterfaceSessionNamingConvention=false
options.pmd.rules.LocalVariableCouldBeFinal=false
options.pmd.rules.LoggerIsNotStaticFinal=false
options.pmd.rules.LongInstantiation=false
options.pmd.rules.LongVariable=false
options.pmd.rules.LooseCoupling=false
options.pmd.rules.MDBAndSessionBeanNamingConvention=false
options.pmd.rules.MethodArgumentCouldBeFinal=false
options.pmd.rules.MethodNamingConventions=false
options.pmd.rules.MethodReturnsInternalArray=true
options.pmd.rules.MethodWithSameNameAsEnclosingClass=false
options.pmd.rules.MisleadingVariableName=false
options.pmd.rules.MisplacedNullCheck=true
options.pmd.rules.MissingBreakInSwitch=false
options.pmd.rules.MissingSerialVersionUID=false
options.pmd.rules.MissingStaticMethodInNonInstantiatableClass=false
options.pmd.rules.MoreThanOneLogger=false
options.pmd.rules.NPathComplexity=false
options.pmd.rules.NcssConstructorCount=false
options.pmd.rules.NcssMethodCount=false
options.pmd.rules.NcssTypeCount=false
options.pmd.rules.NoPackage=false
options.pmd.rules.NonCaseLabelInSwitchStatement=false
options.pmd.rules.NonStaticInitializer=false
options.pmd.rules.NonThreadSafeSingleton=false
options.pmd.rules.NullAssignment=false
options.pmd.rules.OnlyOneReturn=false
options.pmd.rules.OptimizableToArrayCall=false
options.pmd.rules.OverrideBothEqualsAndHashcode=true
options.pmd.rules.PackageCase=false
options.pmd.rules.PositionLiteralsFirstInComparisons=false
options.pmd.rules.PreserveStackTrace=false
options.pmd.rules.ProperCloneImplementation=false
options.pmd.rules.ProperLogger=false
options.pmd.rules.RemoteInterfaceNamingConvention=false
options.pmd.rules.RemoteSessionInterfaceNamingConvention=false
options.pmd.rules.ReplaceEnumerationWithIterator=false
options.pmd.rules.ReplaceHashtableWithMap=false
options.pmd.rules.ReplaceVectorWithList=false
options.pmd.rules.ReturnEmptyArrayRatherThanNull=false
options.pmd.rules.ReturnFromFinallyBlock=true
options.pmd.rules.ShortInstantiation=false
options.pmd.rules.ShortMethodName=false
options.pmd.rules.ShortVariable=false
options.pmd.rules.SignatureDeclareThrowsException=true
options.pmd.rules.SimpleDateFormatNeedsLocale=false
options.pmd.rules.SimplifyBooleanAssertion=false
options.pmd.rules.SimplifyBooleanExpressions=false
options.pmd.rules.SimplifyBooleanReturns=false
options.pmd.rules.SimplifyConditional=false
options.pmd.rules.SimplifyStartsWith=false
options.pmd.rules.SingularField=true
options.pmd.rules.StaticEJBFieldShouldBeFinal=false
options.pmd.rules.StringBufferInstantiationWithChar=true
options.pmd.rules.StringInstantiation=true
options.pmd.rules.StringToString=true
options.pmd.rules.SuspiciousConstantFieldName=false
options.pmd.rules.SuspiciousEqualsMethodName=false
options.pmd.rules.SuspiciousHashcodeMethodName=false
options.pmd.rules.SuspiciousOctalEscape=false
options.pmd.rules.SwitchDensity=false
options.pmd.rules.SwitchStmtsShouldHaveDefault=false
options.pmd.rules.SystemPrintln=false
options.pmd.rules.TestClassWithoutTestCases=false
options.pmd.rules.TooFewBranchesForASwitchStatement=false
options.pmd.rules.TooManyFields=false
options.pmd.rules.TooManyMethods=false
options.pmd.rules.TooManyStaticImports=true
options.pmd.rules.UncommentedEmptyConstructor=false
options.pmd.rules.UncommentedEmptyMethod=false
options.pmd.rules.UnconditionalIfStatement=true
options.pmd.rules.UnnecessaryBooleanAssertion=false
options.pmd.rules.UnnecessaryCaseChange=true
options.pmd.rules.UnnecessaryConstructor=false
options.pmd.rules.UnnecessaryConversionTemporary=true
options.pmd.rules.UnnecessaryFinalModifier=true
options.pmd.rules.UnnecessaryLocalBeforeReturn=false
options.pmd.rules.UnnecessaryParentheses=false
options.pmd.rules.UnnecessaryReturn=true
options.pmd.rules.UnnecessaryWrapperObjectCreation=false
options.pmd.rules.UnsynchronizedStaticDateFormatter=false
options.pmd.rules.UnusedFormalParameter=true
options.pmd.rules.UnusedImports=true
options.pmd.rules.UnusedLocalVariable=true
options.pmd.rules.UnusedModifier=false
options.pmd.rules.UnusedNullCheckInEquals=true
options.pmd.rules.UnusedPrivateField=true
options.pmd.rules.UnusedPrivateMethod=true
options.pmd.rules.UseArrayListInsteadOfVector=false
options.pmd.rules.UseArraysAsList=false
options.pmd.rules.UseAssertEqualsInsteadOfAssertTrue=false
options.pmd.rules.UseAssertNullInsteadOfAssertTrue=false
options.pmd.rules.UseAssertSameInsteadOfAssertTrue=false
options.pmd.rules.UseCollectionIsEmpty=false
options.pmd.rules.UseCorrectExceptionLogging=false
options.pmd.rules.UseEqualsToCompareStrings=true
options.pmd.rules.UseIndexOfChar=true
options.pmd.rules.UseLocaleWithCaseConversions=false
options.pmd.rules.UseNotifyAllInsteadOfNotify=false
options.pmd.rules.UseProperClassLoader=false
options.pmd.rules.UseSingleton=false
options.pmd.rules.UseStringBufferForStringAppends=false
options.pmd.rules.UseStringBufferLength=true
options.pmd.rules.UselessOperationOnImmutable=true
options.pmd.rules.UselessOverridingMethod=true
options.pmd.rules.UselessStringValueOf=true
options.pmd.rules.VariableNamingConventions=false
options.pmd.rules.WhileLoopsMustUseBraces=false
-3
View File
@@ -1,3 +0,0 @@
<html>
<p>PMD is a Java source code analysis tool - it checks your code for unused fields, empty try/catch/finally/if/while blocks, unused method parameters, and stuff like that. There's much more info at <a href="http://pmd.sf.net/">http://pmd.sf.net/</a>. Share and enjoy!</p>
</html>
-99
View File
@@ -1,99 +0,0 @@
2007-11-20 - 2.7
Changelog is now in ../jedit.html (the documentation). No need to duplicate
it, now is there?
10th January 2006 - 2.6O
- Updated to PMD 3.4
- Updated to jEdit 4.3pre3 version.
- Added "Ignore Literals & identifiers" option for CPD.
16th August 2004 - 2.5
- Updated to PMD 1.9
- Removed Recursive Directory options and integrated them into FileChooser itself.
- Complete redesign of the way PMD Rules and Copy/Paste Detector are used.
- Fixed improper highlighting of Rule Violations. Because of this bug, any open file in jEdit was showing errors of other files too.
- Lots of code cleanup and optimizations.
22 March 2004- 2.4
- Optimized usage of ErrorSource for faster Error Highlighting.
- Fixed Run on save running when the buffer is non-Java.
- Updated to pmd 1.6
- Added option to export PMD results to files in various formats such as HTML, XML, Text, CSV etc.
- Added a new feature to show Progressbar when working on Large file sets.
- Progressbar color configured via jEdit Properties.
- Improvements in Copy/Paste Detector
October 31st 2003 - 2.3
1. Updated to PMD 1.3
August 18th 2003 - 2.2
1. Updated to PMD 1.2.1
2. Updated to jEdit 4.2 API changes
3. Added PMD in jEdit's File System Browser Plugins Menu.
May 19th 2003 - 2.1:
Added "clear ErrorList" option - thanks to Randall Schultz for the suggestion.
Added "check all open buffers" option - thanks to Randall Schultz for the suggestion.
Added support to define Custom RuleSets thereby facilitating integration of Custom Rulesets with built-in rulesets & their independent development.
Added C/C++, PHP support to Copy/Paste Detector. Now you can find out duplicate code in your C/C++ & PHP code besides the usual Java code.
April 18 2003 - 2.0:
Jiger Patel integrated CPD functionality.
Upgraded to work with pmd-1.05.
March 24 2003 - 1.5:
Upgraded to work with pmd-1.04.
February 11 2003 - 1.4:
Upgraded to work with pmd-1.03.
January 24 2003 - 1.3:
Upgraded to work with pmd-1.02.
November 20 2002 - 1.2:
Added some more fixes from Jiger.
November 14 2002 - 1.1:
Added "directory popup option" feature; thanks to Jiger Patel for the suggestions.
November 7 2002 - 1.0:
Updated to use pmd-1.01.
October 4 2002 - 0.9:
Updated to use pmd-1.0rc3
Augst 16 2002 - 0.8:
Fixed GUI lockup problem
Added example text to option pane
Updated to use pmd-0.9
August 2 2002 - 0.7:
Updated to use pmd-0.8
Now individual rules can be selected
July 26 2002 - 0.6:
Updated to use pmd-0.7.
PMD can be run on 1) all files in a directory or 2) recursively into a directory tree.
Added some detail to the Options area.
July 22 2002 - 0.5:
Moved options into Global Options area and made them look nicer.
Cleaned up menus.
Cleaned up help text.
July 18 2002 - 0.4:
Updated to use pmd-0.6
Modified to use ErrorList plugin
Fixed bug - displayed a popup if no messages are found
July 12 2002 - 0.3:
Updated to use pmd-0.4.
Messages are displayed in a list.
July 9 2002 - 0.2:
Fixed bug - a message, not an empty box, is now displayed if no errors are found.
Added options pane so rulesets are selectable and selections are persistant.
July 8 2002 - 0.1:
Initial release
Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

File diff suppressed because it is too large. Load diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

-9
View File
@@ -1,9 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE DOCKABLES SYSTEM "dockables.dtd">
<DOCKABLES>
<DOCKABLE NAME="cpd-viewer">
new net.sourceforge.pmd.jedit.CPDDuplicateCodeViewer(view);
</DOCKABLE>
</DOCKABLES>
Binary file not shown.
Binary file not shown.
Binary file not shown.
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE SERVICES SYSTEM "services.dtd">
<SERVICES>
<!-- status bar widget for pmd -->
<SERVICE CLASS="org.gjt.sp.jedit.gui.statusbar.StatusWidgetFactory" NAME="pmd">
new net.sourceforge.pmd.jedit.PMDProgressWidgetFactory();
</SERVICE>
</SERVICES>
@@ -1,39 +0,0 @@
package net.sourceforge.pmd.jedit;
import java.io.*;
import net.sourceforge.pmd.util.datasource.DataSource;
import org.gjt.sp.jedit.Buffer;
/**
* A datasource that uses a Buffer as the source for the bytes.
*/
public class BufferDataSource implements DataSource {
Buffer buffer = null;
/**
* @param buffer The buffer to use as the data source.
*/
public BufferDataSource(Buffer buffer) {
if (buffer == null) {
throw new IllegalArgumentException("buffer is not allowed to be null");
}
this.buffer = buffer;
}
/**
* @return A buffered input stream containing the contents of the given buffer.
*/
public InputStream getInputStream() {
return new BufferedInputStream(new ByteArrayInputStream(buffer.getText().getBytes()));
}
/**
* @param shortNames Not used.
* @param inputFileName Not used.
* @return The path and file name of the buffer, as returned by <code>Buffer.getPath()</code>.
*/
public String getNiceFileName(boolean shortNames, String inputFileName) {
return buffer.getPath();
}
}
@@ -1,203 +0,0 @@
package net.sourceforge.pmd.jedit;
// Imports
import org.gjt.sp.jedit.Buffer;
import org.gjt.sp.jedit.View;
import org.gjt.sp.jedit.io.VFSManager;
import org.gjt.sp.jedit.jEdit;
import org.gjt.sp.jedit.textarea.Selection;
import org.gjt.sp.jedit.browser.VFSBrowser;
import org.gjt.sp.jedit.GUIUtilities;
import java.awt.event.*;
import java.io.*;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;
import java.awt.BorderLayout;
// End of Imports
/**
* A GUI Component to display Duplicate code.
*
* @created 05 Apr 2003
* @author Jiger Patel
*
*/
public class CPDDuplicateCodeViewer extends JPanel {
JTree tree;
DefaultTreeModel treeModel = new DefaultTreeModel(new DefaultMutableTreeNode("CPD Results", true));
View view;
public CPDDuplicateCodeViewer(View view) {
this.view = view;
setLayout(new BorderLayout());
tree = new JTree(treeModel);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
if (node != null && node.isLeaf() && node instanceof Duplicate) {
Duplicate duplicate = (Duplicate) node;
gotoDuplicate(duplicate);
}
}
}
);
add(new JScrollPane(tree));
JButton saveBtn = new JButton("Save");
JPanel btnPanel = new JPanel();
btnPanel.add(saveBtn);
add(btnPanel, BorderLayout.SOUTH);
saveBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
String[] dirs = GUIUtilities.showVFSFileDialog(CPDDuplicateCodeViewer.this.view, System.getProperty("user.home"), VFSBrowser.SAVE_DIALOG, false);
if (dirs != null && dirs.length > 0) {
String filename = dirs[0];
File f = new File(filename);
writeTree(f);
}
}
}
);
}
public void refreshTree() {
treeModel.reload();
}
private void writeTree(File file) {
try {
String output = getTreeAsText();
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(output);
writer.close();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
private String getTreeAsText() {
StringBuilder sb = new StringBuilder(128);
sb.append("CPD Results\n");
DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot();
for (int i = 0; i < root.getChildCount(); i++) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode) root.getChildAt(i);
sb.append(child.toString()).append('\n');
for (int j = 0; j < child.getChildCount(); j++) {
sb.append('\t').append(child.getChildAt(j)).append('\n');
}
}
return sb.toString();
}
public void gotoDuplicate(final Duplicate duplicate) {
if (duplicate != null) {
final Buffer buffer = jEdit.openFile(view, duplicate.getFilename());
VFSManager.runInAWTThread(new Runnable() {
public void run() {
view.setBuffer(buffer);
int start = buffer.getLineStartOffset(duplicate.getBeginLine() - 1);
int end = buffer.getLineEndOffset(Math.min(duplicate.getEndLine(), buffer.getLineCount() - 1));
// Log.log(Log.DEBUG, this.getClass(), "Start Line "+ duplicate.getBeginLine() + " End Line "+ duplicate.getEndLine() + " Start " + start + " End "+ end);
// Since an AIOOB Exception is thrown if the end is the end of file. we do a -1 from end to fix it.
view.getTextArea().setSelection(new Selection.Range(start, end - 1));
view.getTextArea().moveCaretPosition(start);
}
}
);
}
}
public DefaultMutableTreeNode getRoot() {
return (DefaultMutableTreeNode) treeModel.getRoot();
}
public void addDuplicates(Duplicates duplicates) {
// System.out.println("Inside addDuplicates " + duplicates +" Root child count "+ treeModel.getChildCount(treeModel.getRoot()));
getRoot().add(duplicates);
// vecDuplicates.addElement(duplicates);
}
public class Duplicates extends DefaultMutableTreeNode {
// List vecduplicate = new ArrayList();
String message, sourcecode;
public Duplicates(String message, String sourcecode) {
this.message = message;
this.sourcecode = sourcecode;
}
public String getSourceCode() {
return sourcecode;
}
public void addDuplicate(Duplicate duplicate) {
add(duplicate);
// vecduplicate.addElement(duplicate);
}
public String toString() {
return message;
}
}
public class Duplicate extends DefaultMutableTreeNode {
private final String filename;
private final int beginLine, endLine;
public Duplicate(String filename, int beginLine, int endLine) {
this.filename = filename;
this.beginLine = beginLine;
this.endLine = endLine;
}
public String getFilename() {
return filename;
}
public int getBeginLine() {
return beginLine;
}
public int getEndLine() {
return endLine;
}
public String toString() {
return filename + ":" + (getBeginLine()) + "-" + (getEndLine());
}
}
public void expandAll() {
int row = 0;
while (row < tree.getRowCount()) {
tree.expandRow(row);
row++;
}
}
public void collapseAll() {
int row = tree.getRowCount() - 1;
while (row >= 0) {
tree.collapseRow(row);
row--;
}
}
public void clearDuplicates() {
getRoot().removeAllChildren();
}
}
@@ -1,127 +0,0 @@
package net.sourceforge.pmd.jedit;
import java.io.File;
import java.util.regex.*;
import javax.swing.filechooser.FileFilter;
import org.gjt.sp.util.Log;
/**
* This is a file filter for CPD. I wanted to use a FileNameExtension filter, but
* Java 1.5 doesn't have a FileNameExtensionFilter, so this one is pretty close.
* One difference is I've added "mode" as a parameter to the constructor to make
* it easy to match a filter against a supported language in CPD.
*/
public class CPDFileFilter extends FileFilter implements Comparable<CPDFileFilter>, java.io.FilenameFilter {
private String mode;
private String description;
private String[] extensions;
private Pattern inclusionsPattern = null;
private Pattern exclusionsPattern = null;
/**
* @param mode A language known to CPD. So far, these line up nicely with
* the mode names in jEdit, e.g. "java" = "java".
* @param description Some text to show in the "Files of Type" drop down in
* a JFileChooser.
* @param extensions A list of file name extensions supported by this filter.
*/
public CPDFileFilter(String mode, String description, String... extensions) {
this.mode = mode;
this.description = description;
this.extensions = extensions;
}
public void setInclusions(String regex) {
if (regex != null && regex.length() > 0) {
inclusionsPattern = Pattern.compile(regex);
}
}
public void setExclusions(String regex) {
if (regex != null && regex.length() > 0) {
exclusionsPattern = Pattern.compile(regex);
}
}
/**
* @param f A file to check to see if this filter will accept it.
* @return true if the file is acceptable.
*/
public boolean accept(File f) {
if (f == null) {
return false;
}
// always accept directories so JFileChooser works correctly
if (f.isDirectory()) {
return true;
}
// check full path for inclusions
if (inclusionsPattern != null) {
Matcher m = inclusionsPattern.matcher(f.getAbsolutePath());
if (!m.matches()) {
return false;
}
}
// check full path for exclusions
if (exclusionsPattern != null) {
Matcher m = exclusionsPattern.matcher(f.getAbsolutePath());
if (m.matches()) {
return false;
}
}
Log.log(Log.DEBUG, this, "CPD checking: " + f.getAbsolutePath());
// check the extension against acceptable extensions
String name = f.getName();
for (String ext : extensions) {
// The CPD file filter converts all extensions to upper case
if (name.toUpperCase().endsWith(ext)) {
return true;
}
}
// no match
return false;
}
public boolean accept(File dir, String name) {
return accept(new File(dir, name));
}
public String getDescription() {
return description;
}
public String getMode() {
return mode;
}
public String[] getExtensions() {
return extensions; // NOPMD
}
public int compareTo(CPDFileFilter filter) {
if (filter == null) {
return -1;
}
return toString().compareTo(filter.toString());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(description);
sb.append(" (");
for (String s : extensions) {
sb.append(s).append(',');
}
sb.deleteCharAt(sb.lastIndexOf(","));
sb.append(')');
return sb.toString();
}
}
@@ -1,113 +0,0 @@
/*
* User: tom
* Date: Jul 8, 2002
* Time: 4:29:19 PM
*/
package net.sourceforge.pmd.jedit;
import org.gjt.sp.jedit.AbstractOptionPane;
import org.gjt.sp.jedit.OptionPane;
import org.gjt.sp.jedit.jEdit;
import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.text.AbstractDocument;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.DocumentFilter;
import javax.swing.text.DocumentFilter.FilterBypass;
import ise.java.awt.KappaLayout;
public class CPDOptionPane extends AbstractOptionPane implements OptionPane {
private JCheckBox chkIgnoreLiterals;
JTextField txtMinTileSize;
JComboBox comboRenderer;
public CPDOptionPane() {
super(PMDJEditPlugin.NAME);
}
public void _init() {
removeAll();
setLayout(new FlowLayout(FlowLayout.LEFT));
JPanel panel = new JPanel(new KappaLayout());
panel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
JLabel title = new JLabel("<html><b>" + jEdit.getProperty("cpd-viewer.label", "Copy/Paste Detector"));
chkIgnoreLiterals = new JCheckBox(jEdit.getProperty("net.sf.pmd.Ignore_Literals_&_identifiers_when_detecting_Duplicate_Code", "Ignore Literals & identifiers when detecting Duplicate Code"), jEdit.getBooleanProperty(PMDJEditPlugin.IGNORE_LITERALS));
JLabel lblMinTileSize = new JLabel(jEdit.getProperty("net.sf.pmd.Minimum_Tile_Size>", "Minimum Tile Size:"));
// TODO: add a document that only accepts numbers
txtMinTileSize = new JTextField(jEdit.getProperty(PMDJEditPlugin.DEFAULT_TILE_MINSIZE_PROPERTY, "100"), 5);
((AbstractDocument) txtMinTileSize.getDocument()).setDocumentFilter(new NumericDocumentFilter());
JLabel lblRenderer = new JLabel(jEdit.getProperty("net.sf.pmd.Export_Output_as_", "Export output as: "));
comboRenderer = new JComboBox(new String [] { "None", "Text", "Html", "XML", "CSV"} );
comboRenderer.setSelectedItem(jEdit.getProperty(PMDJEditPlugin.RENDERER));
panel.add("0, 0, 2, 1, W, w, 3", title);
panel.add("0, 1, 2, 1, W, w, 3", chkIgnoreLiterals);
panel.add("0, 2, 1, 1, W, w, 3", lblMinTileSize);
panel.add("1, 2, 1, 1, W, w, 3", txtMinTileSize);
panel.add("0, 3, 1, 1, W, w, 3", lblRenderer);
panel.add("1, 3, 1, 1, W, w, 3", comboRenderer);
add(panel);
}
public void _save() {
jEdit.setBooleanProperty(PMDJEditPlugin.IGNORE_LITERALS, chkIgnoreLiterals.isSelected());
jEdit.setIntegerProperty(PMDJEditPlugin.DEFAULT_TILE_MINSIZE_PROPERTY, (txtMinTileSize.getText().length() == 0) ? 100 : Integer.parseInt(txtMinTileSize.getText()));
jEdit.setProperty(PMDJEditPlugin.RENDERER, (String) comboRenderer.getSelectedItem());
}
class NumericDocumentFilter extends DocumentFilter {
public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException {
if (string == null) {
return ;
}
if (isNumeric(string)) {
super.insertString(fb, offset, string, attr);
}
}
public void remove(DocumentFilter.FilterBypass fb, int offset, int length) throws BadLocationException {
super.remove(fb, offset, length);
}
public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException {
if (text == null) {
return ;
}
if (isNumeric(text)) {
super.replace(fb, offset, length, text, attrs);
}
}
private boolean isNumeric(String string) {
for (char c : string.toCharArray()) {
if (! Character.isDigit(c)) {
return false;
}
}
return true;
}
}
}
@@ -1,76 +0,0 @@
package net.sourceforge.pmd.jedit;
import java.io.IOException;
import java.util.Iterator;
import net.sourceforge.pmd.RuleViolation;
import net.sourceforge.pmd.renderers.AbstractIncrementingRenderer;
import org.gjt.sp.jedit.jEdit;
import errorlist.DefaultErrorSource;
import errorlist.ErrorSource;
/**
* Renderer to ErrorList.
*/
public class ErrorListRenderer extends AbstractIncrementingRenderer {
public static final String NAME = "errorlist";
DefaultErrorSource errorSource = null;
/**
* @param errorSource The error source to send errors to.
*/
public ErrorListRenderer( DefaultErrorSource errorSource ) {
super( NAME, "ErrorList" );
this.errorSource = errorSource;
// nothing will ever be written to this writer
setWriter(new NullWriter());
}
/**
* @return Always returns an empty string.
*/
public String defaultFileExtension() {
return "";
}
/**
* Does nothing.
*/
@Override
public void start() throws IOException {
}
/**
* Sends the rule violations to the ErrorList plugin.
*/
@Override
public void renderFileViolations( Iterator<RuleViolation> violations ) throws IOException {
if (!violations.hasNext()) {
errorSource.clear();
return;
}
String rulename = "";
final boolean showRuleName = jEdit.getBooleanProperty( PMDJEditPlugin.PRINT_RULE );
while ( violations.hasNext() ) {
RuleViolation violation = violations.next();
if ( showRuleName ) {
rulename = violation.getRule().getName() + "->";
}
// error list doesn't handle multi-line errors, so in the case of a
// multi-line violation, use 0 for the start and end columns. ErrorList
// will mark the entire line as an error.
int startLine = violation.getBeginLine() - 1;
int startColumn = violation.getBeginLine() == violation.getEndLine() ? violation.getBeginColumn() - 1: 0;
int endColumn = violation.getBeginLine() == violation.getEndLine() ? violation.getEndColumn() : 0;
errorSource.addError( new DefaultErrorSource.DefaultError( errorSource, ErrorSource.WARNING, violation.getFilename(), startLine, startColumn, endColumn, rulename + violation.getDescription() ) ); // NOPMD
}
}
}
@@ -1,68 +0,0 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.jedit;
import java.io.*;
import net.sourceforge.pmd.util.datasource.DataSource;
/**
* DataSource implementation to read data from a file. This one is different than
* the one provided by PMD in that it uses buffering and gives access to the file
* directly.
*/
public class FileDataSource implements DataSource {
private static final String FILE_SEPARATOR = System.getProperty("file.separator");
private File file;
/**
* @param file the file to read
*/
public FileDataSource(File file) {
this.file = file;
}
public InputStream getInputStream() throws IOException {
return new BufferedInputStream(new FileInputStream(file));
}
public void setFile(File file) {
this.file = file;
}
public File getFile() {
return file;
}
public String getNiceFileName(boolean shortNames, String inputFileName) {
return glomName(shortNames, inputFileName, file);
}
private String glomName(boolean shortNames, String inputFileName, File file) {
if (shortNames && inputFileName.indexOf(',') == -1) {
if (new File(inputFileName).isDirectory()) {
return trimAnyPathSep(file.getAbsolutePath().substring(inputFileName.length()));
} else {
if (inputFileName.indexOf(FILE_SEPARATOR.charAt(0)) == -1) {
return inputFileName;
}
return trimAnyPathSep(inputFileName.substring(inputFileName.lastIndexOf(FILE_SEPARATOR)));
}
}
try {
return file.getCanonicalFile().getAbsolutePath();
} catch (Exception e) {
return file.getAbsolutePath();
}
}
private String trimAnyPathSep(String name) {
return name.startsWith(FILE_SEPARATOR) ?
name.substring(1) :
name;
}
}
@@ -1,22 +0,0 @@
package net.sourceforge.pmd.jedit;
import java.io.Writer;
import java.io.IOException;
/**
* A bottomless sink. This writer doesn't write anything, it simply ignores any
* input to any method. No exceptions will actually be thrown from this class.
* This is useful for situations where a writer is required, but there isn't any
* need to actually do any writing.
*/
public class NullWriter extends Writer {
public void close() throws IOException {
}
public void flush() throws IOException {
}
public void write(char[] buffer, int offset, int length) throws IOException {
}
}
@@ -1,72 +0,0 @@
/*
* User: tom
* Date: Jul 8, 2002
* Time: 4:29:19 PM
*/
package net.sourceforge.pmd.jedit;
import org.gjt.sp.jedit.AbstractOptionPane;
import org.gjt.sp.jedit.OptionPane;
import org.gjt.sp.jedit.jEdit;
import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import ise.java.awt.KappaLayout;
public class PMDGeneralOptionPane extends AbstractOptionPane implements OptionPane {
private JCheckBox chkRunPMDOnSave, chkClearErrorListOnSave, chkShowProgressBar, chkPrintRule;
public PMDGeneralOptionPane() {
super( PMDJEditPlugin.NAME );
}
public void _init() {
removeAll();
setLayout(new FlowLayout(FlowLayout.LEFT));
JPanel panel = new JPanel(new KappaLayout());
panel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
JLabel title = new JLabel("<html><b>" + jEdit.getProperty("options.pmd.general.label", "PMD Settings"));
chkRunPMDOnSave = new JCheckBox( jEdit.getProperty("net.sf.pmd.Run_PMD_on_Save", "Run PMD on Save"), jEdit.getBooleanProperty( PMDJEditPlugin.RUN_PMD_ON_SAVE ) );
chkClearErrorListOnSave = new JCheckBox( jEdit.getProperty("net.sf.pmd.Clear_ErrorList_on_Save", "Clear ErrorList on Save"), jEdit.getBooleanProperty( PMDJEditPlugin.CLEAR_ERRORLIST_ON_SAVE ) );
chkPrintRule = new JCheckBox( jEdit.getProperty("net.sf.pmd.Print_Rulename_in_ErrorList", "Print Rulename in ErrorList"), jEdit.getBooleanProperty( PMDJEditPlugin.PRINT_RULE ) );
chkShowProgressBar = new JCheckBox( jEdit.getProperty("net.sf.pmd.Show_PMD_Progress_Bar", "Show PMD Progress Bar"), jEdit.getBooleanProperty( PMDJEditPlugin.SHOW_PROGRESS ) );
panel.add("0, 0, 1, 1, W, w, 3", title);
panel.add("0, 1, 1, 1, W, w, 3", chkRunPMDOnSave);
panel.add("0, 2, 1, 1, W, w, 3", chkClearErrorListOnSave);
panel.add("0, 3, 1, 1, W, w, 3", chkPrintRule);
panel.add("0, 4, 1, 1, W, w, 3", chkShowProgressBar);
add( panel );
}
public void _save() {
// If the user has checked "Run PMD on save", set the plugin to load on jEdit
// start up so that the "run on save" feature works right away. Unchecking
// "Run PMD on save" sets the "activate" property back to "defer", which is
// the default.
boolean on_save = chkRunPMDOnSave.isSelected();
jEdit.setBooleanProperty( PMDJEditPlugin.RUN_PMD_ON_SAVE, on_save );
jEdit.setProperty( "plugin.net.sourceforge.pmd.jedit.PMDJEditPlugin.activate", on_save ? "startup" : "defer" );
jEdit.setBooleanProperty( PMDJEditPlugin.CLEAR_ERRORLIST_ON_SAVE, chkClearErrorListOnSave.isSelected() );
jEdit.setBooleanProperty( PMDJEditPlugin.PRINT_RULE, chkPrintRule.isSelected() );
// adjust the status bar to show or hide the pmd progress widget. 'addProgressBar()'
// uses the SHOW_PROGRESS to decide if the bar should actually be shown.
jEdit.setBooleanProperty( PMDJEditPlugin.SHOW_PROGRESS, chkShowProgressBar.isSelected() );
PMDJEditPlugin.addProgressBar();
}
}
File diff suppressed because it is too large. Load diff
@@ -1,113 +0,0 @@
package net.sourceforge.pmd.jedit;
import org.gjt.sp.jedit.gui.statusbar.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import javax.swing.JComponent;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
import org.gjt.sp.jedit.View;
/**
* A progress bar for PMD to display when processing multiple files. Increments
* the progress bar as each file is processed.
*/
public class PMDProgressWidgetFactory implements StatusWidgetFactory {
HashMap<View, ProgressWidget> cache = new HashMap<View, ProgressWidget>();
public Widget getWidget( View view ) {
ProgressWidget widget = cache.get( view );
if ( widget == null ) {
widget = new ProgressWidget();
cache.put( view, widget );
}
widget.setVisible( true );
return widget;
}
/**
* Sets the maximum value for the progress bar displayed for the given view.
* @param view The View displaying the progress bar.
* @param max The number of files to be processed.
*/
public void setBounds( View view, int max ) {
ProgressWidget widget = cache.get( view );
if ( widget == null ) {
return;
}
widget.setMaximum( max );
}
public class ProgressWidget implements Widget, PropertyChangeListener {
JProgressBar progressBar = null;
public ProgressWidget() {
progressBar = new JProgressBar(0, 0 );
progressBar.setValue(0 );
progressBar.setString( "" );
progressBar.setStringPainted( true );
progressBar.setVisible(false);
}
public JComponent getComponent() {
return progressBar;
}
public void update() {
SwingUtilities.invokeLater( new Runnable() {
public void run() {
progressBar.setValue( progressBar.getValue() + 1 );
progressBar.setString( String.valueOf( ( int ) ( 100 * progressBar.getValue() / progressBar.getMaximum() ) ) + '%' );
}
} );
}
/**
* Calls <code>update</code>. For use by a SwingWorker.
* @param event Not used.
*/
public void propertyChange( PropertyChangeEvent event ) {
update();
}
/**
* Not used.
*/
public void propertiesChanged() {
}
public void setMaximum( int max ) {
progressBar.setMaximum( max );
}
public void complete() {
progressBar.setValue( progressBar.getMaximum() - 1 );
update();
int delay = 2000;
ActionListener timerTask = new ActionListener() {
public void actionPerformed( ActionEvent ae ) {
SwingUtilities.invokeLater( new Runnable() {
public void run() {
progressBar.setVisible( false );
}
} );
}
};
javax.swing.Timer timer = new javax.swing.Timer( delay, timerTask );
timer.setRepeats( false );
timer.start();
}
public void setVisible( boolean visible ) {
progressBar.setVisible( visible );
}
}
}
File diff suppressed because it is too large. Load diff
Loaded 30 of 91 files, more files were not shown because too many files have changed in this diff. Show more