mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEADEV-40673: Artifacts: seems that Find usages action does nothing
This commit is contained in:
+12
-2
@@ -24,6 +24,7 @@ import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
|
||||
import com.intellij.packaging.impl.artifacts.PackagingElementProcessor;
|
||||
import com.intellij.packaging.impl.elements.ArtifactPackagingElement;
|
||||
import com.intellij.packaging.impl.elements.LibraryPackagingElement;
|
||||
import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -39,10 +40,10 @@ public class ArtifactProjectStructureElement extends ProjectStructureElement {
|
||||
private final Artifact myOriginalArtifact;
|
||||
|
||||
public ArtifactProjectStructureElement(StructureConfigurableContext context,
|
||||
ArtifactsStructureConfigurableContext artifactsStructureContext, Artifact originalArtifact) {
|
||||
ArtifactsStructureConfigurableContext artifactsStructureContext, Artifact artifact) {
|
||||
super(context);
|
||||
myArtifactsStructureContext = artifactsStructureContext;
|
||||
myOriginalArtifact = originalArtifact;
|
||||
myOriginalArtifact = artifactsStructureContext.getOriginalArtifact(artifact);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,6 +71,15 @@ public class ArtifactProjectStructureElement extends ProjectStructureElement {
|
||||
ArtifactProjectStructureElement.this, getPathFromRoot(parents, "/"), packagingElement));
|
||||
}
|
||||
}
|
||||
else if (packagingElement instanceof ArtifactPackagingElement) {
|
||||
final Artifact usedArtifact = ((ArtifactPackagingElement)packagingElement).findArtifact(myArtifactsStructureContext);
|
||||
if (usedArtifact != null) {
|
||||
final ArtifactProjectStructureElement artifactElement =
|
||||
new ArtifactProjectStructureElement(myContext, myArtifactsStructureContext, usedArtifact);
|
||||
usages.add(new UsageInArtifact(myOriginalArtifact, myArtifactsStructureContext, artifactElement,
|
||||
ArtifactProjectStructureElement.this, getPathFromRoot(parents, "/"), packagingElement));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, myArtifactsStructureContext, false, artifact.getArtifactType());
|
||||
|
||||
+3
@@ -39,4 +39,7 @@ public interface ArtifactsStructureConfigurableContext extends PackagingElementR
|
||||
void editLayout(@NotNull Artifact artifact, Runnable action);
|
||||
|
||||
ArtifactEditor getOrCreateEditor(Artifact artifact);
|
||||
|
||||
@NotNull
|
||||
Artifact getOriginalArtifact(@NotNull Artifact artifact);
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ class ArtifactsStructureConfigurableContextImpl implements ArtifactsStructureCon
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Artifact getOriginalArtifact(@NotNull Artifact artifact) {
|
||||
public Artifact getOriginalArtifact(@NotNull Artifact artifact) {
|
||||
if (myModifiableModel != null) {
|
||||
return ((ArtifactModelImpl)myModifiableModel).getOriginalArtifact(artifact);
|
||||
}
|
||||
|
||||
+6
-3
@@ -43,9 +43,12 @@ public class UsageInArtifact extends ProjectStructureElementUsage {
|
||||
@Override
|
||||
public void navigate() {
|
||||
final Artifact artifact = myContext.getArtifactModel().getArtifactByOriginal(myOriginalArtifact);
|
||||
final ArtifactEditorEx artifactEditor = (ArtifactEditorEx)myContext.getOrCreateEditor(artifact);
|
||||
artifactEditor.getLayoutTreeComponent().selectNode(myParentPath, myPackagingElement);
|
||||
ProjectStructureConfigurable.getInstance(myContext.getProject()).select(myOriginalArtifact, true);
|
||||
ProjectStructureConfigurable.getInstance(myContext.getProject()).select(myOriginalArtifact, true).doWhenDone(new Runnable() {
|
||||
public void run() {
|
||||
final ArtifactEditorEx artifactEditor = (ArtifactEditorEx)myContext.getOrCreateEditor(artifact);
|
||||
artifactEditor.getLayoutTreeComponent().selectNode(myParentPath, myPackagingElement);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user