diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java index 4553ef72b636..2bd62a80b4da 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SelectInAction.java @@ -18,7 +18,10 @@ import com.intellij.util.ui.EmptyIcon; import org.jetbrains.annotations.NotNull; import javax.swing.*; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; public final class SelectInAction extends AnAction implements DumbAware { @Override @@ -51,7 +54,7 @@ public final class SelectInAction extends AnAction implements DumbAware { } private static void invoke(@NotNull DataContext dataContext, @NotNull SelectInContext context) { - final List targetVector = Arrays.asList(SelectInManager.getInstance(context.getProject()).getTargets()); + List targetVector = SelectInManager.getInstance(context.getProject()).getTargetList(); ListPopup popup; if (targetVector.isEmpty()) { DefaultActionGroup group = new DefaultActionGroup(); diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java index 4b371b2ea120..6c891426a01d 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java @@ -2141,8 +2141,8 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo String selectInShortcut = KeymapUtil.getFirstKeyboardShortcutText("SelectIn"); if (!selectInShortcut.isEmpty()) { - SelectInTarget[] targets = SelectInManager.getInstance(myProject).getTargets(); - int index = ContainerUtil.indexOf(Arrays.asList(targets), (target) -> target instanceof ProjectViewSelectInGroupTarget); + List targets = SelectInManager.getInstance(myProject).getTargetList(); + int index = ContainerUtil.indexOf(targets, (target) -> target instanceof ProjectViewSelectInGroupTarget); if (index >= 0) { return " (" + selectInShortcut + ", " + (index + 1) + ")"; } @@ -2174,16 +2174,6 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo return pane != null ? pane.getReady(requestor) : ActionCallback.DONE; } - @NotNull - public ToggleAction getAutoScrollToSourceAction() { - return Action.AUTOSCROLL_TO_SOURCE; - } - - @NotNull - public ToggleAction getAutoScrollFromSourceAction() { - return Action.AUTOSCROLL_FROM_SOURCE; - } - private void updatePanes(boolean withComparator) { for (AbstractProjectViewPane pane : myId2Pane.values()) { JTree tree = pane.getTree(); diff --git a/platform/platform-api/src/com/intellij/ide/SelectInManager.java b/platform/platform-api/src/com/intellij/ide/SelectInManager.java index 51d399c6a796..db46048a074c 100644 --- a/platform/platform-api/src/com/intellij/ide/SelectInManager.java +++ b/platform/platform-api/src/com/intellij/ide/SelectInManager.java @@ -4,10 +4,10 @@ package com.intellij.ide; import com.intellij.openapi.extensions.SimpleSmartExtensionPoint; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; -import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Objects; @@ -39,12 +39,19 @@ public final class SelectInManager { myTargets.removeExplicitExtension(target); } - public SelectInTarget[] getTargets() { - List targets = myTargets.getExtensions(); + @NotNull + public List getTargetList() { + List targets = new ArrayList<>(myTargets.getExtensions()); if (DumbService.getInstance(myProject).isDumb()) { - targets = ContainerUtil.filter(targets, target -> DumbService.isDumbAware(target)); + targets.removeIf(target -> !DumbService.isDumbAware(target)); } - return ContainerUtil.sorted(targets, SelectInTargetComparator.INSTANCE).toArray(new SelectInTarget[0]); + targets.sort(SelectInTargetComparator.INSTANCE); + return targets; + } + + @NotNull + public SelectInTarget[] getTargets() { + return getTargetList().toArray(new SelectInTarget[0]); } public static SelectInManager getInstance(@NotNull Project project) { @@ -53,7 +60,7 @@ public final class SelectInManager { public static SelectInTarget findSelectInTarget(@NotNull String id, Project project) { SelectInManager manager = project == null || project.isDisposed() ? null : getInstance(project); - SelectInTarget[] targets = manager == null ? null : manager.getTargets(); + List targets = manager == null ? null : manager.getTargetList(); if (targets != null) { for (SelectInTarget target : targets) { if (target != null && Objects.equals(id, target.getToolWindowId())) { diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java b/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java index f96013d5120e..7fb03677797f 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java +++ b/platform/platform-api/src/com/intellij/openapi/fileEditor/OpenFileDescriptor.java @@ -161,8 +161,10 @@ public class OpenFileDescriptor implements Navigatable, Comparable