Search in sources :

Example 1 with SelectInTarget

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

the class ProjectViewSelectInGroupTarget method canSelect.

@Override
public boolean canSelect(SelectInContext context) {
    ProjectView projectView = ProjectView.getInstance(context.getProject());
    Collection<SelectInTarget> targets = projectView.getSelectInTargets();
    for (SelectInTarget projectViewTarget : targets) {
        if (projectViewTarget.canSelect(context))
            return true;
    }
    return false;
}
Also used : CompositeSelectInTarget(com.intellij.ide.CompositeSelectInTarget) SelectInTarget(com.intellij.ide.SelectInTarget) ProjectView(com.intellij.ide.projectView.ProjectView)

Example 2 with SelectInTarget

use of com.intellij.ide.SelectInTarget 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)

Example 3 with SelectInTarget

use of com.intellij.ide.SelectInTarget 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 4 with SelectInTarget

use of com.intellij.ide.SelectInTarget 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

SelectInTarget (com.intellij.ide.SelectInTarget)4 CompositeSelectInTarget (com.intellij.ide.CompositeSelectInTarget)3 ProjectView (com.intellij.ide.projectView.ProjectView)2 AbstractProjectViewPane (com.intellij.ide.projectView.impl.AbstractProjectViewPane)2 NotNull (org.jetbrains.annotations.NotNull)2 Executor (com.intellij.execution.Executor)1 DefaultDebugExecutor (com.intellij.execution.executors.DefaultDebugExecutor)1 ExtensionsArea (com.intellij.openapi.extensions.ExtensionsArea)1 ActionCallback (com.intellij.openapi.util.ActionCallback)1 FocusCommand (com.intellij.openapi.wm.FocusCommand)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1