Release 4.2.1.0.0

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5976 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Torsten Kleiber
2008-04-06 20:44:41 +00:00
parent cfd0cad0d3
commit bffb6e5e05

View File

@@ -1,36 +0,0 @@
package net.sourceforge.pmd.jdeveloper;
import net.sourceforge.pmd.RuleViolation;
import oracle.ide.editor.EditorManager;
import oracle.ide.net.URLFactory;
import oracle.jdeveloper.ceditor.CodeEditor;
import javax.swing.*;
/**
* This class was inspired by a class on Sun's web site in the JList tutorial section. It's
* been twiddled somewhat since then.
*/
public class JumpingSelectionModel extends DefaultListSelectionModel {
private DefaultListModel model;
public JumpingSelectionModel(DefaultListModel model) {
this.model = model;
}
public JumpingSelectionModel() {
setSelectionMode(SINGLE_SELECTION);
}
public void setSelectionInterval(int index0, int index1) {
int oldIndex = getMinSelectionIndex();
super.setSelectionInterval(index0, index1);
int newIndex = getMinSelectionIndex();
if (oldIndex != newIndex) {
RuleViolation rv = ((RuleViolationWrapper)model.getElementAt(newIndex)).getRuleViolation();
EditorManager.getEditorManager().openDefaultEditorInFrame(URLFactory.newFileURL(rv.getFilename()));
((CodeEditor)EditorManager.getEditorManager().getCurrentEditor()).gotoLine(rv.getBeginLine(), 0, false);
}
}
}