当前位置: 首页>>代码示例>>Java>>正文


Java FileElement类代码示例

本文整理汇总了Java中com.intellij.openapi.fileChooser.FileElement的典型用法代码示例。如果您正苦于以下问题:Java FileElement类的具体用法?Java FileElement怎么用?Java FileElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FileElement类属于com.intellij.openapi.fileChooser包,在下文中一共展示了FileElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChildren

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
public Object[] getChildren() {
  if (myChildren == null) {
    if (myFiles == null) {
      myFiles = getFileSystemRoots();
    }

    List<FileElement> children = new ArrayList<FileElement>();
    for (final VirtualFile file : myFiles) {
      if (file != null) {
        children.add(new FileElement(file, file.getPresentableUrl()));
      }
    }
    myChildren = ArrayUtil.toObjectArray(children);
  }
  return myChildren;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RootFileElement.java

示例2: getFileElementFor

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
@Nullable
private static FileElement getFileElementFor(@NotNull VirtualFile file) {
  VirtualFile selectFile;

  if ((file.getFileSystem() instanceof JarFileSystem) && file.getParent() == null) {
    selectFile = JarFileSystem.getInstance().getVirtualFileForJar(file);
    if (selectFile == null) {
      return null;
    }
  }
  else {
    selectFile = file;
  }

  return new FileElement(selectFile, selectFile.getName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FileSystemTreeImpl.java

示例3: collectSelectedElements

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
private <T> List<T> collectSelectedElements(final Function<FileElement, T> converter) {
  final TreePath[] paths = myTree.getSelectionPaths();
  if (paths == null) return Collections.emptyList();

  final List<T> elements = ContainerUtil.newArrayList();
  for (TreePath path : paths) {
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
    final Object userObject = node.getUserObject();
    if (userObject instanceof FileNodeDescriptor) {
      final T element = converter.fun(((FileNodeDescriptor)userObject).getElement());
      if (element != null) {
        elements.add(element);
      }
    }
  }
  return elements;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FileSystemTreeImpl.java

示例4: processSelectionChange

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
private void processSelectionChange() {
  if (myListeners.size() == 0) return;
  List<VirtualFile> selection = new ArrayList<VirtualFile>();

  final TreePath[] paths = myTree.getSelectionPaths();
  if (paths != null) {
    for (TreePath each : paths) {
      final Object last = each.getLastPathComponent();
      if (last instanceof DefaultMutableTreeNode) {
        final Object object = ((DefaultMutableTreeNode)last).getUserObject();
        if (object instanceof FileNodeDescriptor) {
          final FileElement element = ((FileNodeDescriptor)object).getElement();
          final VirtualFile file = element.getFile();
          if (file != null) {
            selection.add(file);
          }
        }
      }
    }
  }

  fireSelection(selection);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FileSystemTreeImpl.java

示例5: customizeCellRenderer

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  super.customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);

  final ContentEntryEditor editor = myTreeEditor.getContentEntryEditor();
  if (editor != null) {
    final Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
    if (userObject instanceof NodeDescriptor) {
      final Object element = ((NodeDescriptor)userObject).getElement();
      if (element instanceof FileElement) {
        final VirtualFile file = ((FileElement)element).getFile();
        if (file != null && file.isDirectory()) {
          final ContentEntry contentEntry = editor.getContentEntry();
          if (contentEntry != null) {
            final String prefix = getPresentablePrefix(contentEntry, file);
            if (!prefix.isEmpty()) {
              append(" (" + prefix + ")", new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
            }
            setIcon(updateIcon(contentEntry, file, getIcon()));
          }
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ContentEntryTreeCellRenderer.java

示例6: getSelectedFiles

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
@NotNull
protected final VirtualFile[] getSelectedFiles() {
  final TreePath[] selectionPaths = myTree.getSelectionPaths();
  if (selectionPaths == null) {
    return VirtualFile.EMPTY_ARRAY;
  }
  final List<VirtualFile> selected = new ArrayList<VirtualFile>();
  for (TreePath treePath : selectionPaths) {
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode)treePath.getLastPathComponent();
    final Object nodeDescriptor = node.getUserObject();
    if (!(nodeDescriptor instanceof FileNodeDescriptor)) {
      return VirtualFile.EMPTY_ARRAY;
    }
    final FileElement fileElement = ((FileNodeDescriptor)nodeDescriptor).getElement();
    final VirtualFile file = fileElement.getFile();
    if (file != null) {
      selected.add(file);
    }
  }
  return selected.toArray(new VirtualFile[selected.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ContentEntryEditingAction.java

示例7: customize

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
private boolean customize(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  if (!(value instanceof DefaultMutableTreeNode)) {
    return false;
  }
  final DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
  final Object userObject = node.getUserObject();
  if (!(userObject instanceof NodeDescriptor)) {
    return false;
  }
  final NodeDescriptor descriptor = (NodeDescriptor)userObject;
  final Object element = descriptor.getElement();
  if (!(element instanceof FileElement)) {
    return false;
  }
  final FileElement fileElement = (FileElement)element;
  if (!isExcluded(fileElement)) {
    return false;
  }
  setIcon(IconLoader.getDisabledIcon(descriptor.getIcon()));
  final String text = tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
  append(text, new SimpleTextAttributes(SimpleTextAttributes.STYLE_STRIKEOUT, tree.getForeground()));
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ImportTree.java

示例8: customizeCellRenderer

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  super.customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);

  final ContentEntryEditor editor = myTreeEditor.getContentEntryEditor();
  if (editor != null) {
    final Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
    if (userObject instanceof NodeDescriptor) {
      final Object element = ((NodeDescriptor)userObject).getElement();
      if (element instanceof FileElement) {
        final VirtualFile file = ((FileElement)element).getFile();
        if (file != null && file.isDirectory()) {
          final ContentEntry contentEntry = editor.getContentEntry();
          if (contentEntry != null) {
            final String prefix = getPrefix(contentEntry, file);
            if (!prefix.isEmpty()) {
              append(" (" + prefix + ")", new SimpleTextAttributes(Font.PLAIN, JBColor.GRAY));
            }
            setIcon(updateIcon(contentEntry, file, getIcon()));
          }
        }
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:ContentEntryTreeCellRenderer.java

示例9: getFileElementFor

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
@Nullable
private static FileElement getFileElementFor(@Nonnull VirtualFile file) {
  VirtualFile selectFile;

  if ((file.getFileSystem() instanceof ArchiveFileSystem) && file.getParent() == null) {
    selectFile = ArchiveVfsUtil.getVirtualFileForArchive(file);
    if (selectFile == null) {
      return null;
    }
  }
  else {
    selectFile = file;
  }

  return new FileElement(selectFile, selectFile.getName());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:FileSystemTreeImpl.java

示例10: customizeCellRenderer

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
@Override
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  super.customizeCellRenderer(tree, value, selected, expanded, leaf, row, hasFocus);

  final ContentEntryEditor editor = myTreeEditor.getContentEntryEditor();
  if (editor != null) {
    final Object userObject = ((DefaultMutableTreeNode)value).getUserObject();
    if (userObject instanceof NodeDescriptor) {
      final Object element = ((NodeDescriptor)userObject).getElement();
      if (element instanceof FileElement) {
        final VirtualFile file = ((FileElement)element).getFile();
        if (file != null && file.isDirectory()) {
          final ContentEntry contentEntry = editor.getContentEntry();
          if (contentEntry != null) {
            setIcon(updateIcon(contentEntry, file, getIcon()));
          }
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:ContentEntryTreeCellRenderer.java

示例11: getSelectedFiles

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
@Nonnull
protected final VirtualFile[] getSelectedFiles() {
  final TreePath[] selectionPaths = myTree.getSelectionPaths();
  if (selectionPaths == null) {
    return VirtualFile.EMPTY_ARRAY;
  }
  final List<VirtualFile> selected = new ArrayList<VirtualFile>();
  for (TreePath treePath : selectionPaths) {
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode)treePath.getLastPathComponent();
    final Object nodeDescriptor = node.getUserObject();
    if (!(nodeDescriptor instanceof FileNodeDescriptor)) {
      return VirtualFile.EMPTY_ARRAY;
    }
    final FileElement fileElement = ((FileNodeDescriptor)nodeDescriptor).getElement();
    final VirtualFile file = fileElement.getFile();
    if (file != null) {
      selected.add(file);
    }
  }
  return selected.toArray(new VirtualFile[selected.size()]);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:ContentEntryEditingAction.java

示例12: FileNodeDescriptor

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
public FileNodeDescriptor(Project project,
                          @NotNull FileElement element,
                          NodeDescriptor parentDescriptor,
                          Icon closedIcon,
                          String name,
                          String comment) {
  super(project, parentDescriptor);
  myOriginalIcon = closedIcon;
  myComment = comment;
  myFileElement = element;
  myName = name;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:FileNodeDescriptor.java

示例13: getSelectedFile

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
@Nullable
public VirtualFile getSelectedFile() {
  final TreePath path = myTree.getSelectionPath();
  if (path == null) return null;
  final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
  if (!(node.getUserObject() instanceof FileNodeDescriptor)) return null;
  final FileElement element = ((FileNodeDescriptor)node.getUserObject()).getElement();
  return element.getFile();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FileSystemTreeImpl.java

示例14: getSelectedFiles

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
@NotNull
public VirtualFile[] getSelectedFiles() {
  final List<VirtualFile> files = collectSelectedElements(new NullableFunction<FileElement, VirtualFile>() {
    @Override
    public VirtualFile fun(final FileElement element) {
      final VirtualFile file = element.getFile();
      return file != null && file.isValid() ? file : null;
    }
  });
  return VfsUtilCore.toVirtualFileArray(files);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileSystemTreeImpl.java

示例15: treeExpanded

import com.intellij.openapi.fileChooser.FileElement; //导入依赖的package包/类
public void treeExpanded(final TreeExpansionEvent event) {
  if (myTreeBuilder == null || !myTreeBuilder.isNodeBeingBuilt(event.getPath())) return;

  TreePath path = event.getPath();
  DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
  if (node.getUserObject() instanceof FileNodeDescriptor) {
    FileNodeDescriptor nodeDescriptor = (FileNodeDescriptor)node.getUserObject();
    final FileElement fileDescriptor = nodeDescriptor.getElement();
    final VirtualFile virtualFile = fileDescriptor.getFile();
    if (virtualFile != null) {
      if (!myEverExpanded.contains(virtualFile)) {
        if (virtualFile instanceof NewVirtualFile) {
          ((NewVirtualFile)virtualFile).markDirty();
        }
        myEverExpanded.add(virtualFile);
      }


      AbstractTreeStructure treeStructure = myTreeBuilder.getTreeStructure();
      final boolean async = treeStructure != null && treeStructure.isToBuildChildrenInBackground(virtualFile);
      DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_MODAL, new Runnable() {
        @Override
        public void run() {
          if (virtualFile instanceof NewVirtualFile) {
            RefreshQueue.getInstance().refresh(async, false, null, ModalityState.stateForComponent(myTree), virtualFile);
          }
          else {
            virtualFile.refresh(async, false);
          }
        }
      });
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:FileSystemTreeImpl.java


注:本文中的com.intellij.openapi.fileChooser.FileElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。