Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 217106 | Differences between
and this patch

Collapse All | Expand All

(-)maven.graph/nbproject/project.xml (+9 lines)
 Lines 121-126    Link Here 
121
                    </run-dependency>
121
                    </run-dependency>
122
                </dependency>
122
                </dependency>
123
                <dependency>
123
                <dependency>
124
                    <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
125
                    <build-prerequisite/>
126
                    <compile-dependency/>
127
                    <run-dependency>
128
                        <release-version>1</release-version>
129
                        <specification-version>1.71</specification-version>
130
                    </run-dependency>
131
                </dependency>
132
                <dependency>
124
                    <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
133
                    <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
125
                    <build-prerequisite/>
134
                    <build-prerequisite/>
126
                    <compile-dependency/>
135
                    <compile-dependency/>
(-)maven.graph/src/org/netbeans/modules/maven/graph/ArtifactWidget.java (-3 / +36 lines)
 Lines 50-60    Link Here 
50
import java.awt.event.ActionEvent;
50
import java.awt.event.ActionEvent;
51
import java.awt.event.ActionListener;
51
import java.awt.event.ActionListener;
52
import java.util.List;
52
import java.util.List;
53
import javax.swing.Icon;
53
import javax.swing.Timer;
54
import javax.swing.Timer;
54
import javax.swing.UIManager;
55
import javax.swing.UIManager;
55
import org.apache.maven.artifact.Artifact;
56
import org.apache.maven.artifact.Artifact;
56
import org.apache.maven.shared.dependency.tree.DependencyNode;
57
import org.apache.maven.shared.dependency.tree.DependencyNode;
57
import org.netbeans.api.annotations.common.StaticResource;
58
import org.netbeans.api.annotations.common.StaticResource;
59
import org.netbeans.api.project.Project;
60
import org.netbeans.api.project.ProjectUtils;
61
import org.netbeans.api.project.ui.OpenProjects;
58
import org.netbeans.api.visual.action.ActionFactory;
62
import org.netbeans.api.visual.action.ActionFactory;
59
import org.netbeans.api.visual.action.SelectProvider;
63
import org.netbeans.api.visual.action.SelectProvider;
60
import org.netbeans.api.visual.border.BorderFactory;
64
import org.netbeans.api.visual.border.BorderFactory;
 Lines 65-70    Link Here 
65
import org.netbeans.api.visual.widget.LevelOfDetailsWidget;
69
import org.netbeans.api.visual.widget.LevelOfDetailsWidget;
66
import org.netbeans.api.visual.widget.Scene;
70
import org.netbeans.api.visual.widget.Scene;
67
import org.netbeans.api.visual.widget.Widget;
71
import org.netbeans.api.visual.widget.Widget;
72
import org.netbeans.modules.maven.api.NbMavenProject;
68
import static org.netbeans.modules.maven.graph.Bundle.*;
73
import static org.netbeans.modules.maven.graph.Bundle.*;
69
import org.openide.util.ImageUtilities;
74
import org.openide.util.ImageUtilities;
70
import org.openide.util.NbBundle.Messages;
75
import org.openide.util.NbBundle.Messages;
 Lines 109-115    Link Here 
109
    private Timer hoverTimer;
114
    private Timer hoverTimer;
110
    private Color hoverBorderC;
115
    private Color hoverBorderC;
111
116
112
    private LabelWidget artifactW, versionW;
117
    private Widget artifactW;
118
    private LabelWidget versionW;
113
    private Widget contentW;
119
    private Widget contentW;
114
    private ImageWidget lockW, fixHintW;
120
    private ImageWidget lockW, fixHintW;
115
121
 Lines 277-284    Link Here 
277
        contentW = new LevelOfDetailsWidget(scene, 0.05, 0.1, Double.MAX_VALUE, Double.MAX_VALUE);
283
        contentW = new LevelOfDetailsWidget(scene, 0.05, 0.1, Double.MAX_VALUE, Double.MAX_VALUE);
278
        contentW.setBorder(BorderFactory.createLineBorder(10));
284
        contentW.setBorder(BorderFactory.createLineBorder(10));
279
        contentW.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 1));
285
        contentW.setLayout(LayoutFactory.createVerticalFlowLayout(LayoutFactory.SerialAlignment.JUSTIFY, 1));
280
        artifactW = new LabelWidget(scene);
286
281
        artifactW.setLabel(artifact.getArtifactId() + "  ");
287
        //Artifact name (with optional project icon on the left)
288
        artifactW = new Widget(scene);
289
        artifactW.setLayout(LayoutFactory.createHorizontalFlowLayout(LayoutFactory.SerialAlignment.CENTER, 4));
290
        
291
        ImageWidget projectIcon = getProjectIcon(artifact, scene);
292
        if (projectIcon != null) {
293
            artifactW.addChild(projectIcon);
294
        }
295
        artifactW.addChild(new LabelWidget(scene, artifact.getArtifactId() + "  "));
296
      
282
        if (node.isRoot()) {
297
        if (node.isRoot()) {
283
            Font defF = scene.getDefaultFont();
298
            Font defF = scene.getDefaultFont();
284
            artifactW.setFont(defF.deriveFont(Font.BOLD, defF.getSize() + 3f));
299
            artifactW.setFont(defF.deriveFont(Font.BOLD, defF.getSize() + 3f));
 Lines 569-572    Link Here 
569
        }
584
        }
570
    }
585
    }
571
586
587
    private ImageWidget getProjectIcon(Artifact artifact, DependencyGraphScene scene) {
588
        //NOTE: surely not the best way to get the project icon
589
        Project[] openProjects = OpenProjects.getDefault().getOpenProjects();
590
        for (Project project : openProjects) {
591
            NbMavenProject mavenProject = project.getLookup().lookup(NbMavenProject.class);
592
            if (null != mavenProject) {
593
                Artifact artifactFromNode = artifact;
594
                Artifact artifactFromProject = mavenProject.getMavenProject().getArtifact();
595
                if (artifactFromNode.equals(artifactFromProject)) {
596
                    //get icon from opened project
597
                    Icon icon = ProjectUtils.getInformation(project).getIcon();
598
                    return new ImageWidget(scene, ImageUtilities.icon2Image(icon));
572
}
599
}
600
            }
601
        }
602
        return null;
603
    }
604
605
}

Return to bug 217106
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo