Applied patch 716247 (adapt to 3.5 API changes).

This makes the code on trunk incompatible with the latest stable version
of Netbeans (3.4.1). Compatibility with that version is maintained on
branch NB_3_5_COMPATIBLE (which in turn is not compatible with NB 3.5)


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1734 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Gunnlaugur Thor Briem
2003-04-11 01:16:12 +00:00
parent f65bbe7604
commit 8acbeb28e6
4 changed files with 27 additions and 17 deletions

View File

@ -4,8 +4,12 @@
<javac debug="on" debuglevel="source,lines" deprecation="on" destdir="build/classes" srcdir="src">
<include name="**/*.java"/>
<classpath>
<!-- Copy this from the netbeans installation directory -->
<!-- Copy this one from the netbeans/lib directory -->
<pathelement path="lib/openide.jar"/>
<!-- Copy these three from the netbeans/modules/autoload directory -->
<pathelement path="lib/openide-io.jar"/>
<pathelement path="lib/java-api.jar"/>
<pathelement path="lib/java-src-model.jar"/>
<pathelement path="lib/pmd-1.04.jar"/>
<pathelement path="lib/jakarta-oro-2.0.jar"/>
</classpath>
@ -27,7 +31,7 @@
</jar>
</target>
<target depends="jars" description="Prepare the module for distribution via Auto Update." name="nbm">
<taskdef classname="org.netbeans.nbbuild.MakeNBM" classpath="lib\nbantext.jar" name="makenbm"/>
<taskdef classname="org.netbeans.nbbuild.MakeNBM" classpath="lib/nbantext.jar" name="makenbm"/>
<mkdir dir="build/temp_distribution/netbeans/modules/ext"/>
<copy file="build/pmd.jar" tofile="build/temp_distribution/netbeans/modules/pmd.jar"/>
<copy file="lib/pmd-1.04.jar" tofile="build/temp_distribution/netbeans/modules/ext/pmd-1.04.jar"/>
@ -45,7 +49,7 @@
</makenbm>
</target>
<target depends="clean, nbm" description="Builds the distribution" name="distribution">
<zip compress="true" destfile="build\pmd-netbeans-src-${VERSION}.zip">
<zip compress="true" destfile="build/pmd-netbeans-src-${VERSION}.zip">
<zipfileset dir=".">
<include name="*.txt"/>
<include name="build.xml"/>
@ -57,13 +61,13 @@
<include name="lib/jakarta-oro-2.0.jar"/>
<exclude name="**/.nbattrs"/>
</zipfileset>
<zipfileset dir="." fullpath="pmd.nbm" includes="build\pmd.nbm"/>
<zipfileset dir="." fullpath="pmd.nbm" includes="build/pmd.nbm"/>
</zip>
<zip compress="true" destfile="build\pmd-netbeans-bin-${VERSION}.zip">
<zip compress="true" destfile="build/pmd-netbeans-bin-${VERSION}.zip">
<zipfileset dir=".">
<include name="*.txt"/>
</zipfileset>
<zipfileset dir="." fullpath="pmd.nbm" includes="build\pmd.nbm"/>
<zipfileset dir="." fullpath="pmd.nbm" includes="build/pmd.nbm"/>
</zip>
</target>
<target description="Clean all build products." name="clean">

View File

@ -4,8 +4,9 @@ Created-By: Ole-Martin M
Class-Path: ext/pmd-1.04.jar ext/jaxen-core-1.0-fcs.jar ext/saxpath-1.0-fcs.jar ext/jakarta-oro-2.0.jar
OpenIDE-Module: pmd
OpenIDE-Module-Layer: pmd/mf-layer.xml
OpenIDE-Module-IDE-Dependencies: IDE/1 > 2.23
OpenIDE-Module-IDE-Dependencies: IDE/1 > 3.14
OpenIDE-Module-Localizing-Bundle: pmd/Bundle.properties
OpenIDE-Module-Module-Dependencies: org.openide.io, org.openide.src, org.netbeans.api.java/1
Name: pmd/RunPMDAction.class
OpenIDE-Module-Class: Action

View File

@ -26,7 +26,7 @@
*/
package pmd;
import org.openide.TopManager;
import org.openide.awt.StatusDisplayer;
import org.openide.cookies.LineCookie;
import org.openide.loaders.DataObject;
import org.openide.text.Line;
@ -89,7 +89,7 @@ public class PMDOutputListener implements OutputListener {
annotation.attach( line );
line.addPropertyChangeListener( annotation );
line.show( Line.SHOW_GOTO );
TopManager.getDefault().setStatusText( msg );
StatusDisplayer.getDefault().setStatusText( msg );
}
public void addAnnotation() {

View File

@ -45,8 +45,9 @@ import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.RuleSet;
import net.sourceforge.pmd.RuleViolation;
import org.netbeans.api.java.classpath.ClassPath;
import org.openide.ErrorManager;
import org.openide.TopManager;
import org.openide.awt.StatusDisplayer;
import org.openide.cookies.EditorCookie;
import org.openide.cookies.LineCookie;
import org.openide.cookies.SourceCookie;
@ -55,8 +56,10 @@ import org.openide.loaders.DataFolder;
import org.openide.loaders.DataObject;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.actions.CookieAction;
import org.openide.windows.IOProvider;
import org.openide.windows.InputOutput;
import org.openide.windows.TopComponent;
@ -145,10 +148,11 @@ public class RunPMDAction extends CookieAction {
PMD pmd = new PMD();
ArrayList list = new ArrayList( 100 );
for( int i = 0; i < dataobjects.size(); i++ ) {
TopManager.getDefault().setStatusText(
StatusDisplayer.getDefault().setStatusText(
"PMD checking for rule violations, " + ( i + 1 ) + "/" + ( dataobjects.size() ) );
DataObject dataobject = ( DataObject )dataobjects.get( i );
String name = dataobject.getPrimaryFile().getPackageName( '.' );
FileObject fobj = dataobject.getPrimaryFile();
String name = ClassPath.getClassPath( fobj, ClassPath.COMPILE ).getResourceName( fobj, '.', false );
//The file is not a java file
if( !dataobject.getPrimaryFile().hasExt( "java" ) || dataobject.getCookie( LineCookie.class ) == null ) {
@ -197,15 +201,16 @@ public class RunPMDAction extends CookieAction {
listener.detach();
FaultRegistry.getInstance().clearRegistry();
try {
TopManager.getDefault().setStatusText( "PMD checking for rule violations" );
StatusDisplayer.getDefault().setStatusText( "PMD checking for rule violations" );
List list = getDataObjects( node );
List violations = checkCookies( list );
IOProvider ioProvider = (IOProvider)Lookup.getDefault().lookup( IOProvider.class );
InputOutput io = ioProvider.getIO( "PMD output", false );
if( violations.isEmpty() ) {
TopManager.getDefault().setStatusText( "PMD found no rule violations" );
TopManager.getDefault().getIO( "PMD output", false ).closeInputOutput();
StatusDisplayer.getDefault().setStatusText( "PMD found no rule violations" );
io.closeInputOutput();
}
else {
InputOutput io = TopManager.getDefault().getIO( "PMD output", false );
io.select();
io.getOut().reset();
for( int i = 0; i < violations.size(); i++ ) {
@ -217,7 +222,7 @@ public class RunPMDAction extends CookieAction {
io.getOut().println( String.valueOf( fault ), listener );
}
}
TopManager.getDefault().setStatusText( "PMD found rule violations" );
StatusDisplayer.getDefault().setStatusText( "PMD found rule violations" );
}
}