Java 类com.intellij.ui.CheckedTreeNode 实例源码

项目:IdeaCurrency    文件:IdeaCurrencyConfigUI.java   
public void init() {
    DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    root.removeAllChildren();
    for (String availableExchangeName : availableExchangeNames) {
        DefaultMutableTreeNode firstChild = new DefaultMutableTreeNode(availableExchangeName);
        Collection<CurrencyPair> currencyPairs = IdeaCurrencyApp.getInstance().getCurrencyPairs(availableExchangeName);
        for (CurrencyPair currencyPair : currencyPairs) {
            CheckedTreeNode secondChild = new CheckedTreeNode(currencyPair.toString());
            boolean selected = isSelected(availableExchangeName, currencyPair);
            secondChild.setChecked(selected);
            firstChild.add(secondChild);
            tree.expandPath(new TreePath(secondChild));
        }
        tree.expandPath(new TreePath(firstChild));
        root.add(firstChild);
    }
    model.reload();
    tree.treeDidChange();
    Util.expandAll(tree, new TreePath(root), true);
}
项目:IdeaCurrency    文件:IdeaCurrencyConfigUI.java   
@Override
public void apply() throws ConfigurationException {
    Set<SelectedExchangeCurrencyPair> selectedExchangeCurrencyPairs = Sets.newHashSet();
    DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    Enumeration rootEnum = root.children();
    while (rootEnum.hasMoreElements()) {
        DefaultMutableTreeNode rootEnumObject = (DefaultMutableTreeNode) rootEnum.nextElement();
        String exchangeName = rootEnumObject.getUserObject().toString();
        Enumeration childEnum = rootEnumObject.children();
        Set<CurrencyPair> currencyPairs = Sets.newHashSet();
        while (childEnum.hasMoreElements()) {
            CheckedTreeNode childEnumObject = (CheckedTreeNode) childEnum.nextElement();
            if (childEnumObject.isChecked()) {
                currencyPairs.add(new CurrencyPair(childEnumObject.getUserObject().toString()));
            }
        }
        SelectedExchangeCurrencyPair selectedExchangeCurrencyPair = new SelectedExchangeCurrencyPair(exchangeName, currencyPairs);
        selectedExchangeCurrencyPairs.add(selectedExchangeCurrencyPair);
    }
    IdeaCurrencyConfig.getInstance().setSelectedExchangeCurrencyPairs(selectedExchangeCurrencyPairs);
    IdeaCurrencyConfig.getInstance().setReloadInterval(reloadIntervalSlider.getValue());
    IdeaCurrencyConfig.getInstance().setActive(activeCheckBox.isSelected());
    isModified = false;
    triggerConfigChange();
}
项目:intellij-ce-playground    文件:BreakpointItemsTreeController.java   
public void buildTree(@NotNull Collection<? extends BreakpointItem> breakpoints) {
  final TreeState state = TreeState.createOn(myTreeView, myRoot);
  myRoot.removeAllChildren();
  myNodes.clear();
  myGroups.clear();
  for (BreakpointItem breakpoint : breakpoints) {
    BreakpointItemNode node = new BreakpointItemNode(breakpoint);
    CheckedTreeNode parent = getParentNode(breakpoint);
    parent.add(node);
    myNodes.put(breakpoint, node);
  }
  TreeUtil.sort(myRoot, myComparator);
  myInBuild = true;
  ((DefaultTreeModel)(myTreeView.getModel())).nodeStructureChanged(myRoot);
  state.applyTo(myTreeView, myRoot);
  myInBuild = false;
}
项目:intellij-ce-playground    文件:BreakpointItemsTreeController.java   
private static BreakpointsGroupNode getOrCreateGroupNode(CheckedTreeNode parent, final XBreakpointGroup group,
                                                                                     final int level) {
  Enumeration children = parent.children();
  while (children.hasMoreElements()) {
    Object element = children.nextElement();
    if (element instanceof BreakpointsGroupNode) {
      XBreakpointGroup groupFound = ((BreakpointsGroupNode)element).getGroup();
      if (groupFound.equals(group)) {
        return (BreakpointsGroupNode)element;
      }
    }
  }
  BreakpointsGroupNode groupNode = new BreakpointsGroupNode<XBreakpointGroup>(group, level);
  parent.add(groupNode);
  return groupNode;
}
项目:intellij-ce-playground    文件:BreakpointsFavoriteListProvider.java   
private void updateChildren() {
  if (myProject.isDisposed()) return;
  myChildren.clear();
  List<BreakpointItem> items = new ArrayList<BreakpointItem>();
  for (final BreakpointPanelProvider provider : myBreakpointPanelProviders) {
    provider.provideBreakpointItems(myProject, items);
  }
  getEnabledGroupingRules(myRulesEnabled);
  myTreeController.setGroupingRules(myRulesEnabled);
  myTreeController.rebuildTree(items);


  CheckedTreeNode root = myTreeController.getRoot();
  for (int i = 0; i < root.getChildCount(); i++) {
    TreeNode child = root.getChildAt(i);
    if (child instanceof DefaultMutableTreeNode) {
      replicate((DefaultMutableTreeNode)child, myNode, myChildren);
    }
  }
  myFavoritesManager.fireListeners(getListName(myProject));
}
项目:intellij-ce-playground    文件:PostfixTemplatesCheckboxTree.java   
public void initTree(@NotNull MultiMap<String, PostfixTemplate> langToTemplates) {
  myRoot.removeAllChildren();
  for (Map.Entry<String, Collection<PostfixTemplate>> entry : langToTemplates.entrySet()) {
    String id = entry.getKey();
    Language language = Language.findLanguageByID(id);
    String langName = language != null ? language.getDisplayName() : id;  
    CheckedTreeNode langNode = new CheckedTreeNode(langName);
    myRoot.add(langNode);
    for (PostfixTemplate template : entry.getValue()) {
      CheckedTreeNode templateNode = new PostfixTemplateCheckedTreeNode(template, langName);
      langNode.add(templateNode);
    }
  }

  myModel.nodeStructureChanged(myRoot);
  TreeUtil.expandAll(this);
  setSelectionRow(0);
}
项目:tools-idea    文件:BreakpointItemsTreeController.java   
public void buildTree(@NotNull Collection<? extends BreakpointItem> breakpoints) {
  final TreeState state = TreeState.createOn(myTreeView, myRoot);
  myRoot.removeAllChildren();
  myNodes.clear();
  myGroupNodes.clear();
  myGroups.clear();
  for (BreakpointItem breakpoint : breakpoints) {
    BreakpointItemNode node = new BreakpointItemNode(breakpoint);
    CheckedTreeNode parent = getParentNode(breakpoint);
    parent.add(node);
    myNodes.put(breakpoint, node);
  }
  TreeUtil.sort(myRoot, myComparator);
  ((DefaultTreeModel)(myTreeView.getModel())).nodeStructureChanged(myRoot);
  state.applyTo(myTreeView, myRoot);
  TreeUtil.expandAll(myTreeView);
}
项目:tools-idea    文件:XBreakpointsTree.java   
public void buildTree(@NotNull Collection<? extends B> breakpoints) {
  final TreeState state = TreeState.createOn(this, myRoot);
  myRoot.removeAllChildren();
  myNodes.clear();
  myGroupNodes.clear();
  myGroups.clear();
  for (B breakpoint : breakpoints) {
    BreakpointNode<B> node = new BreakpointNode<B>(breakpoint);
    CheckedTreeNode parent = getParentNode(breakpoint);
    parent.add(node);
    myNodes.put(breakpoint, node);
  }
  TreeUtil.sort(myRoot, myComparator);
  ((DefaultTreeModel)getModel()).nodeStructureChanged(myRoot);
  expandPath(new TreePath(myRoot));
  state.applyTo(this, myRoot);
}
项目:tools-idea    文件:BreakpointsFavoriteListProvider.java   
private void updateChildren() {
  if (myProject.isDisposed()) return;
  myChildren.clear();
  List<BreakpointItem> items = new ArrayList<BreakpointItem>();
  for (final BreakpointPanelProvider provider : myBreakpointPanelProviders) {
    provider.provideBreakpointItems(myProject, items);
  }
  getEnabledGroupingRules(myRulesEnabled);
  myTreeController.setGroupingRules(myRulesEnabled);
  myTreeController.rebuildTree(items);


  CheckedTreeNode root = myTreeController.getRoot();
  for (int i = 0; i < root.getChildCount(); i++) {
    TreeNode child = root.getChildAt(i);
    if (child instanceof DefaultMutableTreeNode) {
      replicate((DefaultMutableTreeNode)child, myNode, myChildren);
    }
  }
  FavoritesManager.getInstance(myProject).fireListeners(getListName(myProject));
}
项目:tools-idea    文件:CheckboxTreeTable.java   
private void adjustParentsAndChildren(final CheckedTreeNode node, final boolean checked) {
  changeNodeState(node, checked);
  if (!checked) {
    TreeNode parent = node.getParent();
    while (parent != null) {
      if (parent instanceof CheckedTreeNode) {
        changeNodeState((CheckedTreeNode)parent, false);
      }
      parent = parent.getParent();
    }
    uncheckChildren(node);
  }
  else {
    checkChildren(node);
  }
  repaint();
}
项目:intellij-plugin-v4    文件:LiteralChooser.java   
public Tree createTree(java.util.List<String> literals) {
    final CheckedTreeNode rootNode = new CheckedTreeNode("all literals not defined");
    for (String literal : literals) {
        CheckedTreeNode child = new CheckedTreeNode(new LiteralChooserObject(literal, Icons.LEXER_RULE));
        child.setChecked(true);
        rootNode.add(child);
    }
    DefaultTreeModel treeModel = new DefaultTreeModel(rootNode);

    selectedElements.addAll(literals); // all are "on" by default

    Tree tree = new Tree(treeModel);
    tree.setRootVisible(false);
    tree.setCellRenderer(new LiteralChooserRenderer());
    tree.addTreeSelectionListener(new MyTreeSelectionListener());

    return tree;
}
项目:consulo    文件:CustomizePluginsStepPanel.java   
private static void setupChecked(DefaultMutableTreeNode treeNode, Set<String> set, Boolean state) {
  Object userObject = treeNode.getUserObject();
  if (userObject instanceof IdeaPluginDescriptor) {
    String id = ((IdeaPluginDescriptor)userObject).getPluginId().getIdString();
    boolean contains = set.contains(id);
    if(state == null) {
      ((CheckedTreeNode)treeNode).setChecked(contains);
    }
    else if(contains) {
      ((CheckedTreeNode)treeNode).setChecked(state);
    }
  }

  int childCount = treeNode.getChildCount();
  for (int i = 0; i < childCount; i++) {
    DefaultMutableTreeNode childAt = (DefaultMutableTreeNode)treeNode.getChildAt(i);
    setupChecked(childAt, set, state);
  }
}
项目:consulo    文件:BreakpointItemsTreeController.java   
public void buildTree(@Nonnull Collection<? extends BreakpointItem> breakpoints) {
  final TreeState state = TreeState.createOn(myTreeView, myRoot);
  myRoot.removeAllChildren();
  myNodes.clear();
  for (BreakpointItem breakpoint : breakpoints) {
    BreakpointItemNode node = new BreakpointItemNode(breakpoint);
    CheckedTreeNode parent = getParentNode(breakpoint);
    parent.add(node);
    myNodes.put(breakpoint, node);
  }
  TreeUtil.sortRecursively(myRoot, COMPARATOR);
  myInBuild = true;
  ((DefaultTreeModel)(myTreeView.getModel())).nodeStructureChanged(myRoot);
  state.applyTo(myTreeView, myRoot);
  myInBuild = false;
}
项目:consulo    文件:BreakpointItemsTreeController.java   
private static BreakpointsGroupNode getOrCreateGroupNode(CheckedTreeNode parent, final XBreakpointGroup group,
                                                         final int level) {
  Enumeration children = parent.children();
  while (children.hasMoreElements()) {
    Object element = children.nextElement();
    if (element instanceof BreakpointsGroupNode) {
      XBreakpointGroup groupFound = ((BreakpointsGroupNode)element).getGroup();
      if (groupFound.equals(group)) {
        return (BreakpointsGroupNode)element;
      }
    }
  }
  BreakpointsGroupNode groupNode = new BreakpointsGroupNode<>(group, level);
  parent.add(groupNode);
  return groupNode;
}
项目:consulo    文件:BreakpointsFavoriteListProvider.java   
private void updateChildren() {
  if (myProject.isDisposed()) return;
  myChildren.clear();
  List<BreakpointItem> items = new ArrayList<BreakpointItem>();
  for (final BreakpointPanelProvider provider : myBreakpointPanelProviders) {
    provider.provideBreakpointItems(myProject, items);
  }
  getEnabledGroupingRules(myRulesEnabled);
  myTreeController.setGroupingRules(myRulesEnabled);
  myTreeController.rebuildTree(items);


  CheckedTreeNode root = myTreeController.getRoot();
  for (int i = 0; i < root.getChildCount(); i++) {
    TreeNode child = root.getChildAt(i);
    if (child instanceof DefaultMutableTreeNode) {
      replicate((DefaultMutableTreeNode)child, myNode, myChildren);
    }
  }
  FavoritesManager.getInstance(myProject).fireListeners(getListName(myProject));
}
项目:consulo    文件:CheckboxTreeTable.java   
private void adjustParentsAndChildren(final CheckedTreeNode node, final boolean checked) {
  changeNodeState(node, checked);
  if (!checked) {
    TreeNode parent = node.getParent();
    while (parent != null) {
      if (parent instanceof CheckedTreeNode) {
        changeNodeState((CheckedTreeNode)parent, false);
      }
      parent = parent.getParent();
    }
    uncheckChildren(node);
  }
  else {
    checkChildren(node);
  }
  repaint();
}
项目:intellij-ce-playground    文件:PushController.java   
public PushController(@NotNull Project project,
                      @NotNull VcsPushDialog dialog,
                      @NotNull List<? extends Repository> preselectedRepositories, @Nullable Repository currentRepo) {
  myProject = project;
  myPushSettings = ServiceManager.getService(project, PushSettings.class);
  myGlobalRepositoryManager = VcsRepositoryManager.getInstance(project);
  myExcludedRepositoryRoots = ContainerUtil.newHashSet(myPushSettings.getExcludedRepoRoots());
  myPreselectedRepositories = preselectedRepositories;
  myCurrentlyOpenedRepository = currentRepo;
  myPushSupports = getAffectedSupports();
  mySingleRepoProject = isSingleRepoProject();
  myDialog = dialog;
  CheckedTreeNode rootNode = new CheckedTreeNode(null);
  createTreeModel(rootNode);
  myPushLog = new PushLog(myProject, rootNode, isSyncStrategiesAllowed());
  myPushLog.getTree().addPropertyChangeListener(PushLogTreeUtil.EDIT_MODE_PROP, new PropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      // when user starts edit we need to force disable ok actions, because tree.isEditing() still false;
      // after editing completed okActions will be enabled automatically by dialog validation
      Boolean isEditMode = (Boolean)evt.getNewValue();
      if (isEditMode) {
        myDialog.disableOkActions();
      }
    }
  });
  startLoadingCommits();
  Disposer.register(dialog.getDisposable(), this);
}
项目:intellij-ce-playground    文件:BreakpointItemsTreeController.java   
@NotNull
private CheckedTreeNode getParentNode(final BreakpointItem breakpoint) {
  CheckedTreeNode parent = myRoot;
  for (int i = 0; i < myGroupingRules.size(); i++) {
    XBreakpointGroup group = myGroupingRules.get(i).getGroup(breakpoint.getBreakpoint(), Collections.emptyList());
    if (group != null) {
      parent = getOrCreateGroupNode(parent, group, i);
      if (breakpoint.isEnabled()) {
        parent.setChecked(true);
      }
    }
  }
  return parent;
}
项目:intellij-ce-playground    文件:BreakpointItemsTreeController.java   
private static Collection<XBreakpointGroup> getGroupNodes(CheckedTreeNode parent) {
  Collection<XBreakpointGroup> nodes = new ArrayList<XBreakpointGroup>();
  Enumeration children = parent.children();
  while (children.hasMoreElements()) {
    Object element = children.nextElement();
    if (element instanceof BreakpointsGroupNode) {
      nodes.add(((BreakpointsGroupNode)element).getGroup());
    }
  }
  return nodes;
}
项目:intellij-ce-playground    文件:BreakpointsCheckboxTree.java   
@Override
protected void nodeStateWillChange(CheckedTreeNode node) {
  super.nodeStateWillChange(node);
  if (myDelegate != null) {
    myDelegate.nodeStateWillChange(node);
  }
}
项目:intellij-ce-playground    文件:BreakpointsCheckboxTree.java   
@Override
protected void onNodeStateChanged(CheckedTreeNode node) {
  super.onNodeStateChanged(node);
  if (myDelegate != null) {
    myDelegate.nodeStateDidChange(node);
  }
}
项目:intellij-ce-playground    文件:PostfixTemplatesCheckboxTree.java   
public PostfixTemplatesCheckboxTree() {
  super(new CheckboxTreeCellRenderer() {
    @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;

      final Color background = selected ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeTextBackground();
      boolean isPostfixTemplate = node instanceof PostfixTemplateCheckedTreeNode;
      SimpleTextAttributes attributes = isPostfixTemplate
                                        ? SimpleTextAttributes.REGULAR_ATTRIBUTES
                                        : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
      getTextRenderer().append(StringUtil.notNullize(value.toString()),
                               new SimpleTextAttributes(background, attributes.getFgColor(), JBColor.RED, attributes.getStyle()));
      if (isPostfixTemplate) {
        getTextRenderer()
          .append(" (" + ((PostfixTemplateCheckedTreeNode)node).getTemplate().getExample() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
      }
    }
  }, new CheckedTreeNode(null));


  myModel = (DefaultTreeModel)getModel();
  myRoot = (CheckedTreeNode)myModel.getRoot();

  getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(@NotNull TreeSelectionEvent event) {
      selectionChanged();
    }
  });
  setRootVisible(false);
  setShowsRootHandles(true);
}
项目:intellij-ce-playground    文件:PostfixTemplatesCheckboxTree.java   
private void visit(@NotNull Consumer<PostfixTemplateCheckedTreeNode> consumer) {
  Enumeration languages = myRoot.children();
  while (languages.hasMoreElements()) {
    final CheckedTreeNode langNode = (CheckedTreeNode)languages.nextElement();
    Enumeration templates = langNode.children();
    while (templates.hasMoreElements()) {
      final PostfixTemplateCheckedTreeNode template = (PostfixTemplateCheckedTreeNode)templates.nextElement();
      consumer.consume(template);
    }
  }
}
项目:intellij-ce-playground    文件:LiveTemplateTree.java   
@Override
protected void onNodeStateChanged(final CheckedTreeNode node) {
  Object obj = node.getUserObject();
  if (obj instanceof TemplateImpl) {
    ((TemplateImpl)obj).setDeactivated(!node.isChecked());
  }
}
项目:intellij-ce-playground    文件:DetectedFrameworksTree.java   
public DetectedFrameworksTree(final FrameworkDetectionContext context, DetectedFrameworksComponent.GroupByOption groupByOption) {
  super(new DetectedFrameworksTreeRenderer(), new CheckedTreeNode(null), new CheckPolicy(true, true, true, false));
  myContext = context;
  myGroupByOption = groupByOption;
  setShowsRootHandles(false);
  setRootVisible(false);
}
项目:intellij-ce-playground    文件:DetectedFrameworksTree.java   
private void createNodesGroupedByDirectory(CheckedTreeNode root, final List<? extends DetectedFrameworkDescription> frameworks) {
  Map<VirtualFile, FrameworkDirectoryNode> nodes = new HashMap<VirtualFile, FrameworkDirectoryNode>();
  List<DetectedFrameworkNode> externalNodes = new ArrayList<DetectedFrameworkNode>();
  for (DetectedFrameworkDescription framework : frameworks) {
    VirtualFile parent = VfsUtil.getCommonAncestor(framework.getRelatedFiles());
    if (parent != null && !parent.isDirectory()) {
      parent = parent.getParent();
    }

    final DetectedFrameworkNode frameworkNode = new DetectedFrameworkNode(framework, myContext);
    if (parent != null) {
      createDirectoryNodes(parent, nodes).add(frameworkNode);
    }
    else {
      externalNodes.add(frameworkNode);
    }
  }
  List<FrameworkDirectoryNode> rootDirs = new ArrayList<FrameworkDirectoryNode>();
  for (FrameworkDirectoryNode directoryNode : nodes.values()) {
    if (directoryNode.getParent() == null) {
      rootDirs.add(directoryNode);
    }
  }
  for (FrameworkDirectoryNode dir : rootDirs) {
    root.add(collapseDirectoryNode(dir));
  }
  for (DetectedFrameworkNode node : externalNodes) {
    root.add(node);
  }
}
项目:intellij-ce-playground    文件:DetectedFrameworksTree.java   
@Override
protected void onNodeStateChanged(CheckedTreeNode node) {
  final List<DetectedFrameworkDescription> checked = Arrays.asList(getCheckedNodes(DetectedFrameworkDescription.class, null));
  final List<DetectedFrameworkDescription> disabled = FrameworkDetectionUtil.getDisabledDescriptions(checked, Collections.<DetectedFrameworkDescription>emptyList());
  for (DetectedFrameworkDescription description : disabled) {
    final DefaultMutableTreeNode treeNode = TreeUtil.findNodeWithObject(getRoot(), description);
    if (treeNode instanceof CheckedTreeNode) {
      ((CheckedTreeNode)treeNode).setChecked(false);
    }
  }
}
项目:intellij-ce-playground    文件:DetectedFrameworksTree.java   
private void createNodesGroupedByType(CheckedTreeNode root, final List<? extends DetectedFrameworkDescription> frameworks) {
  Map<FrameworkType, FrameworkTypeNode> groupNodes = new HashMap<FrameworkType, FrameworkTypeNode>();
  for (DetectedFrameworkDescription framework : frameworks) {
    final FrameworkType type = framework.getDetector().getFrameworkType();
    FrameworkTypeNode group = groupNodes.get(type);
    if (group == null) {
      group = new FrameworkTypeNode(type);
      groupNodes.put(type, group);
      root.add(group);
    }
    group.add(new DetectedFrameworkNode(framework, myContext));
  }
}
项目:intellij-ce-playground    文件:DetectedFrameworksTree.java   
public void rebuildTree(final List<? extends DetectedFrameworkDescription> frameworks) {
  final CheckedTreeNode root = getRoot();
  root.removeAllChildren();
  if (myGroupByOption == DetectedFrameworksComponent.GroupByOption.TYPE) {
    createNodesGroupedByType(root, frameworks);
  }
  else {
    createNodesGroupedByDirectory(root, frameworks);
  }
  ((DefaultTreeModel)getModel()).nodeStructureChanged(root);
  TreeUtil.expandAll(this);
  myDetectedFrameworks = frameworks;
}
项目:intellij-ce-playground    文件:ConflictResolutionDialog.java   
@Nullable
String getSelectedVariant() {
  Enumeration moduleNodes = myRoot.children();
  while (moduleNodes.hasMoreElements()) {
    Object child = moduleNodes.nextElement();
    if (child instanceof CheckedTreeNode) {
      CheckedTreeNode node = (CheckedTreeNode)child;
      if (node.isChecked()) {
        return node.getUserObject().toString();
      }
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:ConflictResolutionDialog.java   
@Override
protected void onNodeStateChanged(CheckedTreeNode node) {
  if (!node.isChecked()) {
    return;
  }
  Enumeration moduleNodes = myRoot.children();
  while (moduleNodes.hasMoreElements()) {
    Object child = moduleNodes.nextElement();
    if (child != node && child instanceof CheckedTreeNode) {
      CheckedTreeNode childNode = (CheckedTreeNode)child;
      childNode.setChecked(false);
    }
  }
}
项目:tools-idea    文件:AddSupportForFrameworksPanel.java   
public AddSupportForFrameworksPanel(final List<FrameworkSupportInModuleProvider> providers, final FrameworkSupportModelBase model) {
  myModel = model;
  myLibrariesContainer = model.getLibrariesContainer();
  myProviders = providers;
  createNodes();

  final Splitter splitter = new Splitter(false, 0.30f, 0.1f, 0.7f);
  myFrameworksTree = new FrameworksTree(myRoots) {
    @Override
    protected void onNodeStateChanged(CheckedTreeNode node) {
      if (!(node instanceof FrameworkSupportNode)) return;

      final FrameworkSupportNode frameworkSupportNode = (FrameworkSupportNode)node;
      if (frameworkSupportNode == getSelectedNode()) {
        updateOptionsPanel();
      }
      final FrameworkSupportInModuleConfigurable configurable = frameworkSupportNode.getConfigurable();
      configurable.onFrameworkSelectionChanged(node.isChecked());
      myModel.onFrameworkSelectionChanged(frameworkSupportNode);
      onFrameworkStateChanged();
    }
  };
  myFrameworksTree.addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
      onSelectionChanged();
    }
  });

  splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myFrameworksTree));
  myOptionsPanel = new JPanel(new CardLayout());
  myOptionsPanel.add(EMPTY_CARD, new JPanel());

  splitter.setSecondComponent(myOptionsPanel);
  myFrameworksPanel.add(splitter, BorderLayout.CENTER);

  myFrameworksTree.setSelectionRow(0);    
}
项目:tools-idea    文件:BreakpointItemsTreeController.java   
@NotNull
private CheckedTreeNode getParentNode(final BreakpointItem breakpoint) {
  CheckedTreeNode parent = myRoot;
  XBreakpointGroup parentGroup = null;
  for (int i = 0; i < myGroupingRules.size(); i++) {
    XBreakpointGroup group = getGroup(parentGroup, breakpoint, myGroupingRules.get(i));
    if (group != null) {
      parent = getOrCreateGroupNode(parent, group, i);
      parentGroup = group;
    }
  }
  return parent;
}
项目:tools-idea    文件:BreakpointItemsTreeController.java   
private <G extends XBreakpointGroup> BreakpointsGroupNode<G> getOrCreateGroupNode(CheckedTreeNode parent, final G group,
                                                                                     final int level) {
  //noinspection unchecked
  BreakpointsGroupNode<G> groupNode = (BreakpointsGroupNode<G>)myGroupNodes.get(group);
  if (groupNode == null) {
    groupNode = new BreakpointsGroupNode<G>(group, level);
    myGroupNodes.put(group, groupNode);
    parent.add(groupNode);
  }
  return groupNode;
}
项目:tools-idea    文件:BreakpointsCheckboxTree.java   
@Override
protected void onNodeStateChanged(CheckedTreeNode node) {
  super.onNodeStateChanged(node);
  if (myDelegate != null) {
    myDelegate.nodeStateChanged(node);
  }
}
项目:tools-idea    文件:XBreakpointsTree.java   
private XBreakpointsTree(final XBreakpointType<B, ?> type, final CheckedTreeNode root,
                         Collection<XBreakpointGroupingRule<B, ?>> groupingRules,
                         DialogWrapper parentDialog,
                         XBreakpointManager breakpointManager) {
  super(new BreakpointsTreeCellRenderer(), root);
  myRoot = root;
  myParentDialog = parentDialog;
  myComparator = new TreeNodeComparator<B>(type, breakpointManager);
  setGroupingRulesInternal(groupingRules);

  getEmptyText().setText("No " + type.getTitle());
}
项目:tools-idea    文件:XBreakpointsTree.java   
@NotNull
private CheckedTreeNode getParentNode(final B breakpoint) {
  CheckedTreeNode parent = myRoot;
  for (int i = 0; i < myGroupingRules.size(); i++) {
    XBreakpointGroup group = getGroup(breakpoint, myGroupingRules.get(i));
    if (group != null) {
      parent = getOrCreateGroupNode(parent, group, i);
    }
  }
  return parent;
}
项目:tools-idea    文件:XBreakpointsTree.java   
private <G extends XBreakpointGroup> BreakpointsGroupNode<G> getOrCreateGroupNode(CheckedTreeNode parent, final G group,
                                                                                     final int level) {
  //noinspection unchecked
  BreakpointsGroupNode<G> groupNode = (BreakpointsGroupNode<G>)myGroupNodes.get(group);
  if (groupNode == null) {
    groupNode = new BreakpointsGroupNode<G>(group, level);
    myGroupNodes.put(group, groupNode);
    parent.add(groupNode);
  }
  return groupNode;
}
项目:tools-idea    文件:XBreakpointsTree.java   
@Override
protected void onDoubleClick(CheckedTreeNode node) {
  if (node instanceof BreakpointNode<?>) {
    final Navigatable navigatable = ((BreakpointNode)node).getBreakpoint().getNavigatable();
    if (navigatable != null) {
      navigatable.navigate(true);
      myParentDialog.close(DialogWrapper.OK_EXIT_CODE);
    }
  }
}
项目:tools-idea    文件:CheckboxTreeTable.java   
protected boolean toggleNode(CheckedTreeNode node) {
  boolean checked = !node.isChecked();
  checkNode(node, checked);

  // notify model listeners about model change
  final TreeModel model = getTree().getModel();
  model.valueForPathChanged(new TreePath(node.getPath()), node.getUserObject());

  return checked;
}