mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
artifact editor ui fixes
This commit is contained in:
@@ -48,6 +48,11 @@ public class ArtifactElementPresentation extends TreeNodePresentation {
|
||||
return myArtifact != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSourceObject() {
|
||||
return myArtifact;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigateToSource() {
|
||||
myContext.selectArtifact(myArtifact);
|
||||
|
||||
+3
@@ -170,4 +170,7 @@ public class ArtifactEditorContextImpl implements ArtifactEditorContext {
|
||||
return dialog.isOK() ? dialog.getChosenElements() : Collections.<Library>emptyList();
|
||||
}
|
||||
|
||||
public ArtifactsStructureConfigurableContext getParent() {
|
||||
return myParent;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -289,7 +289,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx {
|
||||
popupActionGroup.add(Separator.getInstance());
|
||||
popupActionGroup.add(new HideContentAction(this));
|
||||
popupActionGroup.add(new LayoutTreeNavigateAction(myLayoutTreeComponent));
|
||||
popupActionGroup.add(new LayoutTreeFindUsagesAction(myLayoutTreeComponent, myProject));
|
||||
popupActionGroup.add(new LayoutTreeFindUsagesAction(myLayoutTreeComponent, myProject, myContext.getParent()));
|
||||
|
||||
popupActionGroup.add(Separator.getInstance());
|
||||
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
|
||||
|
||||
+9
-1
@@ -19,12 +19,15 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactProjectStructureElement;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurableContext;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.nodes.ArtifactsTreeNode;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.FindUsagesInProjectStructureActionBase;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -36,10 +39,12 @@ import java.awt.*;
|
||||
*/
|
||||
public abstract class ArtifactEditorFindUsagesActionBase extends FindUsagesInProjectStructureActionBase {
|
||||
private Tree myTree;
|
||||
private ArtifactsStructureConfigurableContext myArtifactContext;
|
||||
|
||||
public ArtifactEditorFindUsagesActionBase(Tree tree, Project project) {
|
||||
public ArtifactEditorFindUsagesActionBase(Tree tree, Project project, ArtifactsStructureConfigurableContext artifactContext) {
|
||||
super(tree, project);
|
||||
myTree = tree;
|
||||
myArtifactContext = artifactContext;
|
||||
}
|
||||
|
||||
protected boolean isEnabled() {
|
||||
@@ -61,6 +66,9 @@ public abstract class ArtifactEditorFindUsagesActionBase extends FindUsagesInPro
|
||||
else if (sourceObject instanceof Library) {
|
||||
return new LibraryProjectStructureElement(context, (Library)sourceObject);
|
||||
}
|
||||
else if (sourceObject instanceof Artifact) {
|
||||
return new ArtifactProjectStructureElement(context, myArtifactContext, (Artifact)sourceObject);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.roots.ui.configuration.artifacts.actions;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurableContext;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.LayoutTreeComponent;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.nodes.ArtifactsTreeNode;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -26,8 +27,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class LayoutTreeFindUsagesAction extends ArtifactEditorFindUsagesActionBase {
|
||||
private LayoutTreeComponent myLayoutTreeComponent;
|
||||
|
||||
public LayoutTreeFindUsagesAction(LayoutTreeComponent layoutTreeComponent, Project project) {
|
||||
super(layoutTreeComponent.getLayoutTree(), project);
|
||||
public LayoutTreeFindUsagesAction(LayoutTreeComponent layoutTreeComponent, Project project, ArtifactsStructureConfigurableContext artifactContext) {
|
||||
super(layoutTreeComponent.getLayoutTree(), project, artifactContext);
|
||||
myLayoutTreeComponent = layoutTreeComponent;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ public class SourceItemsTree implements DnDSource, Disposable{
|
||||
|
||||
group.add(Separator.getInstance());
|
||||
group.add(new SourceItemNavigateAction(this));
|
||||
group.add(new SourceItemFindUsagesAction(this, myArtifactsEditor.getContext().getProject()));
|
||||
group.add(new SourceItemFindUsagesAction(this, myArtifactsEditor.getContext().getProject(), myArtifactsEditor.getContext().getParent()));
|
||||
|
||||
DefaultTreeExpander expander = new DefaultTreeExpander(myTree);
|
||||
final CommonActionsManager commonActionsManager = CommonActionsManager.getInstance();
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.actions;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurableContext;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.actions.ArtifactEditorFindUsagesActionBase;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.nodes.ArtifactsTreeNode;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.sourceItems.SourceItemNode;
|
||||
@@ -29,8 +30,8 @@ import java.util.List;
|
||||
public class SourceItemFindUsagesAction extends ArtifactEditorFindUsagesActionBase {
|
||||
private final SourceItemsTree myTree;
|
||||
|
||||
public SourceItemFindUsagesAction(SourceItemsTree tree, Project project) {
|
||||
super(tree.getTree(), project);
|
||||
public SourceItemFindUsagesAction(SourceItemsTree tree, Project project, ArtifactsStructureConfigurableContext artifactContext) {
|
||||
super(tree.getTree(), project, artifactContext);
|
||||
myTree = tree;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user