Search in sources :

Example 11 with AbstractProjectViewPane

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

the class MoveModulesToGroupAction method doMove.

public static void doMove(final Module[] modules, final ModuleGroup group, @Nullable final DataContext dataContext) {
    Project project = modules[0].getProject();
    for (final Module module : modules) {
        ModifiableModuleModel model = dataContext != null ? LangDataKeys.MODIFIABLE_MODULE_MODEL.getData(dataContext) : null;
        if (model != null) {
            model.setModuleGroupPath(module, group == null ? null : group.getGroupPath());
        } else {
            ModuleManagerImpl.getInstanceImpl(project).setModuleGroupPath(module, group == null ? null : group.getGroupPath());
        }
    }
    AbstractProjectViewPane pane = ProjectView.getInstance(project).getCurrentProjectViewPane();
    if (pane != null) {
        pane.updateFromRoot(true);
    }
    if (!ProjectSettingsService.getInstance(project).processModulesMoved(modules, group) && pane != null) {
        if (group != null) {
            pane.selectModuleGroup(group, true);
        } else {
            pane.selectModule(modules[0], true);
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) ModifiableModuleModel(com.intellij.openapi.module.ModifiableModuleModel) Module(com.intellij.openapi.module.Module) AbstractProjectViewPane(com.intellij.ide.projectView.impl.AbstractProjectViewPane)

Example 12 with AbstractProjectViewPane

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

the class ProjectViewSelectInTarget method select.

@NotNull
public static ActionCallback select(@NotNull Project project, final Object toSelect, @Nullable final String viewId, @Nullable final String subviewId, final VirtualFile virtualFile, final boolean requestFocus) {
    final ActionCallback result = new ActionCallback();
    final ProjectView projectView = ProjectView.getInstance(project);
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        AbstractProjectViewPane pane = projectView.getProjectViewPaneById(ProjectViewPane.ID);
        pane.select(toSelect, virtualFile, requestFocus);
        return result;
    }
    ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
    final ToolWindow projectViewToolWindow = windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW);
    final Runnable runnable = () -> {
        Runnable r = () -> projectView.selectCB(toSelect, virtualFile, requestFocus).notify(result);
        projectView.changeViewCB(ObjectUtils.chooseNotNull(viewId, ProjectViewPane.ID), subviewId).doWhenProcessed(r);
    };
    if (requestFocus) {
        projectViewToolWindow.activate(runnable, true);
    } else {
        projectViewToolWindow.show(runnable);
    }
    return result;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ActionCallback(com.intellij.openapi.util.ActionCallback) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ProjectView(com.intellij.ide.projectView.ProjectView) AbstractProjectViewPane(com.intellij.ide.projectView.impl.AbstractProjectViewPane) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with AbstractProjectViewPane

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

the class ProjectViewSelectInTarget method getSubTargets.

@Override
@NotNull
public Collection<SelectInTarget> getSubTargets(@NotNull SelectInContext context) {
    List<SelectInTarget> result = new ArrayList<>();
    AbstractProjectViewPane pane = ProjectView.getInstance(myProject).getProjectViewPaneById(getMinorViewId());
    int index = 0;
    for (String subId : pane.getSubIds()) {
        result.add(new ProjectSubViewSelectInTarget(this, subId, index++));
    }
    return result;
}
Also used : CompositeSelectInTarget(com.intellij.ide.CompositeSelectInTarget) SelectInTarget(com.intellij.ide.SelectInTarget) ArrayList(java.util.ArrayList) AbstractProjectViewPane(com.intellij.ide.projectView.impl.AbstractProjectViewPane) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with AbstractProjectViewPane

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

the class PyCharmEduInitialConfigurator method patchProjectAreaExtensions.

private static void patchProjectAreaExtensions(@NotNull final Project project) {
    Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
    unregisterAction(debugExecutor.getId(), ExecutorRegistryImpl.RUNNERS_GROUP);
    unregisterAction(debugExecutor.getContextActionId(), ExecutorRegistryImpl.RUN_CONTEXT_GROUP);
    ExtensionsArea projectArea = Extensions.getArea(project);
    for (SelectInTarget target : Extensions.getExtensions(SelectInTarget.EP_NAME, project)) {
        if (ToolWindowId.FAVORITES_VIEW.equals(target.getToolWindowId()) || ToolWindowId.STRUCTURE_VIEW.equals(target.getToolWindowId())) {
            projectArea.getExtensionPoint(SelectInTarget.EP_NAME).unregisterExtension(target);
        }
    }
    for (AbstractProjectViewPane pane : Extensions.getExtensions(AbstractProjectViewPane.EP_NAME, project)) {
        if (pane.getId().equals(ScopeViewPane.ID)) {
            Disposer.dispose(pane);
            projectArea.getExtensionPoint(AbstractProjectViewPane.EP_NAME).unregisterExtension(pane);
        }
    }
}
Also used : ExtensionsArea(com.intellij.openapi.extensions.ExtensionsArea) DefaultDebugExecutor(com.intellij.execution.executors.DefaultDebugExecutor) Executor(com.intellij.execution.Executor) SelectInTarget(com.intellij.ide.SelectInTarget) AbstractProjectViewPane(com.intellij.ide.projectView.impl.AbstractProjectViewPane)

Aggregations

AbstractProjectViewPane (com.intellij.ide.projectView.impl.AbstractProjectViewPane)14 NotNull (org.jetbrains.annotations.NotNull)6 Module (com.intellij.openapi.module.Module)4 AndroidProjectViewPane (com.android.tools.idea.navigator.AndroidProjectViewPane)3 ProjectView (com.intellij.ide.projectView.ProjectView)3 Project (com.intellij.openapi.project.Project)3 PsiDirectory (com.intellij.psi.PsiDirectory)3 ArrayList (java.util.ArrayList)3 IdeView (com.intellij.ide.IdeView)2 SelectInTarget (com.intellij.ide.SelectInTarget)2 InputValidator (com.intellij.openapi.ui.InputValidator)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 Executor (com.intellij.execution.Executor)1 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)1 CompositeSelectInTarget (com.intellij.ide.CompositeSelectInTarget)1 FavoriteNodeProvider (com.intellij.ide.favoritesTreeView.FavoriteNodeProvider)1 ModuleGroup (com.intellij.ide.projectView.impl.ModuleGroup)1 AbstractTreeBuilder (com.intellij.ide.util.treeView.AbstractTreeBuilder)1 AbstractTreeNode (com.intellij.ide.util.treeView.AbstractTreeNode)1 ResourceBundle (com.intellij.lang.properties.ResourceBundle)1