• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DefaultTreeExpander类的典型用法和代码示例

java 1次浏览

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

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

示例1: createPopupGroup

点赞 3

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
private ActionGroup createPopupGroup() {
  final DefaultActionGroup group = new DefaultActionGroup();
  group.add(new PutSourceItemIntoDefaultLocationAction(this, myArtifactsEditor));
  group.add(new PackAndPutIntoDefaultLocationAction(this, myArtifactsEditor));
  group.add(new PutSourceItemIntoParentAndLinkViaManifestAction(this, myArtifactsEditor));
  group.add(new ExtractIntoDefaultLocationAction(this, myArtifactsEditor));

  group.add(Separator.getInstance());
  group.add(new SourceItemNavigateAction(this));
  group.add(new SourceItemFindUsagesAction(this, myArtifactsEditor.getContext().getProject(), myArtifactsEditor.getContext().getParent()));

  DefaultTreeExpander expander = new DefaultTreeExpander(this);
  final CommonActionsManager commonActionsManager = CommonActionsManager.getInstance();
  group.add(Separator.getInstance());
  group.addAction(commonActionsManager.createExpandAllAction(expander, this));
  group.addAction(commonActionsManager.createCollapseAllAction(expander, this));
  return group;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:19,
代码来源:SourceItemsTree.java

示例2: createTreePanel

点赞 3

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
@NotNull
public static ToolWindowAlikePanel createTreePanel(@NotNull String title, @NotNull JTree tree) {
  ToolWindowAlikePanel panel = new ToolWindowAlikePanel(title, createScrollPane(tree));

  Object root = tree.getModel().getRoot();
  if (root instanceof TreeNode && ((TreeNode)root).getChildCount() > 0) {
    TreeExpander expander = new DefaultTreeExpander(tree);
    CommonActionsManager actions = CommonActionsManager.getInstance();

    AnAction expandAllAction = actions.createExpandAllAction(expander, tree);
    expandAllAction.getTemplatePresentation().setIcon(ExpandAll);

    AnAction collapseAllAction = actions.createCollapseAllAction(expander, tree);
    collapseAllAction.getTemplatePresentation().setIcon(CollapseAll);

    panel.setAdditionalTitleActions(expandAllAction, collapseAllAction);
  }

  return panel;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:21,
代码来源:ToolWindowAlikePanel.java

示例3: createTreeScrollPanel

点赞 3

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
/**
 * Creates scroll panel with templates tree in it.
 *
 * @return scroll panel
 */
private JScrollPane createTreeScrollPanel() {
    for (Map.Entry<VirtualFile, VcsRoot> entry : files.entrySet()) {
        createDirectoryNodes(entry.getKey(), entry.getValue());
    }

    final FileTreeRenderer renderer = new FileTreeRenderer();

    tree = new CheckboxTree(renderer, root);
    tree.setCellRenderer(renderer);
    tree.setRootVisible(true);
    tree.setShowsRootHandles(false);
    UIUtil.setLineStyleAngled(tree);
    TreeUtil.installActions(tree);

    final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(tree);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TreeUtil.expandAll(tree);

    tree.getModel().addTreeModelListener(treeModelListener);
    treeExpander = new DefaultTreeExpander(tree);

    return scrollPane;
}
 

开发者ID:hsz,
项目名称:idea-gitignore,
代码行数:29,
代码来源:UntrackFilesDialog.java

示例4: createPopupGroup

点赞 3

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
private ActionGroup createPopupGroup() {
  final DefaultActionGroup group = new DefaultActionGroup();
  group.add(new PutSourceItemIntoDefaultLocationAction(this, myArtifactsEditor));
  group.add(new PackAndPutIntoDefaultLocationAction(this, myArtifactsEditor));
  // java specific group.add(new PutSourceItemIntoParentAndLinkViaManifestAction(this, myArtifactsEditor));
  group.add(new ExtractIntoDefaultLocationAction(this, myArtifactsEditor));

  group.add(AnSeparator.getInstance());
  group.add(new SourceItemNavigateAction(this));
  group.add(new SourceItemFindUsagesAction(this, myArtifactsEditor.getContext().getProject(), myArtifactsEditor.getContext().getParent()));

  DefaultTreeExpander expander = new DefaultTreeExpander(this);
  final CommonActionsManager commonActionsManager = CommonActionsManager.getInstance();
  group.add(AnSeparator.getInstance());
  group.addAction(commonActionsManager.createExpandAllAction(expander, this));
  group.addAction(commonActionsManager.createCollapseAllAction(expander, this));
  return group;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:19,
代码来源:SourceItemsTree.java

示例5: createPopupActionGroup

点赞 3

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
private DefaultActionGroup createPopupActionGroup() {
  final LayoutTree tree = myLayoutTreeComponent.getLayoutTree();

  DefaultActionGroup popupActionGroup = new DefaultActionGroup();
  popupActionGroup.add(createAddGroup());
  final RemovePackagingElementAction removeAction = new RemovePackagingElementAction(this);
  removeAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), tree);
  popupActionGroup.add(removeAction);
  popupActionGroup.add(new ExtractArtifactAction(this));
  popupActionGroup.add(new InlineArtifactAction(this));
  popupActionGroup.add(new RenamePackagingElementAction(this));
  popupActionGroup.add(new SurroundElementWithAction(this));
  popupActionGroup.add(AnSeparator.getInstance());
  popupActionGroup.add(new HideContentAction(this));
  popupActionGroup.add(new LayoutTreeNavigateAction(myLayoutTreeComponent));
  popupActionGroup.add(new LayoutTreeFindUsagesAction(myLayoutTreeComponent, myProject, myContext.getParent()));

  popupActionGroup.add(AnSeparator.getInstance());
  CommonActionsManager actionsManager = CommonActionsManager.getInstance();
  DefaultTreeExpander treeExpander = new DefaultTreeExpander(tree);
  popupActionGroup.add(actionsManager.createExpandAllAction(treeExpander, tree));
  popupActionGroup.add(actionsManager.createCollapseAllAction(treeExpander, tree));
  return popupActionGroup;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:25,
代码来源:ArtifactEditorImpl.java

示例6: createPopupActionGroup

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
private DefaultActionGroup createPopupActionGroup() {
  final LayoutTree tree = myLayoutTreeComponent.getLayoutTree();

  DefaultActionGroup popupActionGroup = new DefaultActionGroup();
  final List<AnAction> createActions = new ArrayList<AnAction>();
  AddCompositeElementAction.addCompositeCreateActions(createActions, this);
  for (AnAction createAction : createActions) {
    popupActionGroup.add(createAction);
  }
  popupActionGroup.add(createAddNonCompositeElementGroup());
  final RemovePackagingElementAction removeAction = new RemovePackagingElementAction(this);
  removeAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), tree);
  popupActionGroup.add(removeAction);
  popupActionGroup.add(new ExtractArtifactAction(this));
  popupActionGroup.add(new InlineArtifactAction(this));
  popupActionGroup.add(new RenamePackagingElementAction(this));
  popupActionGroup.add(new SurroundElementWithAction(this));
  popupActionGroup.add(Separator.getInstance());
  popupActionGroup.add(new HideContentAction(this));
  popupActionGroup.add(new LayoutTreeNavigateAction(myLayoutTreeComponent));
  popupActionGroup.add(new LayoutTreeFindUsagesAction(myLayoutTreeComponent, myProject, myContext.getParent()));

  popupActionGroup.add(Separator.getInstance());
  CommonActionsManager actionsManager = CommonActionsManager.getInstance();
  DefaultTreeExpander treeExpander = new DefaultTreeExpander(tree);
  popupActionGroup.add(actionsManager.createExpandAllAction(treeExpander, tree));
  popupActionGroup.add(actionsManager.createCollapseAllAction(treeExpander, tree));
  return popupActionGroup;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:30,
代码来源:ArtifactEditorImpl.java

示例7: createNorthPanel

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
@Override
protected JComponent createNorthPanel() {
  final DefaultActionGroup group = new DefaultActionGroup();
  final TreeExpander expander = new DefaultTreeExpander(myTree);
  final CommonActionsManager actionsManager = CommonActionsManager.getInstance();
  group.add(actionsManager.createExpandAllAction(expander, myTree));
  group.add(actionsManager.createCollapseAllAction(expander, myTree));
  final JComponent component = ActionManager.getInstance().createActionToolbar(ActionPlaces.PROJECT_VIEW_TOOLBAR, group, true).getComponent();
  component.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.darkGray), component.getBorder()));
  return component;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:12,
代码来源:ChooseLibrariesDialogBase.java

示例8: UpdateInfoTree

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
public UpdateInfoTree(@NotNull ContentManager contentManager,
                      @NotNull Project project,
                      UpdatedFiles updatedFiles,
                      String rootName,
                      ActionInfo actionInfo) {
  super(contentManager, "reference.versionControl.toolwindow.update");
  myActionInfo = actionInfo;

  myFileStatusListener = new FileStatusListener() {
    public void fileStatusesChanged() {
      myTree.repaint();
    }

    public void fileStatusChanged(@NotNull VirtualFile virtualFile) {
      myTree.repaint();
    }
  };

  myProject = project;
  myUpdatedFiles = updatedFiles;
  myRootName = rootName;
  
  myShowOnlyFilteredItems = VcsConfiguration.getInstance(myProject).UPDATE_FILTER_BY_SCOPE;

  myFileStatusManager = FileStatusManager.getInstance(myProject);
  myFileStatusManager.addFileStatusListener(myFileStatusListener);
  createTree();
  init();
  myTreeExpander = new DefaultTreeExpander(myTree);
  myTreeIterable = new MyTreeIterable();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:32,
代码来源:UpdateInfoTree.java

示例9: getData

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
@Override
@Nullable
public Object getData(@NonNls final String dataId) {
  if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
    final PsiElement anElement = getSelectedElement();
    return anElement != null && anElement.isValid() ? anElement : super.getData(dataId);
  }
  if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
    return getSelectedElements();
  }
  if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
    return null;
  }
  if (CommonDataKeys.NAVIGATABLE.is(dataId)) {
    final DefaultMutableTreeNode selectedNode = getSelectedNode();
    if (selectedNode == null) return null;
    final HierarchyNodeDescriptor descriptor = getDescriptor(selectedNode);
    if (descriptor == null) return null;
    return getNavigatable(descriptor);
  }
  if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
    return getNavigatables();
  }
  if (PlatformDataKeys.TREE_EXPANDER.is(dataId)) {
    final JTree tree = getCurrentTree();
    if (tree != null) {
      return new DefaultTreeExpander(tree);
    }
  }
  return super.getData(dataId);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:32,
代码来源:HierarchyBrowserBase.java

示例10: createPopupActionGroup

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
private DefaultActionGroup createPopupActionGroup() {
  final LayoutTree tree = myLayoutTreeComponent.getLayoutTree();

  DefaultActionGroup popupActionGroup = new DefaultActionGroup();
  final List<AnAction> createActions = new ArrayList<AnAction>();
  AddCompositeElementAction.addCompositeCreateActions(createActions, this);
  for (AnAction createAction : createActions) {
    popupActionGroup.add(createAction);
  }
  popupActionGroup.add(createAddNonCompositeElementGroup());
  final RemovePackagingElementAction removeAction = new RemovePackagingElementAction(this);
  removeAction.registerCustomShortcutSet(CommonShortcuts.DELETE, tree);
  popupActionGroup.add(removeAction);
  popupActionGroup.add(new ExtractArtifactAction(this));
  popupActionGroup.add(new InlineArtifactAction(this));
  popupActionGroup.add(new RenamePackagingElementAction(this));
  popupActionGroup.add(new SurroundElementWithAction(this));
  popupActionGroup.add(Separator.getInstance());
  popupActionGroup.add(new HideContentAction(this));
  popupActionGroup.add(new LayoutTreeNavigateAction(myLayoutTreeComponent));
  popupActionGroup.add(new LayoutTreeFindUsagesAction(myLayoutTreeComponent, myProject, myContext.getParent()));

  popupActionGroup.add(Separator.getInstance());
  CommonActionsManager actionsManager = CommonActionsManager.getInstance();
  DefaultTreeExpander treeExpander = new DefaultTreeExpander(tree);
  popupActionGroup.add(actionsManager.createExpandAllAction(treeExpander, tree));
  popupActionGroup.add(actionsManager.createCollapseAllAction(treeExpander, tree));
  return popupActionGroup;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:30,
代码来源:ArtifactEditorImpl.java

示例11: getData

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
@Override
@Nullable
public Object getData(@NonNls final String dataId) {
  if (LangDataKeys.PSI_ELEMENT.is(dataId)) {
    final PsiElement anElement = getSelectedElement();
    return anElement != null && anElement.isValid() ? anElement : super.getData(dataId);
  }
  if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
    return getSelectedElements();
  }
  if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
    return null;
  }
  if (PlatformDataKeys.NAVIGATABLE.is(dataId)) {
    final DefaultMutableTreeNode selectedNode = getSelectedNode();
    if (selectedNode == null) return null;
    final HierarchyNodeDescriptor descriptor = getDescriptor(selectedNode);
    if (descriptor == null) return null;
    return getNavigatable(descriptor);
  }
  if (PlatformDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
    return getNavigatables();
  }
  if (PlatformDataKeys.TREE_EXPANDER.is(dataId)) {
    final JTree tree = getCurrentTree();
    if (tree != null) {
      return new DefaultTreeExpander(tree);
    }
  }
  return super.getData(dataId);
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:32,
代码来源:HierarchyBrowserBase.java

示例12: UpdateInfoTree

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
public UpdateInfoTree(@Nonnull ContentManager contentManager, @Nonnull Project project, UpdatedFiles updatedFiles, String rootName, ActionInfo actionInfo) {
  super(contentManager, "reference.versionControl.toolwindow.update");
  myActionInfo = actionInfo;

  myFileStatusListener = new FileStatusListener() {
    public void fileStatusesChanged() {
      myTree.repaint();
    }

    public void fileStatusChanged(@Nonnull VirtualFile virtualFile) {
      myTree.repaint();
    }
  };

  myProject = project;
  myUpdatedFiles = updatedFiles;
  myRootName = rootName;

  myShowOnlyFilteredItems = VcsConfiguration.getInstance(myProject).UPDATE_FILTER_BY_SCOPE;

  myFileStatusManager = FileStatusManager.getInstance(myProject);
  myFileStatusManager.addFileStatusListener(myFileStatusListener);
  createTree();
  init();
  myTreeExpander = new DefaultTreeExpander(myTree);
  myTreeIterable = new MyTreeIterable();
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:28,
代码来源:UpdateInfoTree.java

示例13: createToolbar

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
private JComponent createToolbar() {
  JPanel toolBarPanel = new JPanel(new GridLayout());
  DefaultActionGroup leftGroup = new DefaultActionGroup();
  leftGroup.add(ActionManager.getInstance().getAction(RUN_DASHBOARD_TOOLBAR));
  // TODO [konstantin.aleev] provide context help ID
  //leftGroup.add(new Separator());
  //leftGroup.add(new ContextHelpAction(HELP_ID));

  ActionToolbar leftActionToolBar = ActionManager.getInstance().createActionToolbar(PLACE_TOOLBAR, leftGroup, false);
  toolBarPanel.add(leftActionToolBar.getComponent());

  myTree.putClientProperty(DataManager.CLIENT_PROPERTY_DATA_PROVIDER, new DataProvider() {
    @Override
    public Object getData(@Nonnull @NonNls Key dataId) {
      if (KEY == dataId) {
        return RunDashboardContent.this;
      }
      return null;
    }
  });
  leftActionToolBar.setTargetComponent(myTree);

  DefaultActionGroup rightGroup = new DefaultActionGroup();

  TreeExpander treeExpander = new DefaultTreeExpander(myTree);
  AnAction expandAllAction = CommonActionsManager.getInstance().createExpandAllAction(treeExpander, this);
  rightGroup.add(expandAllAction);

  AnAction collapseAllAction = CommonActionsManager.getInstance().createCollapseAllAction(treeExpander, this);
  rightGroup.add(collapseAllAction);

  rightGroup.add(new AnSeparator());
  myGroupers.stream().filter(grouper -> !grouper.getRule().isAlwaysEnabled()).forEach(grouper -> rightGroup.add(new GroupAction(grouper)));

  ActionToolbar rightActionToolBar = ActionManager.getInstance().createActionToolbar(PLACE_TOOLBAR, rightGroup, false);
  toolBarPanel.add(rightActionToolBar.getComponent());
  rightActionToolBar.setTargetComponent(myTree);
  return toolBarPanel;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:40,
代码来源:RunDashboardContent.java

示例14: getData

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
@Override
@Nullable
public Object getData(@Nonnull Key<?> dataId) {
  if (LangDataKeys.PSI_ELEMENT == dataId) {
    final PsiElement anElement = getSelectedElement();
    return anElement != null && anElement.isValid() ? anElement : super.getData(dataId);
  }
  if (LangDataKeys.PSI_ELEMENT_ARRAY == dataId) {
    return getSelectedElements();
  }
  if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER == dataId) {
    return null;
  }
  if (PlatformDataKeys.NAVIGATABLE == dataId) {
    final DefaultMutableTreeNode selectedNode = getSelectedNode();
    if (selectedNode == null) return null;
    final HierarchyNodeDescriptor descriptor = getDescriptor(selectedNode);
    if (descriptor == null) return null;
    return getNavigatable(descriptor);
  }
  if (PlatformDataKeys.NAVIGATABLE_ARRAY == dataId) {
    return getNavigatables();
  }
  if (PlatformDataKeys.TREE_EXPANDER == dataId) {
    final JTree tree = getCurrentTree();
    if (tree != null) {
      return new DefaultTreeExpander(tree);
    }
  }
  return super.getData(dataId);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:32,
代码来源:HierarchyBrowserBase.java

示例15: CommittedChangesTreeBrowser

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
public CommittedChangesTreeBrowser(final Project project, final List<CommittedChangeList> changeLists) {
  super(new BorderLayout());

  myProject = project;
  myDecorators = new LinkedList<CommittedChangeListDecorator>();
  myChangeLists = changeLists;
  myChangesTree = new ChangesBrowserTree();
  myChangesTree.setRootVisible(false);
  myChangesTree.setShowsRootHandles(true);
  myChangesTree.setCellRenderer(new CommittedChangeListRenderer(project, myDecorators));
  TreeUtil.expandAll(myChangesTree);
  myChangesTree.getExpandableItemsHandler().setEnabled(false);

  myDetailsView = new RepositoryChangesBrowser(project, Collections.<CommittedChangeList>emptyList());
  myDetailsView.getViewer().setScrollPaneBorder(RIGHT_BORDER);

  myChangesTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
      updateBySelectionChange();
    }
  });

  final TreeLinkMouseListener linkMouseListener = new TreeLinkMouseListener(new CommittedChangeListRenderer(project, myDecorators));
  linkMouseListener.installOn(myChangesTree);

  myLeftPanel = new JPanel(new BorderLayout());

  initSplitters();

  updateBySelectionChange();

  Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
  CustomShortcutSet quickdocShortcuts = new CustomShortcutSet(keymap.getShortcuts(IdeActions.ACTION_QUICK_JAVADOC));
  EmptyAction.registerWithShortcutSet("CommittedChanges.Details", quickdocShortcuts, this);

  myCopyProvider = new TreeCopyProvider(myChangesTree);
  myTreeExpander = new DefaultTreeExpander(myChangesTree);
  myDetailsView.addToolbarAction(ActionManager.getInstance().getAction("Vcs.ShowTabbedFileHistory"));

  myHelpId = ourHelpId;

  myDetailsView.getDiffAction().registerCustomShortcutSet(myDetailsView.getDiffAction().getShortcutSet(), myChangesTree);

  myConnection = myProject.getMessageBus().connect();
  myConnection.subscribe(ITEMS_RELOADED, new CommittedChangesReloadListener() {
    public void itemsReloaded() {
    }
    public void emptyRefresh() {
      updateGrouping();
    }
  });
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:53,
代码来源:CommittedChangesTreeBrowser.java

示例16: initTree

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
private void initTree() {
  myTree = new CheckboxTree(new CheckboxTree.CheckboxTreeCellRenderer(true) {
    @Override
    public void customizeRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
      if (!(value instanceof CheckedTreeNode)) return;
      CheckedTreeNode node = (CheckedTreeNode)value;
      SimpleTextAttributes attributes = node.getUserObject() instanceof IntentionActionMetaData ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
      final String text = getNodeText(node);
      final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
      UIUtil.changeBackGround(this, background);
      if (text != null) {
        SearchUtil.appendFragments(myFilter != null ? myFilter.getFilter() : null,
                                   text,
                                   attributes.getStyle(),
                                   attributes.getFgColor(),
                                   background,
                                   getTextRenderer());
      }
    }
  }, new CheckedTreeNode(null));

  myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      TreePath path = e.getPath();
      Object userObject = ((DefaultMutableTreeNode)path.getLastPathComponent()).getUserObject();
      selectionChanged(userObject);
    }
  });

  myFilter = new MyFilterComponent();
  myComponent = new JPanel(new BorderLayout());
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
  myNorthPanel = new JPanel(new BorderLayout());
  myNorthPanel.add(myFilter, BorderLayout.CENTER);

  final DefaultActionGroup group = new DefaultActionGroup();
  final CommonActionsManager actionManager = CommonActionsManager.getInstance();

  final DefaultTreeExpander treeExpander = new DefaultTreeExpander(myTree);
  group.add(actionManager.createExpandAllAction(treeExpander, myTree));
  group.add(actionManager.createCollapseAllAction(treeExpander, myTree));

  myNorthPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true).getComponent(), BorderLayout.WEST);

  myComponent.add(myNorthPanel, BorderLayout.NORTH);
  myComponent.add(scrollPane, BorderLayout.CENTER);

  myFilter.reset();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:51,
代码来源:IntentionSettingsTree.java

示例17: AbstractFileTreeTable

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
/**
 * Due to historical reasons, passed filter does not perform all jobs - fileIndex.isInContent is checked in addition.
 * Flag showContentFilesOnly allows you to disable such behavior.
 */
public AbstractFileTreeTable(@NotNull Project project,
                             @NotNull Class<T> valueClass,
                             @NotNull String valueTitle,
                             @NotNull VirtualFileFilter filter,
                             boolean showProjectNode,
                             boolean showContentFilesOnly) {
  super(new MyModel<T>(project, valueClass, valueTitle, showContentFilesOnly ? new ProjectContentFileFilter(project, filter) : filter));
  myProject = project;

  //noinspection unchecked
  myModel = (MyModel)getTableModel();
  myModel.setTreeTable(this);

  new TreeTableSpeedSearch(this, new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath o) {
      final DefaultMutableTreeNode node = (DefaultMutableTreeNode)o.getLastPathComponent();
      final Object userObject = node.getUserObject();
      if (userObject == null) {
        return getProjectNodeText();
      }
      if (userObject instanceof VirtualFile) {
        return ((VirtualFile)userObject).getName();
      }
      return node.toString();
    }
  });
  final DefaultTreeExpander treeExpander = new DefaultTreeExpander(getTree());
  CommonActionsManager.getInstance().createExpandAllAction(treeExpander, this);
  CommonActionsManager.getInstance().createCollapseAllAction(treeExpander, this);

  getTree().setShowsRootHandles(true);
  getTree().setLineStyleAngled();
  getTree().setRootVisible(showProjectNode);
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  getTree().setCellRenderer(new DefaultTreeCellRenderer() {
    @Override
    public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded,
                                                  final boolean leaf, final int row, final boolean hasFocus) {
      super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
      if (value instanceof ProjectRootNode) {
        setText(getProjectNodeText());
        setIcon(AllIcons.Nodes.Project);
        return this;
      }
      FileNode fileNode = (FileNode)value;
      VirtualFile file = fileNode.getObject();
      setText(fileNode.getParent() instanceof FileNode ? file.getName() : file.getPresentableUrl());
      if (file.isDirectory()) {
        setIcon(fileIndex.isExcluded(file) ? AllIcons.Modules.ExcludeRoot : PlatformIcons.DIRECTORY_CLOSED_ICON);
      }
      else {
        setIcon(IconUtil.getIcon(file, 0, null));
      }
      return this;
    }
  });
  getTableHeader().setReorderingAllowed(false);

  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  setPreferredScrollableViewportSize(new Dimension(300, getRowHeight() * 10));

  getColumnModel().getColumn(0).setPreferredWidth(280);
  getColumnModel().getColumn(1).setPreferredWidth(60);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:70,
代码来源:AbstractFileTreeTable.java

示例18: CommittedChangesTreeBrowser

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
public CommittedChangesTreeBrowser(final Project project, final List<CommittedChangeList> changeLists) {
  super(new BorderLayout());

  myProject = project;
  myDecorators = new LinkedList<CommittedChangeListDecorator>();
  myChangeLists = changeLists;
  myChangesTree = new ChangesBrowserTree();
  myChangesTree.setRootVisible(false);
  myChangesTree.setShowsRootHandles(true);
  myChangesTree.setCellRenderer(new CommittedChangeListRenderer(project, myDecorators));
  TreeUtil.expandAll(myChangesTree);
  myChangesTree.getExpandableItemsHandler().setEnabled(false);

  myDetailsView = new RepositoryChangesBrowser(project, Collections.<CommittedChangeList>emptyList());
  myDetailsView.getViewer().setScrollPaneBorder(RIGHT_BORDER);

  myChangesTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
      updateBySelectionChange();
    }
  });

  final TreeLinkMouseListener linkMouseListener = new TreeLinkMouseListener(new CommittedChangeListRenderer(project, myDecorators));
  linkMouseListener.installOn(myChangesTree);

  myLeftPanel = new JPanel(new BorderLayout());

  initSplitters();

  updateBySelectionChange();

  ActionManager.getInstance().getAction("CommittedChanges.Details").registerCustomShortcutSet(
    new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_QUICK_JAVADOC)),
    this);

  myCopyProvider = new TreeCopyProvider(myChangesTree);
  myTreeExpander = new DefaultTreeExpander(myChangesTree);
  myDetailsView.addToolbarAction(ActionManager.getInstance().getAction("Vcs.ShowTabbedFileHistory"));

  myHelpId = ourHelpId;

  myDetailsView.getDiffAction().registerCustomShortcutSet(CommonShortcuts.getDiff(), myChangesTree);

  myConnection = myProject.getMessageBus().connect();
  myConnection.subscribe(ITEMS_RELOADED, new CommittedChangesReloadListener() {
    public void itemsReloaded() {
    }
    public void emptyRefresh() {
      updateGrouping();
    }
  });
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:53,
代码来源:CommittedChangesTreeBrowser.java

示例19: AbstractFileTreeTable

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
public AbstractFileTreeTable(@NotNull Project project,
                             @NotNull Class<T> valueClass,
                             @NotNull String valueTitle,
                             @NotNull VirtualFileFilter filter,
                             boolean showProjectNode) {
  super(new MyModel<T>(project, valueClass, valueTitle, filter));
  myProject = project;

  myModel = (MyModel)getTableModel();
  myModel.setTreeTable(this);

  new TreeTableSpeedSearch(this, new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath o) {
      final DefaultMutableTreeNode node = (DefaultMutableTreeNode)o.getLastPathComponent();
      final Object userObject = node.getUserObject();
      if (userObject == null) {
        return getProjectNodeText();
      }
      if (userObject instanceof VirtualFile) {
        return ((VirtualFile)userObject).getName();
      }
      return node.toString();
    }
  });
  final DefaultTreeExpander treeExpander = new DefaultTreeExpander(getTree());
  CommonActionsManager.getInstance().createExpandAllAction(treeExpander, this);
  CommonActionsManager.getInstance().createCollapseAllAction(treeExpander, this);

  getTree().setShowsRootHandles(true);
  getTree().setLineStyleAngled();
  getTree().setRootVisible(showProjectNode);
  getTree().setCellRenderer(new DefaultTreeCellRenderer() {
    @Override
    public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded,
                                                  final boolean leaf, final int row, final boolean hasFocus) {
      super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
      if (value instanceof ProjectRootNode) {
        setText(getProjectNodeText());
        setIcon(AllIcons.Nodes.Project);
        return this;
      }
      FileNode fileNode = (FileNode)value;
      VirtualFile file = fileNode.getObject();
      if (fileNode.getParent() instanceof FileNode) {
        setText(file.getName());
      }
      else {
        setText(file.getPresentableUrl());
      }

      Icon icon = file.isDirectory() ? PlatformIcons.DIRECTORY_CLOSED_ICON : IconUtil.getIcon(file, 0, null);
      setIcon(icon);
      return this;
    }
  });
  getTableHeader().setReorderingAllowed(false);


  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  setPreferredScrollableViewportSize(new Dimension(300, getRowHeight() * 10));

  getColumnModel().getColumn(0).setPreferredWidth(280);
  getColumnModel().getColumn(1).setPreferredWidth(60);
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:66,
代码来源:AbstractFileTreeTable.java

示例20: createTreeScrollPanel

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
/**
 * Creates scroll panel with templates tree in it.
 *
 * @return scroll panel
 */
private JScrollPane createTreeScrollPanel() {
    fillTreeData(null, true);

    final TemplateTreeRenderer renderer = new TemplateTreeRenderer() {
        protected String getFilter() {
            return profileFilter != null ? profileFilter.getFilter() : null;
        }
    };

    tree = new CheckboxTree(renderer, root) {
        public Dimension getPreferredScrollableViewportSize() {
            Dimension size = super.getPreferredScrollableViewportSize();
            size = new Dimension(size.width + 10, size.height);
            return size;
        }

        @Override
        protected void onNodeStateChanged(CheckedTreeNode node) {
            super.onNodeStateChanged(node);
            Resources.Template template = ((TemplateTreeNode) node).getTemplate();
            if (node.isChecked()) {
                checked.add(template);
            } else {
                checked.remove(template);
            }
        }
    };

    tree.setCellRenderer(renderer);
    tree.setRootVisible(false);
    tree.setShowsRootHandles(true);
    UIUtil.setLineStyleAngled(tree);
    TreeUtil.installActions(tree);

    tree.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            final TreePath path = getCurrentPath();
            if (path != null) {
                updateDescriptionPanel(path);
            }
        }
    });

    final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(tree);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TreeUtil.expandAll(tree);

    treeExpander = new DefaultTreeExpander(tree);
    profileFilter = new TemplatesFilterComponent();

    return scrollPane;
}
 

开发者ID:hsz,
项目名称:idea-gitignore,
代码行数:58,
代码来源:GeneratorDialog.java

示例21: CommittedChangesTreeBrowser

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
public CommittedChangesTreeBrowser(final Project project, final List<CommittedChangeList> changeLists) {
  super(new BorderLayout());

  myProject = project;
  myDecorators = new LinkedList<CommittedChangeListDecorator>();
  myChangeLists = changeLists;
  myChangesTree = new ChangesBrowserTree();
  myChangesTree.setRootVisible(false);
  myChangesTree.setShowsRootHandles(true);
  myChangesTree.setCellRenderer(new CommittedChangeListRenderer(project, myDecorators));
  TreeUtil.expandAll(myChangesTree);
  myChangesTree.getExpandableItemsHandler().setEnabled(false);

  myDetailsView = new RepositoryChangesBrowser(project, Collections.<CommittedChangeList>emptyList());
  myDetailsView.getViewer().setScrollPaneBorder(RIGHT_BORDER);

  myChangesTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
      updateBySelectionChange();
    }
  });

  final TreeLinkMouseListener linkMouseListener = new TreeLinkMouseListener(new CommittedChangeListRenderer(project, myDecorators));
  linkMouseListener.installOn(myChangesTree);

  myLeftPanel = new JPanel(new BorderLayout());

  initSplitters();

  updateBySelectionChange();

  ActionManager.getInstance().getAction("CommittedChanges.Details")
          .registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_QUICK_JAVADOC)),
                                     this);

  myCopyProvider = new TreeCopyProvider(myChangesTree);
  myTreeExpander = new DefaultTreeExpander(myChangesTree);
  myDetailsView.addToolbarAction(ActionManager.getInstance().getAction("Vcs.ShowTabbedFileHistory"));

  myHelpId = ourHelpId;

  myDetailsView.getDiffAction().registerCustomShortcutSet(CommonShortcuts.getDiff(), myChangesTree);

  myConnection = myProject.getMessageBus().connect();
  myConnection.subscribe(ITEMS_RELOADED, new CommittedChangesReloadListener() {
    public void itemsReloaded() {
    }

    public void emptyRefresh() {
      updateGrouping();
    }
  });
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:54,
代码来源:CommittedChangesTreeBrowser.java

示例22: AbstractFileTreeTable

点赞 2

import com.intellij.ide.DefaultTreeExpander; //导入依赖的package包/类
public AbstractFileTreeTable(@Nonnull Project project,
                             @Nonnull Class<T> valueClass,
                             @Nonnull String valueTitle,
                             @Nonnull VirtualFileFilter filter,
                             boolean showProjectNode) {
  super(new MyModel<T>(project, valueClass, valueTitle, filter));
  myProject = project;

  myModel = (MyModel)getTableModel();
  myModel.setTreeTable(this);

  new TreeTableSpeedSearch(this, new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath o) {
      final DefaultMutableTreeNode node = (DefaultMutableTreeNode)o.getLastPathComponent();
      final Object userObject = node.getUserObject();
      if (userObject == null) {
        return getProjectNodeText();
      }
      if (userObject instanceof VirtualFile) {
        return ((VirtualFile)userObject).getName();
      }
      return node.toString();
    }
  });
  final DefaultTreeExpander treeExpander = new DefaultTreeExpander(getTree());
  CommonActionsManager.getInstance().createExpandAllAction(treeExpander, this);
  CommonActionsManager.getInstance().createCollapseAllAction(treeExpander, this);

  getTree().setShowsRootHandles(true);
  getTree().setLineStyleAngled();
  getTree().setRootVisible(showProjectNode);
  getTree().setCellRenderer(new DefaultTreeCellRenderer() {
    @Override
    public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded,
                                                  final boolean leaf, final int row, final boolean hasFocus) {
      super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
      if (value instanceof ProjectRootNode) {
        setText(getProjectNodeText());
        setIcon(AllIcons.Nodes.ProjectTab);
        return this;
      }
      FileNode fileNode = (FileNode)value;
      VirtualFile file = fileNode.getObject();
      if (fileNode.getParent() instanceof FileNode) {
        setText(file.getName());
      }
      else {
        setText(file.getPresentableUrl());
      }

      Icon icon = file.isDirectory() ? AllIcons.Nodes.TreeClosed : VfsIconUtil.getIcon(file, 0, null);
      setIcon(icon);
      return this;
    }
  });
  getTableHeader().setReorderingAllowed(false);


  setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  setPreferredScrollableViewportSize(new Dimension(300, getRowHeight() * 10));

  getColumnModel().getColumn(0).setPreferredWidth(280);
  getColumnModel().getColumn(1).setPreferredWidth(60);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:66,
代码来源:AbstractFileTreeTable.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)