mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
GitOrigin-RevId: df3d61b082d222418750c2ff82740bb7338dc587
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c7f4dd5637
commit
492fc8ac07
@@ -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<SelectInTarget> targetVector = Arrays.asList(SelectInManager.getInstance(context.getProject()).getTargets());
|
||||
List<SelectInTarget> targetVector = SelectInManager.getInstance(context.getProject()).getTargetList();
|
||||
ListPopup popup;
|
||||
if (targetVector.isEmpty()) {
|
||||
DefaultActionGroup group = new DefaultActionGroup();
|
||||
|
||||
@@ -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<SelectInTarget> 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();
|
||||
|
||||
@@ -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<SelectInTarget> targets = myTargets.getExtensions();
|
||||
@NotNull
|
||||
public List<SelectInTarget> getTargetList() {
|
||||
List<SelectInTarget> 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<SelectInTarget> targets = manager == null ? null : manager.getTargetList();
|
||||
if (targets != null) {
|
||||
for (SelectInTarget target : targets) {
|
||||
if (target != null && Objects.equals(id, target.getToolWindowId())) {
|
||||
|
||||
@@ -161,8 +161,10 @@ public class OpenFileDescriptor implements Navigatable, Comparable<OpenFileDescr
|
||||
|
||||
private boolean navigateInProjectView(boolean requestFocus) {
|
||||
SelectInContext context = new FileSelectInContext(myProject, myFile, null);
|
||||
for (SelectInTarget target : SelectInManager.getInstance(myProject).getTargets()) {
|
||||
if (context.selectIn(target, requestFocus)) return true;
|
||||
for (SelectInTarget target : SelectInManager.getInstance(myProject).getTargetList()) {
|
||||
if (context.selectIn(target, requestFocus)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user