mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
(no message)
This commit is contained in:
@@ -111,7 +111,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
|
||||
}
|
||||
}
|
||||
|
||||
private UsageFilteringRule[] getActiveFilteringRules(final Project project) {
|
||||
private static UsageFilteringRule[] getActiveFilteringRules(final Project project) {
|
||||
final UsageFilteringRuleProvider[] providers = ApplicationManager.getApplication().getComponents(UsageFilteringRuleProvider.class);
|
||||
List<UsageFilteringRule> list = new ArrayList<UsageFilteringRule>();
|
||||
for (int i = 0; i < providers.length; i++) {
|
||||
@@ -120,7 +120,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
|
||||
return list.toArray(new UsageFilteringRule[list.size()]);
|
||||
}
|
||||
|
||||
private UsageGroupingRule[] getActiveGroupingRules(final Project project) {
|
||||
private static UsageGroupingRule[] getActiveGroupingRules(final Project project) {
|
||||
final UsageGroupingRuleProvider[] providers = ApplicationManager.getApplication().getComponents(UsageGroupingRuleProvider.class);
|
||||
List<UsageGroupingRule> list = new ArrayList<UsageGroupingRule>();
|
||||
for (int i = 0; i < providers.length; i++) {
|
||||
@@ -149,7 +149,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
|
||||
TreePath leadSelectionPath = myTree.getLeadSelectionPath();
|
||||
if (leadSelectionPath == null) return;
|
||||
|
||||
DefaultMutableTreeNode node = ((DefaultMutableTreeNode)leadSelectionPath.getLastPathComponent());
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)leadSelectionPath.getLastPathComponent();
|
||||
if (node instanceof UsageNode) {
|
||||
final Usage usage = ((UsageNode)node).getUsage();
|
||||
usage.navigate(false);
|
||||
@@ -683,7 +683,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
|
||||
TreePath leadSelectionPath = myTree.getLeadSelectionPath();
|
||||
if (leadSelectionPath == null) return null;
|
||||
|
||||
DefaultMutableTreeNode node = ((DefaultMutableTreeNode)leadSelectionPath.getLastPathComponent());
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)leadSelectionPath.getLastPathComponent();
|
||||
return node instanceof Node ? (Node)node : null;
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
|
||||
return targets.size() > 0 ? targets.toArray(new UsageTarget[targets.size()]) : null;
|
||||
}
|
||||
|
||||
private Navigatable getNavigatableForNode(DefaultMutableTreeNode node) {
|
||||
private static Navigatable getNavigatableForNode(DefaultMutableTreeNode node) {
|
||||
if (node == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -846,8 +846,6 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
|
||||
|
||||
private final class ButtonPanel extends JPanel {
|
||||
public ButtonPanel() {
|
||||
super();
|
||||
|
||||
setLayout(new FlowLayout(FlowLayout.LEFT, 8, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,8 @@ package com.intellij.usages.impl.rules;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataConstants;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Iconable;
|
||||
import com.intellij.openapi.vcs.FileStatus;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.usages.Usage;
|
||||
@@ -24,8 +22,6 @@ import javax.swing.*;
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class ClassGroupingRule implements UsageGroupingRule {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.usages.impl.rules.ClassGroupingRule");
|
||||
|
||||
public UsageGroup groupUsage(Usage usage) {
|
||||
if (usage instanceof PsiElementUsage) {
|
||||
final PsiElement psiElement = ((PsiElementUsage)usage).getElement();
|
||||
|
||||
@@ -63,7 +63,7 @@ public class FileGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return (myFile != null ? myFile.hashCode() : 0);
|
||||
return myFile != null ? myFile.hashCode() : 0;
|
||||
}
|
||||
|
||||
public Icon getIcon(boolean isOpen) {
|
||||
|
||||
@@ -74,10 +74,11 @@ public class PackageGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
public void navigate(boolean focus) throws UnsupportedOperationException {
|
||||
myPackage.navigate(focus);
|
||||
}
|
||||
|
||||
public boolean canNavigate() {
|
||||
return false;
|
||||
return myPackage.canNavigate();
|
||||
}
|
||||
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
@@ -127,10 +128,18 @@ public class PackageGroupingRule implements UsageGroupingRule {
|
||||
}
|
||||
|
||||
public void navigate(boolean focus) throws UnsupportedOperationException {
|
||||
final PsiDirectory directory = getDirectory();
|
||||
if (directory != null && directory.canNavigate()) {
|
||||
directory.navigate(focus);
|
||||
}
|
||||
}
|
||||
|
||||
private PsiDirectory getDirectory() {
|
||||
return PsiManager.getInstance(myProject).findDirectory(myDir);
|
||||
}
|
||||
public boolean canNavigate() {
|
||||
return false;
|
||||
final PsiDirectory directory = getDirectory();
|
||||
return directory != null && directory.canNavigate();
|
||||
}
|
||||
|
||||
public int compareTo(UsageGroup usageGroup) {
|
||||
|
||||
@@ -135,9 +135,9 @@ public class PackageElementNode extends ProjectViewNode<PackageElement> {
|
||||
}
|
||||
|
||||
if (showFwName(aPackage)) {
|
||||
presentation.setPresentableText((getSettings().isAbbreviatePackageNames()
|
||||
? TreeViewUtil.calcAbbreviatedPackageFQName(aPackage)
|
||||
: aPackage.getQualifiedName()));
|
||||
presentation.setPresentableText(getSettings().isAbbreviatePackageNames()
|
||||
? TreeViewUtil.calcAbbreviatedPackageFQName(aPackage)
|
||||
: aPackage.getQualifiedName());
|
||||
}
|
||||
else {
|
||||
if (!(getParentValue() instanceof PackageElement)) {
|
||||
|
||||
@@ -91,7 +91,8 @@ public class PackageViewProjectNode extends AbstractProjectNode {
|
||||
}
|
||||
|
||||
for (Iterator<PsiPackage> it = topLevelPackages.iterator(); it.hasNext();) {
|
||||
PackageUtil.addPackageAsChild(children, it.next(), null, getSettings(), false);
|
||||
final PsiPackage psiPackage = it.next();
|
||||
PackageUtil.addPackageAsChild(children, psiPackage, null, getSettings(), false);
|
||||
}
|
||||
|
||||
if (getSettings().isShowLibraryContents()) {
|
||||
|
||||
@@ -52,4 +52,16 @@ public class PsiDirectoryNode extends BasePsiNode<PsiDirectory> {
|
||||
return VfsUtil.isAncestor(value.getVirtualFile(), file, false);
|
||||
}
|
||||
}
|
||||
|
||||
public String getToolTip() {
|
||||
if (getValue().isSourceRoot()) {
|
||||
return "Module Source Root";
|
||||
}
|
||||
else if (PackageUtil.isModuleContentRoot(getValue().getVirtualFile(), getProject())) {
|
||||
return "Module Content Root";
|
||||
}
|
||||
else {
|
||||
return super.getToolTip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.intellij.psi.impl.file;
|
||||
import com.intellij.ide.fileTemplates.FileTemplate;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateManager;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateUtil;
|
||||
import com.intellij.ide.projectView.ProjectView;
|
||||
import com.intellij.ide.projectView.impl.ProjectViewPane;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
@@ -595,5 +597,15 @@ public class PsiDirectoryImpl extends PsiElementBase implements PsiDirectory {
|
||||
public ASTNode getNode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canNavigate() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void navigate(boolean requestFocus) {
|
||||
final ProjectView projectView = ProjectView.getInstance(getProject());
|
||||
projectView.changeView(ProjectViewPane.ID);
|
||||
projectView.getProjectViewPaneById(ProjectViewPane.ID).select(this, getVirtualFile(), requestFocus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.intellij.psi.impl.file;
|
||||
|
||||
import com.intellij.ide.projectView.ProjectView;
|
||||
import com.intellij.ide.projectView.impl.PackageViewPane;
|
||||
import com.intellij.ide.projectView.impl.nodes.PackageElement;
|
||||
import com.intellij.ide.projectView.impl.nodes.PackageUtil;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.undo.DocumentReference;
|
||||
import com.intellij.openapi.command.undo.UndoManager;
|
||||
import com.intellij.openapi.command.undo.UndoableAction;
|
||||
import com.intellij.openapi.command.undo.UnexpectedUndoException;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
@@ -107,11 +110,11 @@ public class PsiPackageImpl extends PsiElementBase implements PsiPackage {
|
||||
final boolean anyChanged = changePackagePrefixes(oldQualifedName, newQualifiedName);
|
||||
if (anyChanged) {
|
||||
UndoManager.getInstance(myManager.getProject()).undoableActionPerformed(new UndoableAction() {
|
||||
public void undo() throws UnexpectedUndoException {
|
||||
public void undo() {
|
||||
changePackagePrefixes(newQualifiedName, oldQualifedName);
|
||||
}
|
||||
|
||||
public void redo() throws UnexpectedUndoException {
|
||||
public void redo() {
|
||||
changePackagePrefixes(oldQualifedName, newQualifiedName);
|
||||
}
|
||||
|
||||
@@ -416,7 +419,18 @@ public class PsiPackageImpl extends PsiElementBase implements PsiPackage {
|
||||
}
|
||||
|
||||
public boolean canNavigate() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void navigate(boolean requestFocus) {
|
||||
final ProjectView projectView = ProjectView.getInstance(getProject());
|
||||
projectView.changeView(PackageViewPane.ID);
|
||||
final PsiDirectory[] directories = getDirectories();
|
||||
final VirtualFile firstDir = directories[0].getVirtualFile();
|
||||
final boolean isLibraryRoot = PackageUtil.isLibraryRoot(firstDir, getProject());
|
||||
|
||||
final PackageElement packageElement = new PackageElement(null, this, isLibraryRoot);
|
||||
projectView.getProjectViewPaneById(PackageViewPane.ID).select(packageElement, firstDir, requestFocus);
|
||||
}
|
||||
|
||||
public boolean isPhysical() {
|
||||
|
||||
Reference in New Issue
Block a user