More fun with ProjectUtils.
1.1 --- a/tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/Choosers.java Tue Aug 30 21:02:06 2005 +0000
1.2 +++ b/tasklist.docscan/src/org/netbeans/modules/tasklist/docscan/Choosers.java Wed Aug 31 02:00:52 2005 +0000
1.3 @@ -7,30 +7,33 @@
1.4 * http://www.sun.com/
1.5 *
1.6 * The Original Code is NetBeans. The Initial Developer of the Original
1.7 - * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
1.8 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
1.9 * Microsystems, Inc. All Rights Reserved.
1.10 */
1.11
1.12 -
1.13 package org.netbeans.modules.tasklist.docscan;
1.14
1.15 +import java.awt.Component;
1.16 +import java.awt.Image;
1.17 +import java.awt.Panel;
1.18 +import java.awt.image.BufferedImage;
1.19 +import java.util.Arrays;
1.20 +import java.util.Comparator;
1.21 +import java.util.Collections;
1.22 +import javax.swing.Icon;
1.23 +import javax.swing.ImageIcon;
1.24 +import org.netbeans.api.project.ui.OpenProjects;
1.25 +import org.netbeans.api.project.Project;
1.26 +import org.netbeans.api.project.ProjectUtils;
1.27 +import org.netbeans.api.project.SourceGroup;
1.28 +import org.netbeans.api.project.Sources;
1.29 import org.openide.nodes.AbstractNode;
1.30 import org.openide.nodes.Children;
1.31 import org.openide.nodes.Node;
1.32 import org.openide.filesystems.FileObject;
1.33 -import org.openide.filesystems.FileUtil;
1.34 import org.openide.util.lookup.Lookups;
1.35 import org.openide.loaders.DataObject;
1.36 import org.openide.loaders.DataObjectNotFoundException;
1.37 -import org.netbeans.api.project.*;
1.38 -import org.netbeans.api.project.ui.OpenProjects;
1.39 -
1.40 -import javax.swing.*;
1.41 -import java.awt.*;
1.42 -import java.awt.image.BufferedImage;
1.43 -import java.util.Arrays;
1.44 -import java.util.Comparator;
1.45 -import java.util.Collections;
1.46
1.47 /**
1.48 * Utility class defining project chooser.
1.49 @@ -136,30 +139,17 @@
1.50 }
1.51
1.52 public String getDisplayName() {
1.53 - ProjectInformation pi = getProjectInformation();
1.54 - return pi != null ? pi.getDisplayName() : FileUtil.getFileDisplayName(project.getProjectDirectory());
1.55 + return ProjectUtils.getInformation(project).getDisplayName();
1.56 }
1.57
1.58 public Image getIcon(int type) {
1.59 - ProjectInformation pi = getProjectInformation();
1.60 - if (pi != null) {
1.61 - return convertIconToImage(pi.getIcon());
1.62 - }
1.63 - if (icons != null) {
1.64 - return icons.getIcon(type);
1.65 - } else {
1.66 - return super.getIcon(type);
1.67 - }
1.68 + return convertIconToImage(ProjectUtils.getInformation(project).getIcon());
1.69 }
1.70
1.71 public Image getOpenedIcon(int type) {
1.72 return getIcon(type);
1.73 }
1.74
1.75 - private ProjectInformation getProjectInformation() {
1.76 - return (ProjectInformation) project.getLookup().lookup(ProjectInformation.class);
1.77 - }
1.78 -
1.79 }
1.80
1.81 /**