mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javac ast indices: test ui; add hierarchy information
This commit is contained in:
+1
-3
@@ -65,9 +65,7 @@ public class CompilerReferenceHierarchyTestInfo {
|
||||
if (isEnabled()) {
|
||||
final DefaultMutableTreeNode knownOccurrences = new DefaultMutableTreeNode("Known hierarchy direct children");
|
||||
node.add(knownOccurrences);
|
||||
getHierarchyChildren().forEach(e -> {
|
||||
knownOccurrences.add(new DefaultMutableTreeNode(e));
|
||||
});
|
||||
getHierarchyChildren().forEach(e -> knownOccurrences.add(new DefaultMutableTreeNode(e)));
|
||||
|
||||
final DefaultMutableTreeNode dirtyModules = new DefaultMutableTreeNode("Dirty modules");
|
||||
node.add(dirtyModules);
|
||||
|
||||
+14
@@ -23,7 +23,10 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowAnchor;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFunctionalExpression;
|
||||
import com.intellij.psi.presentation.java.ClassPresentationUtil;
|
||||
import com.intellij.psi.presentation.java.SymbolPresentationUtil;
|
||||
import com.intellij.ui.ColoredTreeCellRenderer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
@@ -66,6 +69,10 @@ public class InternalCompilerRefServiceView extends JPanel implements DataProvid
|
||||
append(((VirtualFile)userObject).getName());
|
||||
append(" in ");
|
||||
append(((VirtualFile)userObject).getParent().getPath(), SimpleTextAttributes.GRAY_ATTRIBUTES);
|
||||
} else if (userObject instanceof PsiFunctionalExpression) {
|
||||
append(ClassPresentationUtil.getFunctionalExpressionPresentation((PsiFunctionalExpression)userObject, true));
|
||||
} else if (userObject instanceof PsiClass) {
|
||||
append(ClassPresentationUtil.getNameForClass((PsiClass)userObject, true));
|
||||
} else {
|
||||
append(userObject.toString());
|
||||
}
|
||||
@@ -97,6 +104,13 @@ public class InternalCompilerRefServiceView extends JPanel implements DataProvid
|
||||
((DefaultTreeModel)view.myTree.getModel()).setRoot(node);
|
||||
}
|
||||
|
||||
public static void showHierarchyInfo(CompilerReferenceHierarchyTestInfo info, PsiElement element) {
|
||||
final InternalCompilerRefServiceView view = getView(element);
|
||||
final DefaultMutableTreeNode node = info.asTree();
|
||||
node.setUserObject(element);
|
||||
((DefaultTreeModel)view.myTree.getModel()).setRoot(node);
|
||||
}
|
||||
|
||||
public static InternalCompilerRefServiceView getView(PsiElement element) {
|
||||
Project project = element.getProject();
|
||||
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
|
||||
|
||||
+5
-3
@@ -29,8 +29,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TestCompilerReferenceServiceFunctionalExpressionSearchAction extends TestCompilerReferenceServiceAction {
|
||||
|
||||
public TestCompilerReferenceServiceFunctionalExpressionSearchAction(String text) {
|
||||
super(text);
|
||||
public TestCompilerReferenceServiceFunctionalExpressionSearchAction() {
|
||||
super("Compiler Reference Functional Expression Search");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -40,7 +40,9 @@ public class TestCompilerReferenceServiceFunctionalExpressionSearchAction extend
|
||||
final CompilerReferenceServiceImpl compilerReferenceService = (CompilerReferenceServiceImpl)CompilerReferenceService.getInstance(
|
||||
project);
|
||||
final GlobalSearchScope scope = GlobalSearchScopeUtil.toGlobalSearchScope(element.getUseScope(), project);
|
||||
compilerReferenceService.getTestFunExpressions((PsiNamedElement)element, scope, StdFileTypes.JAVA);
|
||||
final CompilerReferenceHierarchyTestInfo hierarchyTestInfo =
|
||||
compilerReferenceService.getTestFunExpressions((PsiNamedElement)element, scope, StdFileTypes.JAVA);
|
||||
InternalCompilerRefServiceView.showHierarchyInfo(hierarchyTestInfo, element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -27,8 +27,8 @@ import com.intellij.psi.search.GlobalSearchScopeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TestCompilerReferenceServiceInheritanceAction extends TestCompilerReferenceServiceAction {
|
||||
public TestCompilerReferenceServiceInheritanceAction(String text) {
|
||||
super(text);
|
||||
public TestCompilerReferenceServiceInheritanceAction() {
|
||||
super("Compiler Reference Direct Inheritor Search");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,6 +41,7 @@ public class TestCompilerReferenceServiceInheritanceAction extends TestCompilerR
|
||||
(PsiNamedElement)element,
|
||||
scope,
|
||||
StdFileTypes.JAVA);
|
||||
InternalCompilerRefServiceView.showHierarchyInfo(hierarchyInfo, element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,6 +447,8 @@
|
||||
<add-to-group group-id="FileChooserToolbar" anchor="last"/>
|
||||
</action>
|
||||
|
||||
<action class="com.intellij.compiler.backwardRefs.view.TestCompilerReferenceServiceFindUsagesAction" id="TestCompilerReferenceServiceFindUsages"/>
|
||||
<action class="com.intellij.compiler.backwardRefs.view.TestCompilerReferenceServiceFindUsagesAction" id="TestCompilerReferenceServiceFindUsages" internal="true"/>
|
||||
<action class="com.intellij.compiler.backwardRefs.view.TestCompilerReferenceServiceFunctionalExpressionSearchAction" id="TestCompilerReferenceServiceFunctionalExpressionSearch" internal="true"/>
|
||||
<action class="com.intellij.compiler.backwardRefs.view.TestCompilerReferenceServiceInheritanceAction" id="TestCompilerReferenceServiceInheritance" internal="true"/>
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
|
||||
Reference in New Issue
Block a user