The ProjectClassPathExtender was moved into public SPI package.
Index: java/project/src/org/netbeans/modules/java/project/JavaTargetChooserPanelGUI.java
===================================================================
RCS file: /cvs/java/project/src/org/netbeans/modules/java/project/JavaTargetChooserPanelGUI.java,v
retrieving revision 1.22
diff -u -r1.22 JavaTargetChooserPanelGUI.java
--- java/project/src/org/netbeans/modules/java/project/JavaTargetChooserPanelGUI.java 22 Oct 2004 12:34:50 -0000 1.22
+++ java/project/src/org/netbeans/modules/java/project/JavaTargetChooserPanelGUI.java 11 Jan 2005 16:18:48 -0000
@@ -30,6 +30,7 @@
import org.netbeans.api.project.Project;
import org.netbeans.api.project.ProjectUtils;
import org.netbeans.api.project.SourceGroup;
+import org.netbeans.spi.java.project.support.ui.PackageView;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.awt.Mnemonics;
@@ -92,7 +93,7 @@
}
rootComboBox.setRenderer(new GroupListCellRenderer());
- packageComboBox.setRenderer(PackageListView.listRenderer());
+ packageComboBox.setRenderer(PackageView.listRenderer());
rootComboBox.addActionListener( this );
setPreferredSize( PREF_DIM );
@@ -390,7 +391,7 @@
// Private methods ---------------------------------------------------------
private void updatePackages() {
- packageComboBox.setModel(PackageListView.createListView((SourceGroup) rootComboBox.getSelectedItem()));
+ packageComboBox.setModel(PackageView.createListView((SourceGroup) rootComboBox.getSelectedItem()));
}
private File getFolder() {
Index: java/project/src/org/netbeans/modules/java/project/PackageListView.java
===================================================================
RCS file: java/project/src/org/netbeans/modules/java/project/PackageListView.java
diff -N java/project/src/org/netbeans/modules/java/project/PackageListView.java
--- java/project/src/org/netbeans/modules/java/project/PackageListView.java 6 Oct 2004 21:15:37 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,137 +0,0 @@
-/*
- * Sun Public License Notice
- *
- * The contents of this file are subject to the Sun Public License
- * Version 1.0 (the "License"). You may not use this file except in
- * compliance with the License. A copy of the License is available at
- * http://www.sun.com/
- *
- * The Original Code is NetBeans. The Initial Developer of the Original
- * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
- * Microsystems, Inc. All Rights Reserved.
- */
-
-package org.netbeans.modules.java.project;
-
-import java.awt.Component;
-import java.util.Enumeration;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import javax.swing.ComboBoxModel;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.DefaultListModel;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JList;
-import javax.swing.ListCellRenderer;
-import org.netbeans.api.project.SourceGroup;
-import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileUtil;
-
-// XXX needs unit test
-
-/**
- * Factory for list-oriented views of packages.
- * Future candidates for inclusion in {@link org.netbeans.spi.java.project.support.ui.PackageView}.
- * @author Jesse Glick
- * @see "#48618"
- */
-public final class PackageListView {
-
- private PackageListView() {}
-
- /**
- * Create a list or combo box model suitable for {@link javax.swing.JList} from a source group
- * showing all Java packages in the source group.
- * To display it you will also need {@link #listRenderer}.
- * No particular guarantees are made as to the nature of the model objects themselves,
- * except that {@link Object#toString} will give the fully-qualified package name
- * (or ""
for the default package), regardless of what the renderer
- * actually displays.
- * @param group a Java-like source group
- * @return a model of its packages
- */
- public static ComboBoxModel createListView(SourceGroup group) {
- DefaultListModel model = new DefaultListModel();
- SortedSet/**/ items = new TreeSet();
- FileObject root = group.getRootFolder();
- if (PackageDisplayUtils.isSignificant(root)) {
- items.add(new PackageItem(group, root));
- }
- Enumeration/**/ files = root.getChildren(true);
- while (files.hasMoreElements()) {
- FileObject f = (FileObject) files.nextElement();
- if (f.isFolder() && PackageDisplayUtils.isSignificant(f)) {
- items.add(new PackageItem(group, f));
- }
- }
- return new DefaultComboBoxModel(items.toArray(new PackageItem[items.size()]));
- }
-
- /**
- * Create a renderer suited to rendering models created using {@link #createListView}.
- * The exact nature of the display is not specified.
- * Instances of String can also be rendered.
- * @return a suitable package renderer
- */
- public static ListCellRenderer listRenderer() {
- return new PackageListCellRenderer();
- }
-
- /**
- * Model item representing one package.
- */
- private static final class PackageItem implements Comparable {
-
- private final FileObject pkg;
- private final String pkgname;
-
- public PackageItem(SourceGroup group, FileObject pkg) {
- this.pkg = pkg;
- String path = FileUtil.getRelativePath(group.getRootFolder(), pkg);
- assert path != null : "No " + pkg + " in " + group;
- pkgname = path.replace('/', '.');
- }
-
- public String toString() {
- return pkgname;
- }
-
- public String getLabel() {
- return PackageDisplayUtils.getDisplayLabel(pkg, pkgname);
- }
-
- public Icon getIcon() {
- return new ImageIcon(PackageDisplayUtils.getIcon(pkg, pkgname));
- }
-
- public int compareTo(Object obj) {
- return pkgname.compareTo(((PackageItem) obj).pkgname);
- }
-
- }
-
- /**
- * The renderer which just displays {@link PackageItem#getLabel} and {@link PackageItem#getIcon}.
- */
- private static final class PackageListCellRenderer extends DefaultListCellRenderer {
-
- public PackageListCellRenderer() {}
-
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
- if (value instanceof PackageItem) {
- PackageItem pkgitem = (PackageItem) value;
- super.getListCellRendererComponent(list, pkgitem.getLabel(), index, isSelected, cellHasFocus);
- setIcon(pkgitem.getIcon());
- } else {
- // #49954: render a specially inserted package somehow.
- String pkgitem = (String) value;
- super.getListCellRendererComponent(list, pkgitem, index, isSelected, cellHasFocus);
- }
- return this;
- }
-
- }
-
-}
Index: java/project/src/org/netbeans/spi/java/project/support/ui/PackageView.java
===================================================================
RCS file: /cvs/java/project/src/org/netbeans/spi/java/project/support/ui/PackageView.java,v
retrieving revision 1.9
diff -u -r1.9 PackageView.java
--- java/project/src/org/netbeans/spi/java/project/support/ui/PackageView.java 10 Jan 2005 15:58:02 -0000 1.9
+++ java/project/src/org/netbeans/spi/java/project/support/ui/PackageView.java 11 Jan 2005 16:18:48 -0000
@@ -13,10 +13,25 @@
package org.netbeans.spi.java.project.support.ui;
+import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.Enumeration;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.DefaultListModel;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
import org.netbeans.api.project.SourceGroup;
+import org.netbeans.modules.java.project.PackageDisplayUtils;
import org.netbeans.modules.java.project.PackageViewSettings;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
import org.openide.util.WeakListeners;
@@ -71,6 +86,46 @@
}
/**
+ * Create a list or combo box model suitable for {@link javax.swing.JList} from a source group
+ * showing all Java packages in the source group.
+ * To display it you will also need {@link #listRenderer}.
+ * No particular guarantees are made as to the nature of the model objects themselves,
+ * except that {@link Object#toString} will give the fully-qualified package name
+ * (or ""
for the default package), regardless of what the renderer
+ * actually displays.
+ * @param group a Java-like source group
+ * @return a model of its packages
+ * @since org.netbeans.modules.java.project/1 1.3
+ */
+ public static ComboBoxModel createListView(SourceGroup group) {
+ DefaultListModel model = new DefaultListModel();
+ SortedSet/**/ items = new TreeSet();
+ FileObject root = group.getRootFolder();
+ if (PackageDisplayUtils.isSignificant(root)) {
+ items.add(new PackageItem(group, root));
+ }
+ Enumeration/**/ files = root.getChildren(true);
+ while (files.hasMoreElements()) {
+ FileObject f = (FileObject) files.nextElement();
+ if (f.isFolder() && PackageDisplayUtils.isSignificant(f)) {
+ items.add(new PackageItem(group, f));
+ }
+ }
+ return new DefaultComboBoxModel(items.toArray(new PackageItem[items.size()]));
+ }
+
+ /**
+ * Create a renderer suited to rendering models created using {@link #createListView}.
+ * The exact nature of the display is not specified.
+ * Instances of String can also be rendered.
+ * @return a suitable package renderer
+ * @since org.netbeans.modules.java.project/1 1.3
+ */
+ public static ListCellRenderer listRenderer() {
+ return new PackageListCellRenderer();
+ }
+
+ /**
* FilterNode which listens on the PackageViewSettings and changes the view to
* the package view or tree view
*
@@ -106,4 +161,61 @@
}
}
}
+
+ /**
+ * Model item representing one package.
+ */
+ private static final class PackageItem implements Comparable {
+
+ private final FileObject pkg;
+ private final String pkgname;
+
+ public PackageItem(SourceGroup group, FileObject pkg) {
+ this.pkg = pkg;
+ String path = FileUtil.getRelativePath(group.getRootFolder(), pkg);
+ assert path != null : "No " + pkg + " in " + group;
+ pkgname = path.replace('/', '.');
+ }
+
+ public String toString() {
+ return pkgname;
+ }
+
+ public String getLabel() {
+ return PackageDisplayUtils.getDisplayLabel(pkg, pkgname);
+ }
+
+ public Icon getIcon() {
+ return new ImageIcon(PackageDisplayUtils.getIcon(pkg, pkgname));
+ }
+
+ public int compareTo(Object obj) {
+ return pkgname.compareTo(((PackageItem) obj).pkgname);
+ }
+
+ }
+
+ /**
+ * The renderer which just displays {@link PackageItem#getLabel} and {@link PackageItem#getIcon}.
+ */
+ private static final class PackageListCellRenderer extends DefaultListCellRenderer {
+
+ public PackageListCellRenderer() {}
+
+ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ if (value instanceof PackageItem) {
+ PackageItem pkgitem = (PackageItem) value;
+ super.getListCellRendererComponent(list, pkgitem.getLabel(), index, isSelected, cellHasFocus);
+ setIcon(pkgitem.getIcon());
+ } else {
+ // #49954: render a specially inserted package somehow.
+ String pkgitem = (String) value;
+ super.getListCellRendererComponent(list, pkgitem, index, isSelected, cellHasFocus);
+ }
+ return this;
+ }
+
+ }
+
+
}
Index: refactoring/src/org/netbeans/modules/refactoring/ui/MoveClassPanel.java
===================================================================
RCS file: /cvs/refactoring/src/org/netbeans/modules/refactoring/ui/MoveClassPanel.java,v
retrieving revision 1.14
diff -u -r1.14 MoveClassPanel.java
--- refactoring/src/org/netbeans/modules/refactoring/ui/MoveClassPanel.java 7 Jan 2005 14:18:18 -0000 1.14
+++ refactoring/src/org/netbeans/modules/refactoring/ui/MoveClassPanel.java 11 Jan 2005 16:18:50 -0000
@@ -39,6 +39,7 @@
import org.netbeans.api.project.ui.OpenProjects;
import org.netbeans.modules.refactoring.api.ui.CustomRefactoringPanel;
import org.netbeans.modules.refactoring.api.ui.ParametersPanel;
+import org.netbeans.spi.java.project.support.ui.PackageView;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.loaders.DataObject;
@@ -70,7 +71,7 @@
labelHeadLine.setText(headline);
rootComboBox.setRenderer(GROUP_CELL_RENDERER);
- packageComboBox.setRenderer(PackageListView.listRenderer());
+ packageComboBox.setRenderer(PackageView.listRenderer());
projectsComboBox.setRenderer( PROJECT_CELL_RENDERER );
rootComboBox.addActionListener( this );
@@ -289,7 +290,7 @@
private void updatePackages() {
SourceGroup g = (SourceGroup) rootComboBox.getSelectedItem();
- packageComboBox.setModel(PackageListView.createListView(g));
+ packageComboBox.setModel(PackageView.createListView(g));
}
void setCombosEnabled(boolean enabled) {
Index: refactoring/src/org/netbeans/modules/refactoring/ui/PackageListView.java
===================================================================
RCS file: refactoring/src/org/netbeans/modules/refactoring/ui/PackageListView.java
diff -N refactoring/src/org/netbeans/modules/refactoring/ui/PackageListView.java
--- refactoring/src/org/netbeans/modules/refactoring/ui/PackageListView.java 7 Sep 2004 23:18:18 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,129 +0,0 @@
-/*
- * Sun Public License Notice
- *
- * The contents of this file are subject to the Sun Public License
- * Version 1.0 (the "License"). You may not use this file except in
- * compliance with the License. A copy of the License is available at
- * http://www.sun.com/
- *
- * The Original Code is NetBeans. The Initial Developer of the Original
- * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
- * Microsystems, Inc. All Rights Reserved.
- */
-
-package org.netbeans.modules.refactoring.ui;
-
-import java.awt.Component;
-import java.util.Enumeration;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import javax.swing.ComboBoxModel;
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.DefaultListCellRenderer;
-import javax.swing.DefaultListModel;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JList;
-import javax.swing.ListCellRenderer;
-import org.netbeans.api.project.SourceGroup;
-import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileUtil;
-
-// XXX COPIED FROM java/project; cf. #48618
-
-/**
- * Factory for list-oriented views of packages.
- * Future candidates for inclusion in {@link org.netbeans.spi.java.project.support.ui.PackageView}.
- * @author Jesse Glick
- */
-public final class PackageListView {
-
- private PackageListView() {}
-
- /**
- * Create a list or combo box model suitable for {@link javax.swing.JList} from a source group
- * showing all Java packages in the source group.
- * To display it you will also need {@link #listRenderer}.
- * No particular guarantees are made as to the nature of the model objects themselves,
- * except that {@link Object#toString} will give the fully-qualified package name
- * (or ""
for the default package), regardless of what the renderer
- * actually displays.
- * @param group a Java-like source group
- * @return a model of its packages
- */
- public static ComboBoxModel createListView(SourceGroup group) {
- DefaultListModel model = new DefaultListModel();
- SortedSet/**/ items = new TreeSet();
- FileObject root = group.getRootFolder();
- if (PackageDisplayUtils.isSignificant(root)) {
- items.add(new PackageItem(group, root));
- }
- Enumeration/**/ files = root.getChildren(true);
- while (files.hasMoreElements()) {
- FileObject f = (FileObject) files.nextElement();
- if (f.isFolder() && PackageDisplayUtils.isSignificant(f)) {
- items.add(new PackageItem(group, f));
- }
- }
- return new DefaultComboBoxModel(items.toArray(new PackageItem[items.size()]));
- }
-
- /**
- * Create a renderer suited to rendering models created using {@link #createListView}.
- * The exact nature of the display is not specified.
- * @return a suitable package renderer
- */
- public static ListCellRenderer listRenderer() {
- return new PackageListCellRenderer();
- }
-
- /**
- * Model item representing one package.
- */
- private static final class PackageItem implements Comparable {
-
- private final FileObject pkg;
- private final String pkgname;
-
- public PackageItem(SourceGroup group, FileObject pkg) {
- this.pkg = pkg;
- String path = FileUtil.getRelativePath(group.getRootFolder(), pkg);
- assert path != null : "No " + pkg + " in " + group;
- pkgname = path.replace('/', '.');
- }
-
- public String toString() {
- return pkgname;
- }
-
- public String getLabel() {
- return PackageDisplayUtils.getDisplayLabel(pkg, pkgname);
- }
-
- public Icon getIcon() {
- return new ImageIcon(PackageDisplayUtils.getIcon(pkg, pkgname));
- }
-
- public int compareTo(Object obj) {
- return pkgname.compareTo(((PackageItem) obj).pkgname);
- }
-
- }
-
- /**
- * The renderer which just displays {@link PackageItem#getLabel} and {@link PackageItem#getIcon}.
- */
- private static final class PackageListCellRenderer extends DefaultListCellRenderer {
-
- public PackageListCellRenderer() {}
-
- public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
- PackageItem pkgitem = (PackageItem) value;
- super.getListCellRendererComponent(list, pkgitem.getLabel(), index, isSelected, cellHasFocus);
- setIcon(pkgitem.getIcon());
- return this;
- }
-
- }
-
-}