mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Remove never called EP which was used in the old implementation of the scope view
GitOrigin-RevId: 14dffa359eff931ca0e9c1893f63358983a99b79
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c2e34c3b28
commit
95838c56f4
@@ -980,7 +980,6 @@
|
||||
<navbar implementation="com.intellij.ide.navigationToolbar.JavaNavBarExtension"/>
|
||||
<gotoDeclarationHandler implementation="com.intellij.codeInsight.navigation.actions.GotoBreakContinueHandler"/>
|
||||
<lang.implementationTextSelectioner language="JAVA" implementationClass="com.intellij.codeInsight.hint.JavaImplementationTextSelectioner"/>
|
||||
<scopeTreeExpander implementation="com.intellij.ide.scopeView.ClassesScopeTreeStructureExpander"/>
|
||||
<gotoSymbolContributor implementation="com.intellij.ide.util.gotoByName.JavaModuleNavigationContributor"/>
|
||||
<gotoSymbolContributor implementation="com.intellij.ide.util.gotoByName.DefaultSymbolNavigationContributor"/>
|
||||
<gotoSymbolContributor implementation="com.intellij.ide.util.gotoByName.DefaultSymbolNavigationContributor$JavadocSeparatorContributor"/>
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.scopeView;
|
||||
|
||||
import com.intellij.ide.projectView.ProjectView;
|
||||
import com.intellij.ide.projectView.PsiClassChildrenSource;
|
||||
import com.intellij.ide.scopeView.nodes.ClassNode;
|
||||
import com.intellij.ide.scopeView.nodes.FieldNode;
|
||||
import com.intellij.ide.scopeView.nodes.MethodNode;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packageDependencies.ui.DependencyNodeComparator;
|
||||
import com.intellij.packageDependencies.ui.DirectoryNode;
|
||||
import com.intellij.packageDependencies.ui.FileNode;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.TreeExpansionEvent;
|
||||
import javax.swing.tree.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ClassesScopeTreeStructureExpander implements ScopeTreeStructureExpander {
|
||||
|
||||
private final Project myProject;
|
||||
|
||||
public ClassesScopeTreeStructureExpander(final Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
|
||||
if (myProject.isDisposed()) return;
|
||||
ProjectView projectView = ProjectView.getInstance(myProject);
|
||||
final TreePath path = event.getPath();
|
||||
if (path == null) return;
|
||||
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
|
||||
if (node instanceof DirectoryNode) {
|
||||
Set<ClassNode> classNodes = null;
|
||||
for (int i = node.getChildCount() - 1; i >= 0; i--) {
|
||||
final TreeNode childNode = node.getChildAt(i);
|
||||
if (childNode instanceof FileNode) {
|
||||
final FileNode fileNode = (FileNode)childNode;
|
||||
final PsiElement file = fileNode.getPsiElement();
|
||||
if (file instanceof PsiJavaFile) {
|
||||
final VirtualFile virtualFile = ((PsiJavaFile)file).getVirtualFile();
|
||||
if (virtualFile == null || (virtualFile.getFileType() != StdFileTypes.JAVA && virtualFile.getFileType() != StdFileTypes.CLASS)) {
|
||||
return;
|
||||
}
|
||||
final PsiClass[] psiClasses = ((PsiJavaFile)file).getClasses();
|
||||
if (psiClasses.length > 0) {
|
||||
if (classNodes == null) {
|
||||
classNodes = new HashSet<>();
|
||||
}
|
||||
|
||||
for (final PsiClass psiClass : psiClasses) {
|
||||
if (psiClass != null && psiClass.isValid()) {
|
||||
final ClassNode classNode = new ClassNode(psiClass);
|
||||
classNodes.add(classNode);
|
||||
if (projectView.isShowMembers(ScopeViewPane.ID)) {
|
||||
final List<PsiElement> result = new ArrayList<>();
|
||||
PsiClassChildrenSource.DEFAULT_CHILDREN.addChildren(psiClass, result);
|
||||
for (PsiElement psiElement : result) {
|
||||
psiElement.accept(new JavaElementVisitor() {
|
||||
@Override public void visitClass(PsiClass aClass) {
|
||||
classNode.add(new ClassNode(aClass));
|
||||
}
|
||||
|
||||
@Override public void visitMethod(PsiMethod method) {
|
||||
classNode.add(new MethodNode(method));
|
||||
}
|
||||
|
||||
@Override public void visitField(PsiField field) {
|
||||
classNode.add(new FieldNode(field));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
node.remove(fileNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (classNodes != null) {
|
||||
for (ClassNode classNode : classNodes) {
|
||||
node.add(classNode);
|
||||
}
|
||||
}
|
||||
TreeUtil.sort(node, getNodeComparator());
|
||||
final Object source = event.getSource();
|
||||
if (source instanceof JTree) {
|
||||
((DefaultTreeModel)((JTree)source).getModel()).reload(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
|
||||
final TreePath path = event.getPath();
|
||||
if (path == null) return;
|
||||
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
|
||||
if (node instanceof DirectoryNode) {
|
||||
Set<FileNode> fileNodes = null;
|
||||
for (int i = node.getChildCount() - 1; i >= 0; i--) {
|
||||
final TreeNode childNode = node.getChildAt(i);
|
||||
if (childNode instanceof ClassNode) {
|
||||
final ClassNode classNode = (ClassNode)childNode;
|
||||
final PsiFile containingFile = classNode.getContainingFile();
|
||||
if (containingFile != null && containingFile.isValid()) {
|
||||
if (fileNodes == null) {
|
||||
fileNodes = new HashSet<>();
|
||||
}
|
||||
fileNodes.add(new FileNode(containingFile.getVirtualFile(), myProject, true));
|
||||
}
|
||||
node.remove(classNode);
|
||||
}
|
||||
}
|
||||
if (fileNodes != null) {
|
||||
for (FileNode fileNode : fileNodes) {
|
||||
node.add(fileNode);
|
||||
}
|
||||
}
|
||||
TreeUtil.sort(node, getNodeComparator());
|
||||
final Object source = event.getSource();
|
||||
if (source instanceof JTree) {
|
||||
((DefaultTreeModel)((JTree)source).getModel()).reload(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DependencyNodeComparator getNodeComparator() {
|
||||
return new DependencyNodeComparator(ProjectView.getInstance(myProject).isSortByType(ScopeViewPane.ID));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.ide.scopeView;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
|
||||
import javax.swing.event.TreeWillExpandListener;
|
||||
|
||||
public interface ScopeTreeStructureExpander extends TreeWillExpandListener {
|
||||
ExtensionPointName<ScopeTreeStructureExpander> EP_NAME = ExtensionPointName.create("com.intellij.scopeTreeExpander");
|
||||
}
|
||||
@@ -64,6 +64,7 @@ import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -80,6 +81,11 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @deprecated This class is no longer used in IntelliJ IDEA and will be removed. The Scope view is implemented via the ScopeViewPane class.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2021.2")
|
||||
public class ScopeTreeViewPanel extends JPanel implements Disposable {
|
||||
private static final Logger LOG = Logger.getInstance(ScopeTreeViewPanel.class);
|
||||
|
||||
@@ -231,13 +237,7 @@ public class ScopeTreeViewPanel extends JPanel implements Disposable {
|
||||
new TreeSpeedSearch(myTree);
|
||||
myCopyPasteDelegator = new CopyPasteDelegator(myProject, this);
|
||||
myTreeExpansionMonitor = PackageTreeExpansionMonitor.install(myTree, myProject);
|
||||
final ScopeTreeStructureExpander[] extensions = ScopeTreeStructureExpander.EP_NAME.getExtensions(myProject);
|
||||
for (ScopeTreeStructureExpander expander : extensions) {
|
||||
myTree.addTreeWillExpandListener(expander);
|
||||
}
|
||||
if (extensions.length == 0) {
|
||||
myTree.addTreeWillExpandListener(new SortingExpandListener());
|
||||
}
|
||||
myTree.addTreeWillExpandListener(new SortingExpandListener());
|
||||
myTree.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
|
||||
@@ -275,7 +275,6 @@
|
||||
<extensionPoint name="serviceViewContributor" interface="com.intellij.execution.services.ServiceViewContributor" dynamic="true"/>
|
||||
|
||||
<extensionPoint name="hectorComponentProvider" interface="com.intellij.openapi.editor.HectorComponentPanelsProvider" area="IDEA_PROJECT" dynamic="true"/>
|
||||
<extensionPoint name="scopeTreeExpander" interface="com.intellij.ide.scopeView.ScopeTreeStructureExpander" area="IDEA_PROJECT"/>
|
||||
|
||||
<extensionPoint name="psi.referenceProvider" beanClass="com.intellij.psi.PsiReferenceProviderBean">
|
||||
<with attribute="providerClass" implements="com.intellij.psi.PsiReferenceProvider"/>
|
||||
|
||||
Reference in New Issue
Block a user