Search in sources :

Example 11 with ProjectView

use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.

the class AbstractProjectViewPane method doSelectModuleOrGroup.

private void doSelectModuleOrGroup(final Object toSelect, final boolean requestFocus) {
    ToolWindowManager windowManager = ToolWindowManager.getInstance(myProject);
    final Runnable runnable = () -> {
        ProjectView projectView = ProjectView.getInstance(myProject);
        if (requestFocus) {
            projectView.changeView(getId(), getSubId());
        }
        ((BaseProjectTreeBuilder) getTreeBuilder()).selectInWidth(toSelect, requestFocus, node -> node instanceof AbstractModuleNode || node instanceof ModuleGroupNode || node instanceof AbstractProjectNode);
    };
    if (requestFocus) {
        windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW).activate(runnable);
    } else {
        runnable.run();
    }
}
Also used : com.intellij.openapi.util(com.intellij.openapi.util) AbstractProjectNode(com.intellij.ide.projectView.impl.nodes.AbstractProjectNode) VirtualFileWindow(com.intellij.injected.editor.VirtualFileWindow) UIUtil(com.intellij.util.ui.UIUtil) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) BaseProjectTreeBuilder(com.intellij.ide.projectView.BaseProjectTreeBuilder) com.intellij.ide.util.treeView(com.intellij.ide.util.treeView) VirtualFile(com.intellij.openapi.vfs.VirtualFile) HashMap(com.intellij.util.containers.HashMap) ProjectView(com.intellij.ide.projectView.ProjectView) Map(java.util.Map) MoveHandler(com.intellij.refactoring.move.MoveHandler) CommonDataKeys(com.intellij.openapi.actionSystem.CommonDataKeys) Module(com.intellij.openapi.module.Module) ReflectionUtil(com.intellij.util.ReflectionUtil) AbstractModuleNode(com.intellij.ide.projectView.impl.nodes.AbstractModuleNode) ModuleUtilCore(com.intellij.openapi.module.ModuleUtilCore) TreePath(javax.swing.tree.TreePath) BufferedImage(java.awt.image.BufferedImage) DnDAwareTree(com.intellij.ide.dnd.aware.DnDAwareTree) SelectInTarget(com.intellij.ide.SelectInTarget) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Nullable(org.jetbrains.annotations.Nullable) List(java.util.List) ModuleRootManager(com.intellij.openapi.roots.ModuleRootManager) IdeFocusManager(com.intellij.openapi.wm.IdeFocusManager) PsiUtilCore(com.intellij.psi.util.PsiUtilCore) ApplicationManager(com.intellij.openapi.application.ApplicationManager) Registry(com.intellij.openapi.util.registry.Registry) DataProvider(com.intellij.openapi.actionSystem.DataProvider) com.intellij.psi(com.intellij.psi) NotNull(org.jetbrains.annotations.NotNull) ArrayUtil(com.intellij.util.ArrayUtil) DataContext(com.intellij.openapi.actionSystem.DataContext) TreeNode(javax.swing.tree.TreeNode) Transferable(java.awt.datatransfer.Transferable) NonNls(org.jetbrains.annotations.NonNls) DnDConstants(java.awt.dnd.DnDConstants) ContainerUtil(com.intellij.util.containers.ContainerUtil) ArrayList(java.util.ArrayList) PsiCopyPasteManager(com.intellij.ide.PsiCopyPasteManager) PsiDirectoryNode(com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode) ToolWindowId(com.intellij.openapi.wm.ToolWindowId) Project(com.intellij.openapi.project.Project) com.intellij.ide.dnd(com.intellij.ide.dnd) DataManager(com.intellij.ide.DataManager) TreeUtil(com.intellij.util.ui.tree.TreeUtil) Disposable(com.intellij.openapi.Disposable) File(java.io.File) ExtensionPointName(com.intellij.openapi.extensions.ExtensionPointName) java.awt(java.awt) WolfTheProblemSolver(com.intellij.problems.WolfTheProblemSolver) Navigatable(com.intellij.pom.Navigatable) Element(org.jdom.Element) Collections(java.util.Collections) ModuleGroupNode(com.intellij.ide.projectView.impl.nodes.ModuleGroupNode) javax.swing(javax.swing) AbstractModuleNode(com.intellij.ide.projectView.impl.nodes.AbstractModuleNode) AbstractProjectNode(com.intellij.ide.projectView.impl.nodes.AbstractProjectNode) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ProjectView(com.intellij.ide.projectView.ProjectView) ModuleGroupNode(com.intellij.ide.projectView.impl.nodes.ModuleGroupNode)

Example 12 with ProjectView

use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.

the class AbstractProjectViewPane method installComparator.

public void installComparator(AbstractTreeBuilder treeBuilder) {
    final ProjectView projectView = ProjectView.getInstance(myProject);
    treeBuilder.setNodeDescriptorComparator(new GroupByTypeComparator(projectView, getId()));
}
Also used : ProjectView(com.intellij.ide.projectView.ProjectView)

Example 13 with ProjectView

use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.

the class ProjectViewFixture method selectAndroidPane.

@NotNull
public PaneFixture selectAndroidPane() {
    activate();
    final ProjectView projectView = ProjectView.getInstance(myProject);
    pause(new Condition("Project view is initialized") {

        @Override
        public boolean test() {
            //noinspection ConstantConditions
            return field("isInitialized").ofType(boolean.class).in(projectView).get();
        }
    }, SHORT_TIMEOUT);
    final String id = "AndroidView";
    GuiActionRunner.execute(new GuiTask() {

        @Override
        protected void executeInEDT() throws Throwable {
            projectView.changeView(id);
        }
    });
    return new PaneFixture(projectView.getProjectViewPaneById(id));
}
Also used : Condition(org.fest.swing.timing.Condition) GuiTask(org.fest.swing.edt.GuiTask) ProjectView(com.intellij.ide.projectView.ProjectView) Assert.assertNotNull(org.junit.Assert.assertNotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with ProjectView

use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.

the class ProjectViewFixture method selectProjectPane.

@NotNull
public PaneFixture selectProjectPane() {
    activate();
    final ProjectView projectView = ProjectView.getInstance(myProject);
    pause(new Condition("Project view is initialized") {

        @Override
        public boolean test() {
            //noinspection ConstantConditions
            return field("isInitialized").ofType(boolean.class).in(projectView).get();
        }
    }, SHORT_TIMEOUT);
    final String id = "ProjectPane";
    GuiActionRunner.execute(new GuiTask() {

        @Override
        protected void executeInEDT() throws Throwable {
            projectView.changeView(id);
        }
    });
    return new PaneFixture(projectView.getProjectViewPaneById(id));
}
Also used : Condition(org.fest.swing.timing.Condition) GuiTask(org.fest.swing.edt.GuiTask) ProjectView(com.intellij.ide.projectView.ProjectView) Assert.assertNotNull(org.junit.Assert.assertNotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with ProjectView

use of com.intellij.ide.projectView.ProjectView in project intellij-community by JetBrains.

the class ProjectViewSelectInGroupTarget method selectIn.

@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
    ProjectView projectView = ProjectView.getInstance(context.getProject());
    Collection<SelectInTarget> targets = projectView.getSelectInTargets();
    Collection<SelectInTarget> targetsToCheck = new LinkedHashSet<>();
    String currentId = projectView.getCurrentViewId();
    for (SelectInTarget projectViewTarget : targets) {
        if (Comparing.equal(currentId, projectViewTarget.getMinorViewId())) {
            targetsToCheck.add(projectViewTarget);
            break;
        }
    }
    targetsToCheck.addAll(targets);
    for (final SelectInTarget target : targetsToCheck) {
        if (target.canSelect(context)) {
            if (requestFocus) {
                IdeFocusManager.getInstance(context.getProject()).requestFocus(new FocusCommand() {

                    @NotNull
                    @Override
                    public ActionCallback run() {
                        target.selectIn(context, requestFocus);
                        return ActionCallback.DONE;
                    }
                }, true);
            } else {
                target.selectIn(context, requestFocus);
            }
            break;
        }
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ActionCallback(com.intellij.openapi.util.ActionCallback) CompositeSelectInTarget(com.intellij.ide.CompositeSelectInTarget) SelectInTarget(com.intellij.ide.SelectInTarget) ProjectView(com.intellij.ide.projectView.ProjectView) FocusCommand(com.intellij.openapi.wm.FocusCommand) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ProjectView (com.intellij.ide.projectView.ProjectView)19 NotNull (org.jetbrains.annotations.NotNull)8 Project (com.intellij.openapi.project.Project)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 SelectInTarget (com.intellij.ide.SelectInTarget)3 AbstractProjectViewPane (com.intellij.ide.projectView.impl.AbstractProjectViewPane)3 Module (com.intellij.openapi.module.Module)3 ActionCallback (com.intellij.openapi.util.ActionCallback)3 ToolWindow (com.intellij.openapi.wm.ToolWindow)3 CompositeSelectInTarget (com.intellij.ide.CompositeSelectInTarget)2 DataContext (com.intellij.openapi.actionSystem.DataContext)2 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)2 ArrayList (java.util.ArrayList)2 GuiTask (org.fest.swing.edt.GuiTask)2 Condition (org.fest.swing.timing.Condition)2 Assert.assertNotNull (org.junit.Assert.assertNotNull)2 DataManager (com.intellij.ide.DataManager)1 PsiCopyPasteManager (com.intellij.ide.PsiCopyPasteManager)1 com.intellij.ide.dnd (com.intellij.ide.dnd)1 DnDAwareTree (com.intellij.ide.dnd.aware.DnDAwareTree)1