forked from phoedos/pmd
release preps
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1475 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@@ -46,12 +46,10 @@
|
||||
<copy file="${lib}/${pmdjar}" todir="${jdeveloper.install.dir}/lib"/>
|
||||
</target>
|
||||
|
||||
<target name="release">
|
||||
<antcall target="clean"/>
|
||||
<antcall target="jar"/>
|
||||
<mkdir dir="tmp/jars"/>
|
||||
<copy file="${lib}/${ant.project.name}-${pluginversion}.jar" todir="tmp/jars"/>
|
||||
<copy file="${lib}/${pmdjar}" todir="tmp/jars"/>
|
||||
<target name="release" depends="clean,jar">
|
||||
<mkdir dir="tmp/${ant.project.name}-${pluginversion}/lib"/>
|
||||
<copy file="${lib}/${ant.project.name}-${pluginversion}.jar" todir="tmp/${ant.project.name}-${pluginversion}/lib/"/>
|
||||
<copy file="${lib}/${pmdjar}" todir="tmp/${ant.project.name}-${pluginversion}/lib/"/>
|
||||
<zip zipfile="pmd-jdeveloper-bin-${pluginversion}.zip" basedir="tmp"/>
|
||||
<move file="pmd-jdeveloper-bin-${pluginversion}.zip" todir="c:\tmp"/>
|
||||
<delete dir="tmp"/>
|
||||
|
@@ -1,2 +1,2 @@
|
||||
??? - 0.1:
|
||||
February 25, 2003 - 0.1:
|
||||
Initial release
|
||||
|
@@ -1,39 +1,35 @@
|
||||
update the release date in the changelog
|
||||
change config/pmd.props to reflect actual pmd.jar file version
|
||||
change config/pmd.props to reflect pmd-jedit release 1.4
|
||||
change config/jedit.html to reflect pmd-jedit release 1.4
|
||||
change the build.xml to reflect pmd-jedit release 1.4
|
||||
change the build.xml to reflect pmd-jdeveloper release 0.1
|
||||
|
||||
Create the binary release:
|
||||
ant release
|
||||
move the zip file into c:\tmp
|
||||
TESTS:
|
||||
1) Can you run jedit ok?
|
||||
1) Does it unzip neatly on top of the jdev/ext/lib directory?
|
||||
2) Can you run it it on a file and find some unused code?
|
||||
3) Are options persistant?
|
||||
|
||||
Create the src release:
|
||||
cvs -q rtag -D tomorrow "pmd_jedit_release_1_4" pmd-jedit
|
||||
rmdir /q /s c:\tmp\pmd-jedit
|
||||
mkdir c:\tmp\pmd-jedit
|
||||
cvs -q export -d c:\tmp\pmd-jedit -r pmd_jedit_release_1_4 pmd-jedit
|
||||
copy pmd-jedit\lib\PMDJEditPlugin-1.4.jar c:\tmp\pmd-jedit\lib
|
||||
cvs -q rtag -D tomorrow "pmd_jdeveloper_release_1_4" pmd-jdeveloper
|
||||
rmdir /q /s c:\tmp\pmd-jdeveloper
|
||||
mkdir c:\tmp\pmd-jdeveloper
|
||||
cvs -q export -d c:\tmp\pmd-jdeveloper -r pmd_jdeveloper_release_1_4 pmd-jdeveloper
|
||||
copy pmd-jdeveloper\lib\pmd-jdeveloper-0.1.jar c:\tmp\pmd-jdeveloper\lib
|
||||
cd c:\tmp
|
||||
"c:\program files\winzip\wzzip.exe" -r -p pmd-jedit-src-1.4.zip pmd-jedit
|
||||
rmdir /q /s pmd-jedit
|
||||
"c:\program files\winzip\wzzip.exe" -r -p pmd-jdeveloper-src-0.1.zip pmd-jdeveloper
|
||||
rmdir /q /s pmd-jdeveloper
|
||||
|
||||
FTP the zip file to SF
|
||||
ftp upload.sourceforge.net
|
||||
generic userid/password: anonymous/tom@infoether.com
|
||||
cd incoming
|
||||
bin
|
||||
put pmd-jedit-src-1.4.zip
|
||||
put pmd-jedit-bin-1.4.zip
|
||||
put pmd-jdeveloper-src-0.1.zip
|
||||
put pmd-jdeveloper-bin-0.1.zip
|
||||
|
||||
Go to Admin, Edit/Release Files, click on Add new release
|
||||
Paste stuff into the changelog/readme boxes
|
||||
Add the pmd-jedit-src-1.4.zip file
|
||||
Add the pmd-jedit-bin-1.4.zip file
|
||||
Add the pmd-jdeveloper-src-0.1.zip file
|
||||
Add the pmd-jdeveloper-bin-0.1.zip file
|
||||
Classify the file
|
||||
|
||||
Submit some news saying "hey, new release of the JEdit plugin!"
|
||||
Submit some news saying "hey, new release of the jdeveloper plugin!"
|
||||
|
@@ -2,18 +2,15 @@ package net.sourceforge.pmd.jdeveloper;
|
||||
|
||||
import net.sourceforge.pmd.RuleViolation;
|
||||
import oracle.ide.Ide;
|
||||
import oracle.ide.editor.Editor;
|
||||
import oracle.ide.model.Document;
|
||||
import oracle.ide.net.URLFactory;
|
||||
import oracle.jdeveloper.ceditor.CodeEditor;
|
||||
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.DefaultListSelectionModel;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class was inspired by a class on Sun's web site in the JList tutorial section. It's
|
||||
* been twiddled somewhat since then, though.
|
||||
* been twiddled somewhat since then.
|
||||
*/
|
||||
public class JumpingSelectionModel extends DefaultListSelectionModel {
|
||||
|
||||
@@ -32,21 +29,9 @@ public class JumpingSelectionModel extends DefaultListSelectionModel {
|
||||
super.setSelectionInterval(index0, index1);
|
||||
int newIndex = getMinSelectionIndex();
|
||||
if (oldIndex != newIndex) {
|
||||
RuleViolation rv = ((RuleViolationWrapper)model.getElementAt(newIndex)).getRV();
|
||||
List editors = Ide.getEditorManager().getAllEditors();
|
||||
for (Iterator i = editors.iterator(); i.hasNext();) {
|
||||
Editor editor = (Editor)i.next();
|
||||
Document doc = editor.getContext().getDocument();
|
||||
if (doc.getLongLabel().equals(rv.getFilename()) && editor instanceof CodeEditor) {
|
||||
System.out.println("GOING THERE");
|
||||
Ide.getEditorManager().openDefaultEditorInFrame(editor.getContext().getDocument().getURL());
|
||||
editor.activate();
|
||||
editor.open();
|
||||
((CodeEditor)editor).gotoLine(rv.getLine(), 0, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
RuleViolation rv = ((RuleViolationWrapper)model.getElementAt(newIndex)).getRuleViolation();
|
||||
Ide.getEditorManager().openDefaultEditorInFrame(URLFactory.newFileURL(rv.getFilename()));
|
||||
((CodeEditor)Ide.getEditorManager().getCurrentEditor()).gotoLine(rv.getLine(), 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package net.sourceforge.pmd.jdeveloper;
|
||||
|
||||
import net.sourceforge.pmd.PMD;
|
||||
import net.sourceforge.pmd.PMDException;
|
||||
import net.sourceforge.pmd.Report;
|
||||
import net.sourceforge.pmd.RuleContext;
|
||||
import net.sourceforge.pmd.RuleViolation;
|
||||
import net.sourceforge.pmd.PMDException;
|
||||
import oracle.ide.AddinManager;
|
||||
import oracle.ide.ContextMenu;
|
||||
import oracle.ide.Ide;
|
||||
@@ -14,40 +14,28 @@ import oracle.ide.addin.Context;
|
||||
import oracle.ide.addin.ContextMenuListener;
|
||||
import oracle.ide.addin.Controller;
|
||||
import oracle.ide.config.IdeSettings;
|
||||
import oracle.ide.model.DirectoryFolder;
|
||||
import oracle.ide.model.Element;
|
||||
import oracle.ide.model.PackageFolder;
|
||||
import oracle.ide.model.Workspace;
|
||||
import oracle.ide.model.Workspaces;
|
||||
import oracle.ide.model.Project;
|
||||
import oracle.ide.model.Document;
|
||||
import oracle.ide.model.Element;
|
||||
import oracle.ide.model.Project;
|
||||
import oracle.ide.panels.Navigable;
|
||||
import oracle.jdeveloper.model.BusinessComponents;
|
||||
import oracle.jdeveloper.model.EnterpriseJavaBeans;
|
||||
import oracle.jdeveloper.model.JProject;
|
||||
import oracle.jdeveloper.model.JavaSourceNode;
|
||||
import oracle.jdeveloper.model.JavaSources;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class Plugin implements Addin, Controller, ContextMenuListener {
|
||||
|
||||
public static final String CHECK_CMD = "net.sourceforge.pmd.jdeveloper.Check";
|
||||
public static final int CHECK_CMD_ID = Ide.newCmd("PMDJDeveloperPlugin.CHECK_CMD_ID");
|
||||
public static final String TITLE = "PMD";
|
||||
|
||||
private static final int INVALID = -1;
|
||||
private static final int UNUSED = -1;
|
||||
private static final int SOURCE = 0;
|
||||
private static final int SOURCES = 1;
|
||||
private static final int WORKSPACE = 2;
|
||||
private static final int WORKSPACES = 3;
|
||||
private static final int PACKAGE = 4;
|
||||
private static final int DIRECTORY = 5;
|
||||
private static final int PROJECT = 6;
|
||||
private static final int EJB = 7;
|
||||
private static final int BUSINESS = 8;
|
||||
|
||||
private JMenuItem checkItem;
|
||||
private RuleViolationPage rvPage;
|
||||
@@ -58,19 +46,15 @@ public class Plugin implements Addin, Controller, ContextMenuListener {
|
||||
|
||||
// Addin
|
||||
public void initialize() {
|
||||
AddinManager addinManager = Ide.getAddinManager();
|
||||
String command = addinManager.getCommand(CHECK_CMD_ID, CHECK_CMD);
|
||||
String category = "PMD";
|
||||
IdeAction action = IdeAction.get(CHECK_CMD_ID, command, "PMD", category, null, null, null, true);
|
||||
IdeAction action = IdeAction.get(CHECK_CMD_ID, Ide.getAddinManager().getCommand(CHECK_CMD_ID, CHECK_CMD), TITLE, TITLE, null, null, null, true);
|
||||
action.setController(this);
|
||||
checkItem = Ide.getMenubar().createMenuItem(action);
|
||||
checkItem.setText("PMD");
|
||||
checkItem.setText(TITLE);
|
||||
checkItem.setMnemonic('P');
|
||||
Ide.getNavigatorManager().addContextMenuListener(this, null);
|
||||
Ide.getEditorManager().getContextMenu().addContextMenuListener(this, null);
|
||||
System.out.println("PMD JDeveloper Extension " + getVersion());
|
||||
IdeSettings.registerUI(new Navigable("PMD", SettingsPanel.class, new Navigable[] {}));
|
||||
Ide.getVersionInfo().addComponent("PMD", " JDeveloper Extension " + getVersion());
|
||||
IdeSettings.registerUI(new Navigable(TITLE, SettingsPanel.class, new Navigable[] {}));
|
||||
Ide.getVersionInfo().addComponent(TITLE, " JDeveloper Extension " + getVersion());
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
@@ -99,130 +83,88 @@ public class Plugin implements Addin, Controller, ContextMenuListener {
|
||||
public boolean handleEvent(IdeAction ideAction, Context context) {
|
||||
if (ideAction.getCommandId() == CHECK_CMD_ID) {
|
||||
try {
|
||||
PMD pmd = new PMD();
|
||||
SelectedRules rs = new SelectedRules();
|
||||
RuleContext ctx = new RuleContext();
|
||||
ctx.setReport(new Report());
|
||||
if (resolveType(context.getDocument()) == PROJECT) {
|
||||
Project proj = (Project)context.getDocument();
|
||||
List foo = proj.getListOfChildren();
|
||||
PMD pmd = new PMD();
|
||||
SelectedRules rs = new SelectedRules();
|
||||
RuleContext ctx = new RuleContext();
|
||||
ctx.setReport(new Report());
|
||||
for (Iterator i = foo.iterator(); i.hasNext();) {
|
||||
Document d = (Document)i.next();
|
||||
if (d.getLongLabel().endsWith(".java")) {
|
||||
ctx.setSourceCodeFilename(d.getLongLabel());
|
||||
System.out.println("processing " + d.getLongLabel());
|
||||
pmd.processFile(context.getDocument().getInputStream(), rs.getSelectedRules(), ctx);
|
||||
for (Iterator i = ((Project)context.getDocument()).getListOfChildren().iterator(); i.hasNext();) {
|
||||
Document candidate = (Document)i.next();
|
||||
if (candidate.getLongLabel().endsWith(".java")) {
|
||||
ctx.setSourceCodeFilename(candidate.getLongLabel());
|
||||
FileInputStream fis = new FileInputStream(new File(candidate.getLongLabel()));
|
||||
pmd.processFile(fis, rs.getSelectedRules(), ctx);
|
||||
fis.close();
|
||||
}
|
||||
}
|
||||
if (rvPage == null) {
|
||||
rvPage = new RuleViolationPage();
|
||||
}
|
||||
if (!rvPage.isVisible()) {
|
||||
rvPage.show();
|
||||
}
|
||||
rvPage.clearAll();
|
||||
if (ctx.getReport().isEmpty()) {
|
||||
JOptionPane.showMessageDialog(null, "No problems found", "PMD", JOptionPane.INFORMATION_MESSAGE);
|
||||
} else {
|
||||
for (Iterator i = ctx.getReport().iterator(); i.hasNext();) {
|
||||
rvPage.add((RuleViolation)i.next());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
PMD pmd = new PMD();
|
||||
RuleContext ctx = new RuleContext();
|
||||
ctx.setReport(new Report());
|
||||
render(ctx);
|
||||
} else if (resolveType(context.getDocument()) == SOURCE) {
|
||||
ctx.setSourceCodeFilename(context.getDocument().getLongLabel());
|
||||
SelectedRules rs = new SelectedRules();
|
||||
pmd.processFile(context.getDocument().getInputStream(), rs.getSelectedRules(), ctx);
|
||||
if (rvPage == null) {
|
||||
rvPage = new RuleViolationPage();
|
||||
}
|
||||
if (!rvPage.isVisible()) {
|
||||
rvPage.show();
|
||||
}
|
||||
rvPage.clearAll();
|
||||
if (ctx.getReport().isEmpty()) {
|
||||
JOptionPane.showMessageDialog(null, "No problems found", "PMD", JOptionPane.INFORMATION_MESSAGE);
|
||||
} else {
|
||||
for (Iterator i = ctx.getReport().iterator(); i.hasNext();) {
|
||||
rvPage.add((RuleViolation)i.next());
|
||||
}
|
||||
}
|
||||
render(ctx);
|
||||
}
|
||||
return true;
|
||||
} catch (PMDException e) {
|
||||
e.printStackTrace();
|
||||
e.getOriginalException().printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "Error while running PMD: " + e.getMessage(), TITLE, JOptionPane.ERROR_MESSAGE);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "Error while running PMD: " + e.getMessage(), TITLE, JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void render(RuleContext ctx) {
|
||||
if (rvPage == null) {
|
||||
rvPage = new RuleViolationPage();
|
||||
}
|
||||
if (!rvPage.isVisible()) {
|
||||
rvPage.show();
|
||||
}
|
||||
rvPage.clearAll();
|
||||
if (ctx.getReport().isEmpty()) {
|
||||
JOptionPane.showMessageDialog(null, "No problems found", TITLE, JOptionPane.INFORMATION_MESSAGE);
|
||||
} else {
|
||||
for (Iterator i = ctx.getReport().iterator(); i.hasNext();) {
|
||||
rvPage.add((RuleViolation)i.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean update(IdeAction ideAction, Context context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void checkCommands(Context context, Controller controller) {
|
||||
}
|
||||
public void checkCommands(Context context, Controller controller) {}
|
||||
// Controller
|
||||
|
||||
// Controller
|
||||
// ContextMenuListener
|
||||
public void poppingUp(ContextMenu contextMenu) {
|
||||
if (contextMenu != null) {
|
||||
Context context = contextMenu.getContext();
|
||||
if (context != null) {
|
||||
Element doc = context.getDocument();
|
||||
if (resolveType(doc) == PROJECT || resolveType(doc) == SOURCE) {
|
||||
contextMenu.add(checkItem);
|
||||
}
|
||||
}
|
||||
Element doc = contextMenu.getContext().getDocument();
|
||||
if (resolveType(doc) == PROJECT || resolveType(doc) == SOURCE) {
|
||||
contextMenu.add(checkItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void poppingDown(ContextMenu contextMenu) {
|
||||
}
|
||||
public void poppingDown(ContextMenu contextMenu) {}
|
||||
|
||||
public boolean handleDefaultAction(Context context) {
|
||||
return false;
|
||||
}
|
||||
// Controller
|
||||
// ContextMenuListener
|
||||
|
||||
public static String getVersion() {
|
||||
return Package.getPackage("net.sourceforge.pmd.jdeveloper").getImplementationVersion();
|
||||
}
|
||||
|
||||
private int resolveType(Element element)
|
||||
{
|
||||
private int resolveType(Element element) {
|
||||
if (element instanceof JavaSourceNode) {
|
||||
return SOURCE;
|
||||
}
|
||||
if (element instanceof JavaSources) {
|
||||
return SOURCES;
|
||||
}
|
||||
if (element instanceof JProject) {
|
||||
} else if (element instanceof JProject) {
|
||||
return PROJECT;
|
||||
}
|
||||
if (element instanceof PackageFolder) {
|
||||
return PACKAGE;
|
||||
}
|
||||
if (element instanceof DirectoryFolder) {
|
||||
return DIRECTORY;
|
||||
}
|
||||
if (element instanceof BusinessComponents) {
|
||||
return BUSINESS;
|
||||
}
|
||||
if (element instanceof EnterpriseJavaBeans) {
|
||||
return EJB;
|
||||
}
|
||||
if (element instanceof Workspace) {
|
||||
return WORKSPACE;
|
||||
}
|
||||
if (element instanceof Workspaces) {
|
||||
return WORKSPACES;
|
||||
}
|
||||
return INVALID;
|
||||
return UNUSED;
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ public class RuleViolationPage extends AbstractLogPage {
|
||||
private JList list;
|
||||
|
||||
public RuleViolationPage() {
|
||||
super(new ViewId("PMDPage", "PMD"), null, false);
|
||||
super(new ViewId("PMDPage", Plugin.TITLE), null, false);
|
||||
list = new JList(model);
|
||||
list.setSelectionModel(new JumpingSelectionModel(model));
|
||||
scrollPane = new JScrollPane(list);
|
||||
@@ -33,7 +33,6 @@ public class RuleViolationPage extends AbstractLogPage {
|
||||
}
|
||||
|
||||
public void clearAll() {
|
||||
super.clearAll();
|
||||
model.clear();
|
||||
}
|
||||
}
|
||||
|
@@ -3,17 +3,18 @@ package net.sourceforge.pmd.jdeveloper;
|
||||
import net.sourceforge.pmd.RuleViolation;
|
||||
|
||||
public class RuleViolationWrapper {
|
||||
private RuleViolation rv;
|
||||
|
||||
public RuleViolationWrapper(RuleViolation rv) {
|
||||
this.rv = rv;
|
||||
private RuleViolation ruleViolation;
|
||||
|
||||
public RuleViolationWrapper(RuleViolation ruleViolation) {
|
||||
this.ruleViolation = ruleViolation;
|
||||
}
|
||||
|
||||
public RuleViolation getRV() {
|
||||
return this.rv;
|
||||
public RuleViolation getRuleViolation() {
|
||||
return this.ruleViolation;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return rv.getFilename() + ":" + rv.getLine() +":"+ rv.getDescription();
|
||||
return ruleViolation.getFilename() + " : " + ruleViolation.getLine() +" : "+ ruleViolation.getDescription();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user