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


Java ModuleGroup类代码示例

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


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

示例1: getParentModuleGroup

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
private PackageDependenciesNode getParentModuleGroup(String [] groupPath, ScopeType scopeType){
  final String key = StringUtil.join(groupPath, ",");
  ModuleGroupNode groupNode = getMap(myModuleGroupNodes, scopeType).get(key);
  if (groupNode == null) {
    groupNode = new ModuleGroupNode(new ModuleGroup(groupPath), myProject);
    getMap(myModuleGroupNodes, scopeType).put(key, groupNode);
    getRootNode(scopeType).add(groupNode);
  }
  if (groupPath.length > 1) {
    String [] path = new String[groupPath.length - 1];
    System.arraycopy(groupPath, 0, path, 0, groupPath.length - 1);
    final PackageDependenciesNode node = getParentModuleGroup(path, scopeType);
    node.add(groupNode);
  }
  return groupNode;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TreeModelBuilder.java

示例2: compare

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
public int compare(final MyNode o1, final MyNode o2) {
  final NamedConfigurable configurable1 = o1.getConfigurable();
  final NamedConfigurable configurable2 = o2.getConfigurable();
  if (configurable1.getClass() == configurable2.getClass()) {
    return StringUtil.naturalCompare(o1.getDisplayName(), o2.getDisplayName());
  }
  final Object editableObject1 = configurable1.getEditableObject();
  final Object editableObject2 = configurable2.getEditableObject();

  if (editableObject2 instanceof Module && editableObject1 instanceof ModuleGroup) return -1;
  if (editableObject1 instanceof Module && editableObject2 instanceof ModuleGroup) return 1;

  if (editableObject2 instanceof Module && editableObject1 instanceof String) return 1;
  if (editableObject1 instanceof Module && editableObject2 instanceof String) return -1;

  if (editableObject2 instanceof ModuleGroup && editableObject1 instanceof String) return 1;
  if (editableObject1 instanceof ModuleGroup && editableObject2 instanceof String) return -1;

  return 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ModuleStructureConfigurable.java

示例3: setSelected

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
public void setSelected(AnActionEvent e, boolean state) {
  myPlainMode = state;
  DefaultMutableTreeNode selection = null;
  final TreePath selectionPath = myTree.getSelectionPath();
  if (selectionPath != null){
    selection = (DefaultMutableTreeNode)selectionPath.getLastPathComponent();
  }
  final ModifiableModuleModel model = myContext.myModulesConfigurator.getModuleModel();
  final Module[] modules = model.getModules();
  for (Module module : modules) {
    final String[] groupPath = model.getModuleGroupPath(module);
    updateProjectTree(new Module[]{module}, groupPath != null ? new ModuleGroup(groupPath) : null);
  }
  if (state) {
    removeModuleGroups();
  }
  if (selection != null){
    TreeUtil.selectInTree(selection, true, myTree);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ModuleStructureConfigurable.java

示例4: getParentModuleGroup

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
private PackageDependenciesNode getParentModuleGroup(String[] groupPath){
  final String key = StringUtil.join(groupPath);
  ModuleGroupNode groupNode = myModuleGroupNodes.get(key);
  if (groupNode == null) {
    groupNode = new ModuleGroupNode(new ModuleGroup(groupPath), myProject);
    myModuleGroupNodes.put(key, groupNode);
    myRoot.add(groupNode);
  }
  if (groupPath.length > 1) {
    String [] path = new String[groupPath.length - 1];
    System.arraycopy(groupPath, 0, path, 0, groupPath.length - 1);
    final PackageDependenciesNode node = getParentModuleGroup(path);
    node.add(groupNode);
  }
  return groupNode;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FileTreeModelBuilder.java

示例5: getSelectedModules

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
private Module[] getSelectedModules() {
  final Object[] elements = getSelectedNodeElements();
  if (elements == null) {
    return null;
  }
  ArrayList<Module> result = new ArrayList<Module>();
  for (Object element : elements) {
    if (element instanceof Module) {
      result.add((Module)element);
    }
    else if (element instanceof ModuleGroup) {
      result.addAll(((ModuleGroup)element).modulesInGroup(myProject, true));
    }
  }

  return result.isEmpty() ? null : result.toArray(new Module[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FavoritesTreeViewPanel.java

示例6: getChildren

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
@NotNull
public Collection<AbstractTreeNode> getChildren() {
  final Collection<ModuleGroup> childGroups = getValue().childGroups(getProject());
  final List<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
  for (final ModuleGroup childGroup : childGroups) {
    result.add(createModuleGroupNode(childGroup));
  }
  Collection<Module> modules = getValue().modulesInGroup(getProject(), false);
  try {
    for (Module module : modules) {
      result.add(createModuleNode(module));
    }
  }
  catch (Exception e) {
    LOG.error(e);
  }

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

示例7: customizeCellRenderer

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
public void customizeCellRenderer(JTree tree, Object nodeValue, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  final Object value = ((DefaultMutableTreeNode)nodeValue).getUserObject();
  if (value instanceof DirectoryChooser.ItemWrapper) {
    DirectoryChooser.ItemWrapper wrapper = (DirectoryChooser.ItemWrapper)value;
    DirectoryChooser.PathFragment[] fragments = wrapper.getFragments();
    for (DirectoryChooser.PathFragment fragment : fragments) {
      append(fragment.getText(),
             fragment.isCommon() ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
    }
    setIcon(wrapper.getIcon(myFileIndex));
  }
  else if (value instanceof Module) {
    final Module module = (Module)value;
    append(module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    setIcon(ModuleType.get(module).getIcon());
  } else if (value instanceof ModuleGroup) {
    append(value.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    setIcon(PlatformIcons.CLOSED_MODULE_GROUP_ICON);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DirectoryChooserModuleTreeView.java

示例8: getSelectedModules

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Nullable
private Module[] getSelectedModules() {
  final TreePath[] treePaths = myTree.getSelectionPaths();
  if (treePaths != null) {
    Set<Module> result = new HashSet<Module>();
    for (TreePath path : treePaths) {
      PackageDependenciesNode node = (PackageDependenciesNode)path.getLastPathComponent();
      if (node instanceof ModuleNode) {
        result.add(((ModuleNode)node).getModule());
      }
      else if (node instanceof ModuleGroupNode) {
        final ModuleGroupNode groupNode = (ModuleGroupNode)node;
        final ModuleGroup moduleGroup = groupNode.getModuleGroup();
        result.addAll(moduleGroup.modulesInGroup(myProject, true));
      }
    }
    return result.isEmpty() ? null : result.toArray(new Module[result.size()]);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ScopeTreeViewPanel.java

示例9: compare

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
public int compare(final MyNode o1, final MyNode o2) {
  final NamedConfigurable configurable1 = o1.getConfigurable();
  final NamedConfigurable configurable2 = o2.getConfigurable();
  if (configurable1.getClass() == configurable2.getClass()) {
    return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName());
  }
  final Object editableObject1 = configurable1.getEditableObject();
  final Object editableObject2 = configurable2.getEditableObject();

  if (editableObject2 instanceof Module && editableObject1 instanceof ModuleGroup) return -1;
  if (editableObject1 instanceof Module && editableObject2 instanceof ModuleGroup) return 1;

  if (editableObject2 instanceof Module && editableObject1 instanceof String) return 1;
  if (editableObject1 instanceof Module && editableObject2 instanceof String) return -1;

  if (editableObject2 instanceof ModuleGroup && editableObject1 instanceof String) return 1;
  if (editableObject1 instanceof ModuleGroup && editableObject2 instanceof String) return -1;

  return 0;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:ModuleStructureConfigurable.java

示例10: getSelectedModules

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
private Module[] getSelectedModules() {
  final Object[] elements = getSelectedNodeElements();
  if (elements == null) {
    return null;
  }
  ArrayList<Module> result = new ArrayList<>();
  for (Object element : elements) {
    if (element instanceof Module) {
      result.add((Module)element);
    }
    else if (element instanceof ModuleGroup) {
      result.addAll(((ModuleGroup)element).modulesInGroup(myProject, true));
    }
  }

  return result.isEmpty() ? null : result.toArray(new Module[result.size()]);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:FavoritesTreeViewPanel.java

示例11: getChildren

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
@Nonnull
public Collection<AbstractTreeNode> getChildren() {
  final Collection<ModuleGroup> childGroups = getValue().childGroups(getProject());
  final List<AbstractTreeNode> result = new ArrayList<AbstractTreeNode>();
  for (final ModuleGroup childGroup : childGroups) {
    result.add(createModuleGroupNode(childGroup));
  }
  Collection<Module> modules = getValue().modulesInGroup(getProject(), false);
  try {
    for (Module module : modules) {
      result.add(createModuleNode(module));
    }
  }
  catch (Exception e) {
    LOG.error(e);
  }

  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:ModuleGroupNode.java

示例12: customizeCellRenderer

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
@RequiredDispatchThread
public void customizeCellRenderer(JTree tree, Object nodeValue, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
  final Object value = ((DefaultMutableTreeNode)nodeValue).getUserObject();
  if (value instanceof DirectoryChooser.ItemWrapper) {
    DirectoryChooser.ItemWrapper wrapper = (DirectoryChooser.ItemWrapper)value;
    DirectoryChooser.PathFragment[] fragments = wrapper.getFragments();
    for (DirectoryChooser.PathFragment fragment : fragments) {
      append(fragment.getText(),
             fragment.isCommon() ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
    }
    setIcon(wrapper.getIcon());
  }
  else if (value instanceof Module) {
    final Module module = (Module)value;
    append(module.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    setIcon(AllIcons.Nodes.Module);
  } else if (value instanceof ModuleGroup) {
    append(value.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
    setIcon(AllIcons.Nodes.Module);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:DirectoryChooserModuleTreeView.java

示例13: addModuleNode

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
private void addModuleNode(final Module module) {
  final MyNode node = new MyNode(new ModuleConfigurable(myContext.myModulesConfigurator, module, TREE_UPDATER));
  final TreePath selectionPath = myTree.getSelectionPath();
  MyNode parent = null;
  if (selectionPath != null) {
    MyNode selected = (MyNode)selectionPath.getLastPathComponent();
    final Object o = selected.getConfigurable().getEditableObject();
    if (o instanceof ModuleGroup) {
      myContext.myModulesConfigurator.getModuleModel().setModuleGroupPath(module, ((ModuleGroup)o).getGroupPath());
      parent = selected;
    } else if (o instanceof Module) { //create near selected
      final ModifiableModuleModel modifiableModuleModel = myContext.myModulesConfigurator.getModuleModel();
      final String[] groupPath = modifiableModuleModel.getModuleGroupPath((Module)o);
      if (groupPath != null) {
        modifiableModuleModel.setModuleGroupPath(module, groupPath);
        parent = findNodeByObject(myRoot, new ModuleGroup(groupPath));
      }
    }
  }
  if (parent == null) parent = myRoot;
  addNode(node, parent);
  myFacetEditorFacade.addFacetsNodes(module, node);
  addNodesFromExtensions(module, node);
  ((DefaultTreeModel)myTree.getModel()).reload(parent);
  selectNodeInTree(node);
  final ProjectStructureDaemonAnalyzer daemonAnalyzer = myContext.getDaemonAnalyzer();
  daemonAnalyzer.queueUpdate(new ModuleProjectStructureElement(myContext, module));
  daemonAnalyzer.queueUpdateForAllElementsWithErrors(); //missing modules added
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:ModuleStructureConfigurable.java

示例14: removeModuleGroups

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
private void removeModuleGroups() {
  for(int i = myRoot.getChildCount() - 1; i >=0; i--){
    final MyNode node = (MyNode)myRoot.getChildAt(i);
    if (node.getConfigurable().getEditableObject() instanceof ModuleGroup){
      node.removeFromParent();
    }
  }
  ((DefaultTreeModel)myTree.getModel()).reload(myRoot);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ModuleStructureConfigurable.java

示例15: processModulesMoved

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
public boolean processModulesMoved(final Module[] modules, @Nullable final ModuleGroup targetGroup) {
  final ModuleStructureConfigurable rootConfigurable = ModuleStructureConfigurable.getInstance(myProject);
  if (rootConfigurable.updateProjectTree(modules, targetGroup)) { //inside project root editor
    if (targetGroup != null) {
      rootConfigurable.selectNodeInTree(targetGroup.toString());
    }
    else {
      rootConfigurable.selectNodeInTree(modules[0].getName());
    }
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:IdeaProjectSettingsService.java


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