1 package com
.intellij
.openapi
.roots
.ui
.configuration
.artifacts
;
3 import com
.intellij
.openapi
.roots
.ui
.configuration
.ProjectStructureConfigurable
;
4 import com
.intellij
.openapi
.roots
.ui
.configuration
.projectRoot
.daemon
.ProjectStructureElement
;
5 import com
.intellij
.openapi
.roots
.ui
.configuration
.projectRoot
.daemon
.ProjectStructureElementUsage
;
6 import com
.intellij
.packaging
.artifacts
.Artifact
;
7 import com
.intellij
.packaging
.elements
.PackagingElement
;
14 public class UsageInArtifact
extends ProjectStructureElementUsage
{
15 private Artifact myOriginalArtifact
;
16 private final ArtifactsStructureConfigurableContext myContext
;
17 private ProjectStructureElement mySourceElement
;
18 private ProjectStructureElement myContainingElement
;
19 private final String myParentPath
;
20 private final PackagingElement
<?
> myPackagingElement
;
22 public UsageInArtifact(Artifact originalArtifact
, ArtifactsStructureConfigurableContext context
, ProjectStructureElement sourceElement
,
23 ArtifactProjectStructureElement containingElement
,
24 String parentPath
, PackagingElement
<?
> packagingElement
) {
25 myOriginalArtifact
= originalArtifact
;
27 mySourceElement
= sourceElement
;
28 myContainingElement
= containingElement
;
29 myParentPath
= parentPath
;
30 myPackagingElement
= packagingElement
;
34 public ProjectStructureElement
getSourceElement() {
35 return mySourceElement
;
39 public ProjectStructureElement
getContainingElement() {
40 return myContainingElement
;
44 public void navigate() {
45 final Artifact artifact
= myContext
.getArtifactModel().getArtifactByOriginal(myOriginalArtifact
);
46 final ArtifactEditorEx artifactEditor
= (ArtifactEditorEx
)myContext
.getOrCreateEditor(artifact
);
47 artifactEditor
.getLayoutTreeComponent().selectNode(myParentPath
, myPackagingElement
);
48 ProjectStructureConfigurable
.getInstance(myContext
.getProject()).select(myOriginalArtifact
, true);
52 public String
getPresentableName() {
53 return myOriginalArtifact
.getName();
57 public int hashCode() {
58 return myOriginalArtifact
.hashCode();
62 public boolean equals(Object obj
) {
63 return obj
instanceof UsageInArtifact
&& ((UsageInArtifact
)obj
).myOriginalArtifact
.equals(myOriginalArtifact
);
67 public Icon
getIcon() {
68 return myOriginalArtifact
.getArtifactType().getIcon();