本文整理汇总了Java中com.intellij.ide.projectView.ProjectViewNode类的典型用法代码示例。如果您正苦于以下问题:Java ProjectViewNode类的具体用法?Java ProjectViewNode怎么用?Java ProjectViewNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProjectViewNode类属于com.intellij.ide.projectView包,在下文中一共展示了ProjectViewNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: contains
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public boolean contains(@NotNull final VirtualFile file) {
for (AbstractTreeNode abstractTreeNode : this.getValue()) {
if (abstractTreeNode instanceof ProjectViewNode) {
final ProjectViewNode projectViewNode = (ProjectViewNode) abstractTreeNode;
if (null == projectViewNode.getVirtualFile()) {
continue;
}
if (projectViewNode.getVirtualFile().equals(file)) {
return true;
}
if (file.getPath().startsWith(projectViewNode.getVirtualFile().getPath())) {
return true;
}
}
}
return false;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:23,代码来源:JunkProjectViewNode.java
示例2: checkContainsMethod
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
public static void checkContainsMethod(final Object rootElement,
final AbstractTreeStructure structure,
Function<AbstractTreeNode, VirtualFile[]> converterFunction) {
MultiValuesMap<VirtualFile, AbstractTreeNode> map = new MultiValuesMap<VirtualFile, AbstractTreeNode>();
collect((AbstractTreeNode)rootElement, map, structure, converterFunction);
for (VirtualFile eachFile : map.keySet()) {
Collection<AbstractTreeNode> nodes = map.values();
for (final AbstractTreeNode node : nodes) {
ProjectViewNode eachNode = (ProjectViewNode)node;
boolean actual = eachNode.contains(eachFile);
boolean expected = map.get(eachFile).contains(eachNode);
if (actual != expected) {
boolean actual1 = eachNode.contains(eachFile);
boolean expected1 = map.get(eachFile).contains(eachNode);
Assert.assertTrue("file=" + eachFile + " node=" + eachNode.getTestPresentation() + " expected:" + expected, false);
}
}
}
}
示例3: addPsiElementNode
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
private static void addPsiElementNode(PsiElement psiElement,
final Project project,
final ArrayList<AbstractTreeNode> result,
final ViewSettings favoritesConfig) {
Class<? extends AbstractTreeNode> klass = getPsiElementNodeClass(psiElement);
if (klass == null) {
psiElement = PsiTreeUtil.getParentOfType(psiElement, PsiFile.class);
if (psiElement != null) {
klass = PsiFileNode.class;
}
}
final Object value = psiElement;
try {
if (klass != null && value != null) {
result.add(ProjectViewNode.createTreeNode(klass, project, value, favoritesConfig));
}
}
catch (Exception e) {
LOG.error(e);
}
}
示例4: compare
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public int compare(NodeDescriptor obj1, NodeDescriptor obj2){
final int weight1 = obj1.getWeight();
final int weight2 = obj2.getWeight();
if (weight1 != weight2) return weight1 - weight2;
if (obj1 instanceof ProjectViewNode && obj2 instanceof ProjectViewNode) {
return ((ProjectViewNode)obj1).getTitle().compareToIgnoreCase(((ProjectViewNode)obj2).getTitle());
}
if (obj1 instanceof ModuleToDoNode && obj2 instanceof ModuleToDoNode){
return ((ModuleToDoNode)obj1).getValue().getName().compareToIgnoreCase(((ModuleToDoNode)obj2).getValue().getName());
} else if(obj1 instanceof ModuleToDoNode) {
return -1;
} else if(obj2 instanceof ModuleToDoNode) {
return 1;
} else{
throw new IllegalArgumentException(obj1.getClass().getName()+","+obj2.getClass().getName());
}
}
示例5: updateNodesContaining
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
private void updateNodesContaining(@NotNull Collection<VirtualFile> filesToRefresh, @NotNull DefaultMutableTreeNode rootNode) {
if (!(rootNode.getUserObject() instanceof ProjectViewNode)) return;
ProjectViewNode node = (ProjectViewNode)rootNode.getUserObject();
Collection<VirtualFile> containingFiles = null;
for (VirtualFile virtualFile : filesToRefresh) {
if (!virtualFile.isValid()) {
addSubtreeToUpdate(rootNode); // file must be deleted
return;
}
if (node.contains(virtualFile)) {
if (containingFiles == null) containingFiles = new SmartList<VirtualFile>();
containingFiles.add(virtualFile);
}
}
if (containingFiles != null) {
updateNode(rootNode);
Enumeration children = rootNode.children();
while (children.hasMoreElements()) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode)children.nextElement();
updateNodesContaining(containingFiles, child);
}
}
}
示例6: addLibraryChildren
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
public static void addLibraryChildren(final LibraryOrSdkOrderEntry entry, final List<AbstractTreeNode> children, Project project, ProjectViewNode node) {
final PsiManager psiManager = PsiManager.getInstance(project);
VirtualFile[] files =
entry instanceof LibraryOrderEntry ? getLibraryRoots((LibraryOrderEntry)entry) : entry.getRootFiles(OrderRootType.CLASSES);
for (final VirtualFile file : files) {
if (!file.isValid()) continue;
if (file.isDirectory()) {
final PsiDirectory psiDir = psiManager.findDirectory(file);
if (psiDir == null) {
continue;
}
children.add(new PsiDirectoryNode(project, psiDir, node.getSettings()));
}
else {
final PsiFile psiFile = psiManager.findFile(file);
if (psiFile == null) continue;
children.add(new PsiFileNode(project, psiFile, node.getSettings()));
}
}
}
示例7: calcSelectedClass
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
private PsiFile calcSelectedClass() {
if (myTabbedPane.getSelectedIndex() == 1) {
return (PsiFile)myGotoByNamePanel.getChosenElement();
}
else {
final TreePath path = myTree.getSelectionPath();
if (path == null) return null;
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
final Object userObject = node.getUserObject();
if (!(userObject instanceof ProjectViewNode)) return null;
ProjectViewNode pvNode = (ProjectViewNode) userObject;
VirtualFile vFile = pvNode.getVirtualFile();
if (vFile != null && !vFile.isDirectory()) {
return PsiManager.getInstance(myProject).findFile(vFile);
}
return null;
}
}
示例8: decorate
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof PsiDirectoryNode)) {
return;
}
final PsiDirectoryNode psiDirectoryNode = (PsiDirectoryNode)node;
PsiDirectory psiDirectory = psiDirectoryNode.getValue();
Project project = psiDirectory.getProject();
if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
return;
}
VirtualFile folder = psiDirectory.getVirtualFile();
Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(folder);
if (module != null && ModuleUtilCore.isModuleDir(module, folder)) {
data.setIcon(GradleUtil.getModuleIcon(module));
}
}
示例9: getChildElements
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
public Object[] getChildElements(Object obj) {
final Object[] childElements = super.getChildElements(obj);
List l = new ArrayList(childElements.length);
for (Object o : childElements) {
if (o instanceof ProjectViewNode) {
final ProjectViewNode node = (ProjectViewNode)o;
final Object element = node.getValue();
if (element instanceof PsiFile) {
if (XsltSupport.isXsltFile((PsiFile)element)) {
l.add(o);
}
}
else {
l.add(o);
}
}
}
return l.size() != childElements.length ? (Object[])l.toArray(new Object[l.size()]) : childElements;
}
示例10: modify
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@NotNull
@SuppressWarnings({"RawUseOfParameterizedType", "unchecked"})
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
Collection<AbstractTreeNode> l = children;
int i = 0;
for (AbstractTreeNode o : children) {
if (o instanceof ProjectViewNode) {
final ProjectViewNode node = (ProjectViewNode)o;
final Object element = node.getValue();
if (element instanceof PsiFile) {
if (XsltSupport.isXsltFile((PsiFile)element)) {
if (l == children && l.getClass() != ArrayList.class) {
l = new ArrayList<AbstractTreeNode>(children);
}
final XsltFileNode fileNode = new XsltFileNode(myProject, (PsiFile)element, settings);
((List<AbstractTreeNode>)l).set(i, fileNode);
}
}
}
i++;
}
return l;
}
示例11: decorate
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof ClassTreeNode)) {
return;
}
PsiClass psiClass = ((ClassTreeNode) node).getPsiClass();
if (psiClass == null) {
return;
}
PsiFile psiFile = psiClass.getContainingFile();
if (psiFile == null) {
return;
}
VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile == null) {
return;
}
Project project = node.getProject();
if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
data.clearText();
data.addText(psiClass.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
示例12: decorate
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(@SuppressWarnings("rawtypes") ProjectViewNode node, PresentationData data) {
CoverageDataManager manager = getCoverageDataManager();
CoverageSuitesBundle currentSuite = manager.getCurrentSuitesBundle();
Project project = node.getProject();
BlazeCoverageAnnotator annotator = getAnnotator(project, currentSuite);
if (annotator == null) {
return;
}
PsiFile file = getPsiFileForJavaClass(getPsiElement(node));
if (file == null) {
return;
}
String string = annotator.getFileCoverageInformationString(file, currentSuite, manager);
if (string != null) {
data.setLocationString(string);
}
}
示例13: decorate
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof PsiFileNode)) {
return;
}
PsiFile psiFile = ((PsiFileNode) node).getValue();
if (!(psiFile instanceof OCFile)) {
return;
}
VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile == null) {
return;
}
Project project = node.getProject();
if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
data.clearText();
data.addText(psiFile.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
示例14: updateNodesContaining
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
private void updateNodesContaining(@Nonnull Collection<VirtualFile> filesToRefresh, @Nonnull DefaultMutableTreeNode rootNode) {
if (!(rootNode.getUserObject() instanceof ProjectViewNode))
return;
ProjectViewNode node = (ProjectViewNode) rootNode.getUserObject();
Collection<VirtualFile> containingFiles = null;
for (VirtualFile virtualFile : filesToRefresh) {
if (!virtualFile.isValid()) {
addSubtreeToUpdate(rootNode); // file must be deleted
return;
}
if (node.contains(virtualFile)) {
if (containingFiles == null)
containingFiles = new SmartList<VirtualFile>();
containingFiles.add(virtualFile);
}
}
if (containingFiles != null) {
updateNode(rootNode);
Enumeration children = rootNode.children();
while (children.hasMoreElements()) {
DefaultMutableTreeNode child = (DefaultMutableTreeNode) children.nextElement();
updateNodesContaining(containingFiles, child);
}
}
}
示例15: decorate
import com.intellij.ide.projectView.ProjectViewNode; //导入依赖的package包/类
@Override
public void decorate(final ProjectViewNode node, final PresentationData data) {
final VirtualFile file = node.getVirtualFile();
final Project project = node.getProject();
// Color file status
if (file != null) {
if (MTConfig.getInstance().getIsBoldTabs()) {
// Color file status
applyBoldTabs(data, file);
}
if (MTConfig.getInstance().isUseProjectViewDecorators()) {
setOpenOrClosedIcon(data, file, project);
}
}
}