mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
PsiUtilBase.asVirtualFile, Overrides, remove duplicated code — please use PsiUtilCore.getVirtualFile
This commit is contained in:
@@ -43,6 +43,7 @@ public class ImageDocumentationProvider extends AbstractDocumentationProvider {
|
||||
final VirtualFile file = ((PsiFileSystemItem)element).getVirtualFile();
|
||||
if (file instanceof VirtualFileWithId && !DumbService.isDumb(element.getProject())) {
|
||||
ImageInfoIndex.processValues(file, new FileBasedIndex.ValueProcessor<ImageInfoIndex.ImageInfo>() {
|
||||
@Override
|
||||
public boolean process(VirtualFile file, ImageInfoIndex.ImageInfo value) {
|
||||
int imageWidth = value.width;
|
||||
int imageHeight = value.height;
|
||||
@@ -62,7 +63,7 @@ public class ImageDocumentationProvider extends AbstractDocumentationProvider {
|
||||
result[0] = String.format("<html><body><img src=\"%s\" width=\"%s\" height=\"%s\"><p>%sx%s, %sbpp</p><body></html>", url, imageWidth,
|
||||
imageHeight, value.width, value.height, value.bpp);
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
catch (URISyntaxException ignored) {
|
||||
// nothing
|
||||
}
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ public class ClassesTreeStructureProvider implements SelectableTreeStructureProv
|
||||
return current != null ? current : baseRootFile;
|
||||
}
|
||||
|
||||
private boolean isSelectable(PsiElement element) {
|
||||
private static boolean isSelectable(PsiElement element) {
|
||||
if (element instanceof PsiFileSystemItem) return true;
|
||||
|
||||
if (element instanceof PsiField || element instanceof PsiClass || element instanceof PsiMethod) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class JavaCodeBlockModificationListener implements PsiTreeChangePreproces
|
||||
myModificationTracker.incCounter();
|
||||
}
|
||||
}
|
||||
catch (PsiInvalidElementAccessException e) {
|
||||
catch (PsiInvalidElementAccessException ignored) {
|
||||
myModificationTracker.incCounter(); // Shall not happen actually, just a pre-release paranoia
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@
|
||||
package com.intellij.psi.impl.source.resolve.reference.impl.providers;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -87,7 +87,7 @@ public class FilePathReferenceProvider extends PsiReferenceProvider {
|
||||
systemItems.addAll(getRoots(forModule, true));
|
||||
}
|
||||
} else {
|
||||
systemItems.addAll(getRoots(ModuleUtil.findModuleForPsiElement(getElement()), true));
|
||||
systemItems.addAll(getRoots(ModuleUtilCore.findModuleForPsiElement(getElement()), true));
|
||||
}
|
||||
return systemItems;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class FilePathReferenceProvider extends PsiReferenceProvider {
|
||||
if (thisModule == null) return Collections.emptyList();
|
||||
Set<Module> modules = new com.intellij.util.containers.HashSet<Module>();
|
||||
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(thisModule);
|
||||
ModuleUtil.getDependencies(thisModule, modules);
|
||||
ModuleUtilCore.getDependencies(thisModule, modules);
|
||||
List<PsiFileSystemItem> result = new ArrayList<PsiFileSystemItem>();
|
||||
final PsiManager psiManager = PsiManager.getInstance(thisModule.getProject());
|
||||
if (includingClasses) {
|
||||
|
||||
@@ -348,7 +348,8 @@ public class PsiUtilCore {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile getVirtualFile(@Nullable PsiElement element) {
|
||||
public static VirtualFile getVirtualFile(@Nullable Object object) {
|
||||
PsiElement element = object instanceof PsiElement ? (PsiElement)object : null;
|
||||
if (element == null || !element.isValid()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@ package com.intellij.psi.impl.search;
|
||||
import com.intellij.openapi.application.QueryExecutorBase;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFileSystemItem;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.meta.PsiMetaData;
|
||||
import com.intellij.psi.meta.PsiMetaOwner;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
@@ -44,9 +47,7 @@ public class CachesBasedRefSearcher extends QueryExecutorBase<PsiReference, Refe
|
||||
}
|
||||
if (StringUtil.isNotEmpty(text)) {
|
||||
final SearchScope searchScope = p.getEffectiveSearchScope();
|
||||
assert text != null;
|
||||
p.getOptimizer().searchWord(text, searchScope, refElement.getLanguage().isCaseSensitive(), refElement);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -21,19 +21,22 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.problems.WolfTheProblemSolver;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileSystemItem;
|
||||
import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A node in the project view tree.
|
||||
@@ -103,23 +106,21 @@ public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> im
|
||||
public static AbstractTreeNode createTreeNode(Class<? extends AbstractTreeNode> nodeClass,
|
||||
Project project,
|
||||
Object value,
|
||||
ViewSettings settings) throws NoSuchMethodException,
|
||||
InstantiationException,
|
||||
IllegalAccessException,
|
||||
InvocationTargetException {
|
||||
ViewSettings settings) throws
|
||||
InstantiationException {
|
||||
Object[] parameters = new Object[]{project, value, settings};
|
||||
for (Constructor<? extends AbstractTreeNode> constructor : (Constructor<? extends AbstractTreeNode>[])nodeClass.getConstructors()) {
|
||||
if (constructor.getParameterTypes().length != 3) continue;
|
||||
try {
|
||||
return constructor.newInstance(parameters);
|
||||
}
|
||||
catch (InstantiationException e) {
|
||||
catch (InstantiationException ignored) {
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
catch (IllegalAccessException ignored) {
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
catch (InvocationTargetException e) {
|
||||
catch (InvocationTargetException ignored) {
|
||||
}
|
||||
}
|
||||
throw new InstantiationException("no constructor found in " + nodeClass);
|
||||
@@ -142,7 +143,7 @@ public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> im
|
||||
break;
|
||||
}
|
||||
|
||||
if (VfsUtil.isAncestor(eachRoot, file, true)) {
|
||||
if (VfsUtilCore.isAncestor(eachRoot, file, true)) {
|
||||
mayContain = true;
|
||||
break;
|
||||
}
|
||||
@@ -193,7 +194,7 @@ public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> im
|
||||
public boolean value(final VirtualFile virtualFile) {
|
||||
return contains(virtualFile)
|
||||
// in case of flattened packages, when package node a.b.c contains error file, node a.b might not.
|
||||
&& (getValue() instanceof PsiElement && Comparing.equal(PsiUtilBase.getVirtualFile((PsiElement)getValue()), virtualFile) ||
|
||||
&& (getValue() instanceof PsiElement && Comparing.equal(PsiUtilCore.getVirtualFile(getValue()), virtualFile) ||
|
||||
someChildContainsFile(virtualFile));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -288,4 +288,15 @@ public class PsiUtilBase extends PsiUtilCore {
|
||||
final VirtualFile virtualFile = element.getVirtualFile();
|
||||
return virtualFile != null && virtualFile.is(VFileProperty.SYMLINK);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile asVirtualFile(@Nullable Object element) {
|
||||
if (element instanceof PsiFileSystemItem) {
|
||||
PsiFileSystemItem psiFileSystemItem = (PsiFileSystemItem)element;
|
||||
return psiFileSystemItem.isValid() ? psiFileSystemItem.getVirtualFile() : null;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ public class ImagePreviewComponent extends JPanel implements PreviewHintComponen
|
||||
setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@TestOnly
|
||||
public boolean isEqualTo(@Nullable PreviewHintComponent other) {
|
||||
if (!(other instanceof ImagePreviewComponent)) {
|
||||
@@ -159,7 +160,7 @@ public class ImagePreviewComponent extends JPanel implements PreviewHintComponen
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
catch (IOException ignored) {
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
@@ -322,7 +322,7 @@ public class PsiCopyPasteManager {
|
||||
|
||||
@Override
|
||||
public boolean isDataFlavorSupported(DataFlavor flavor) {
|
||||
return ArrayUtil.find(getTransferDataFlavors(), flavor) != -1;
|
||||
return ArrayUtilRt.find(getTransferDataFlavors(), flavor) != -1;
|
||||
}
|
||||
|
||||
public PsiElement[] getElements() {
|
||||
|
||||
@@ -32,9 +32,8 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.FocusRequestor;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileSystemItem;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -68,26 +67,15 @@ public abstract class BaseProjectTreeBuilder extends AbstractTreeBuilder {
|
||||
if (element instanceof AbstractTreeNode) {
|
||||
AbstractTreeNode node = (AbstractTreeNode)element;
|
||||
final Object value = node.getValue();
|
||||
VirtualFile vFile = null;
|
||||
if (value instanceof PsiFileSystemItem) {
|
||||
vFile = ((PsiFileSystemItem)value).getVirtualFile();
|
||||
}
|
||||
else if (value instanceof PsiElement) {
|
||||
PsiFile psiFile = ((PsiElement)value).getContainingFile();
|
||||
if (psiFile != null) {
|
||||
vFile = psiFile.getVirtualFile();
|
||||
}
|
||||
}
|
||||
final ActionCallback cb = new ActionCallback();
|
||||
|
||||
final VirtualFile finalVFile = vFile;
|
||||
final ActionCallback callback = new ActionCallback();
|
||||
final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(value);
|
||||
final FocusRequestor focusRequestor = IdeFocusManager.getInstance(myProject).getFurtherRequestor();
|
||||
batch(new Progressive() {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
final Ref<Object> target = new Ref<Object>();
|
||||
_select(value, finalVFile, false, Conditions.<AbstractTreeNode>alwaysTrue(), cb, indicator, target, focusRequestor, false);
|
||||
cb.doWhenDone(new Runnable() {
|
||||
_select(value, virtualFile, false, Conditions.<AbstractTreeNode>alwaysTrue(), callback, indicator, target, focusRequestor, false);
|
||||
callback.doWhenDone(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
result.setDone(target.get());
|
||||
|
||||
+7
-8
@@ -10,7 +10,7 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.problems.WolfTheProblemSolver;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFileSystemItem;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -59,6 +59,7 @@ public abstract class AbstractMvcPsiNodeDescriptor extends AbstractPsiBasedNode<
|
||||
return super.contains(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected PsiElement extractPsiFromValue() {
|
||||
final NodeId nodeId = getValue();
|
||||
@@ -86,15 +87,10 @@ public abstract class AbstractMvcPsiNodeDescriptor extends AbstractPsiBasedNode<
|
||||
if (!isValid()) {
|
||||
return null;
|
||||
}
|
||||
final PsiElement psiElement = extractPsiFromValue();
|
||||
assert psiElement != null;
|
||||
|
||||
if (psiElement instanceof PsiFileSystemItem) {
|
||||
return ((PsiFileSystemItem)psiElement).getVirtualFile();
|
||||
}
|
||||
return psiElement.getContainingFile().getVirtualFile();
|
||||
return PsiUtilCore.getVirtualFile(extractPsiFromValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateImpl(final PresentationData data) {
|
||||
final PsiElement psiElement = extractPsiFromValue();
|
||||
if (psiElement instanceof NavigationItem) {
|
||||
@@ -110,14 +106,17 @@ public abstract class AbstractMvcPsiNodeDescriptor extends AbstractPsiBasedNode<
|
||||
return myWeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasProblemFileBeneath() {
|
||||
return WolfTheProblemSolver.getInstance(getProject()).hasProblemFilesBeneath(new Condition<VirtualFile>() {
|
||||
@Override
|
||||
public boolean value(final VirtualFile virtualFile) {
|
||||
return contains(virtualFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
final PsiElement psiElement = extractPsiFromValue();
|
||||
return psiElement != null && psiElement.isValid();
|
||||
|
||||
+30
-12
@@ -34,11 +34,11 @@ import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.TextEditor;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ui.configuration.actions.ModuleDeleteProvider;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
@@ -169,19 +169,23 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
toolWindow.setTitleActions(new AnAction[]{new ScrollFromSourceAction(), collapseAction});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return myDescriptor.getFramework().getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getId() {
|
||||
return myId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeight() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@@ -191,6 +195,7 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SelectInTarget createSelectInTarget() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@@ -199,12 +204,14 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
@Override
|
||||
protected BaseProjectTreeBuilder createBuilder(final DefaultTreeModel treeModel) {
|
||||
return new ProjectTreeBuilder(myProject, myTree, treeModel, null, (ProjectAbstractTreeStructureBase)myTreeStructure) {
|
||||
@Override
|
||||
protected AbstractTreeUpdater createUpdater() {
|
||||
return createTreeUpdater(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProjectAbstractTreeStructureBase createStructure() {
|
||||
final Project project = myProject;
|
||||
final String id = getId();
|
||||
@@ -215,28 +222,33 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
return myViewState.hideEmptyMiddlePackages;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractTreeNode createRoot(final Project project, ViewSettings settings) {
|
||||
return new MvcProjectNode(project, this, myDescriptor);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProjectViewTree createTree(final DefaultTreeModel treeModel) {
|
||||
return new ProjectViewTree(myProject, treeModel) {
|
||||
public String toString() {
|
||||
return myDescriptor.getFramework().getDisplayName() + " " + super.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultMutableTreeNode getSelectedNode() {
|
||||
return MvcProjectViewPane.this.getSelectedNode();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractTreeUpdater createTreeUpdater(final AbstractTreeBuilder treeBuilder) {
|
||||
return new AbstractTreeUpdater(treeBuilder);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected PsiElement getPSIElement(@Nullable final Object element) {
|
||||
// E.g is used by Project View's DataProvider
|
||||
@@ -305,20 +317,23 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
return content == null ? null : (MvcProjectViewPane)content.getDisposer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectElement(PsiElement element) {
|
||||
PsiFileSystemItem psiFile;
|
||||
|
||||
if (!(element instanceof PsiFileSystemItem)) {
|
||||
psiFile = element.getContainingFile();
|
||||
}
|
||||
else {
|
||||
if (element instanceof PsiFileSystemItem) {
|
||||
psiFile = (PsiFileSystemItem)element;
|
||||
}
|
||||
|
||||
if (psiFile == null) return;
|
||||
else {
|
||||
psiFile = element.getContainingFile();
|
||||
if (psiFile == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
VirtualFile virtualFile = psiFile.getVirtualFile();
|
||||
if (virtualFile == null) return;
|
||||
if (virtualFile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
selectFile(virtualFile, false);
|
||||
|
||||
@@ -337,10 +352,12 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiDirectory[] getDirectories() {
|
||||
return getSelectedDirectories();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiDirectory getOrChooseDirectory() {
|
||||
return DirectoryChooserUtil.getOrChooseDirectory(this);
|
||||
}
|
||||
@@ -360,7 +377,7 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
return null;
|
||||
}
|
||||
|
||||
final Module module = ModuleUtil.findModuleForFile(file, project);
|
||||
final Module module = ModuleUtilCore.findModuleForFile(file, project);
|
||||
if (module == null || !framework.hasSupport(module)) {
|
||||
return null;
|
||||
}
|
||||
@@ -386,7 +403,7 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
if (descriptor instanceof AbstractFolderNode) {
|
||||
final AbstractFolderNode folderNode = (AbstractFolderNode)descriptor;
|
||||
final VirtualFile dir = folderNode.getVirtualFile();
|
||||
if (dir != null && VfsUtil.isAncestor(dir, file, false)) {
|
||||
if (dir != null && VfsUtilCore.isAncestor(dir, file, false)) {
|
||||
cur = folderNode;
|
||||
result.add(folderNode);
|
||||
if (dir.equals(file)) {
|
||||
@@ -506,6 +523,7 @@ public class MvcProjectViewPane extends AbstractProjectViewPSIPane implements Id
|
||||
return myViewState.hideEmptyMiddlePackages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent event, boolean flag) {
|
||||
myViewState.hideEmptyMiddlePackages = flag;
|
||||
TreeUtil.collapseAll(myTree, 1);
|
||||
|
||||
@@ -44,6 +44,7 @@ public class FileReferenceUtil {
|
||||
final FileReference[] references = set.getAllReferences();
|
||||
|
||||
return ContainerUtil.map2Array(references, PsiReference.class, new NotNullFunction<FileReference, PsiReference>() {
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiReference fun(FileReference fileReference) {
|
||||
return new MyFileReference(fileReference, cond, soft);
|
||||
@@ -66,6 +67,7 @@ public class FileReferenceUtil {
|
||||
myType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean value(PsiFile file) {
|
||||
return file.getFileType() == myType;
|
||||
}
|
||||
@@ -78,6 +80,7 @@ public class FileReferenceUtil {
|
||||
myPattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean value(PsiFile o) {
|
||||
return myPattern.accepts(o);
|
||||
}
|
||||
@@ -113,6 +116,7 @@ public class FileReferenceUtil {
|
||||
protected ResolveResult[] innerResolve() {
|
||||
final ResolveResult[] results = super.innerResolve();
|
||||
return ContainerUtil.findAll(results, new Condition<ResolveResult>() {
|
||||
@Override
|
||||
public boolean value(ResolveResult resolveResult) {
|
||||
final PsiElement e = resolveResult.getElement();
|
||||
return match(e, myCond);
|
||||
@@ -125,6 +129,7 @@ public class FileReferenceUtil {
|
||||
public Object[] getVariants() {
|
||||
final Object[] variants = super.getVariants();
|
||||
return ContainerUtil.findAll(variants, new Condition<Object>() {
|
||||
@Override
|
||||
public boolean value(Object o) {
|
||||
/*if (o instanceof CandidateInfo) {
|
||||
o = ((CandidateInfo)o).getElement();
|
||||
|
||||
Reference in New Issue
Block a user