• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ModuleGroup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: update

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
public void update(final AnActionEvent e) {
  super.update(e);
  boolean mainMenu = ActionPlaces.isMainMenuOrActionSearch(e.getPlace());
  final ModuleGroup[] moduleGroups = ModuleGroup.ARRAY_DATA_KEY.getData(e.getDataContext());
  final Module[] modules = e.getData(LangDataKeys.MODULE_CONTEXT_ARRAY);
  e.getPresentation().setVisible(!mainMenu && ((moduleGroups != null && moduleGroups.length > 0) ||
                                 (modules != null && modules.length > 0)));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:NewModuleInGroupAction.java


示例17: prepareDataFromContext

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
protected Object prepareDataFromContext(final AnActionEvent e) {
  final ModuleGroup[] moduleGroups = ModuleGroup.ARRAY_DATA_KEY.getData(e.getDataContext());
  if (moduleGroups != null && moduleGroups.length > 0) {
    return moduleGroups [0];
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:NewModuleInGroupAction.java


示例18: processCreatedModule

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
@Override
protected void processCreatedModule(final Module module, final Object dataFromContext) {
  ModuleGroup group = (ModuleGroup) dataFromContext;
  if (group != null) {
    ModuleManagerImpl.getInstanceImpl(module.getProject()).setModuleGroupPath(module, group.getGroupPath());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:NewModuleInGroupAction.java


示例19: collectSelectedElements

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
private static Object collectSelectedElements(final DataContext dataContext) {
  Object elements = retrieveData(null, CommonDataKeys.PSI_ELEMENT.getData(dataContext));
  elements = retrieveData(elements, LangDataKeys.PSI_ELEMENT_ARRAY.getData(dataContext));
  elements = retrieveData(elements, CommonDataKeys.PSI_FILE.getData(dataContext));
  elements = retrieveData(elements, ModuleGroup.ARRAY_DATA_KEY.getData(dataContext));
  elements = retrieveData(elements, LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext));
  elements = retrieveData(elements, LibraryGroupElement.ARRAY_DATA_KEY.getData(dataContext));
  elements = retrieveData(elements, NamedLibraryElement.ARRAY_DATA_KEY.getData(dataContext));
  elements = retrieveData(elements, CommonDataKeys.VIRTUAL_FILE.getData(dataContext));
  elements = retrieveData(elements, CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext));
  return elements;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AddToFavoritesAction.java


示例20: doMove

import com.intellij.ide.projectView.impl.ModuleGroup; //导入依赖的package包/类
public static void doMove(final Module[] modules, final ModuleGroup group, @Nullable final DataContext dataContext) {
  Project project = modules[0].getProject();
  for (final Module module : modules) {
    ModifiableModuleModel model = dataContext != null
                                  ? LangDataKeys.MODIFIABLE_MODULE_MODEL.getData(dataContext)
                                  : null;
    if (model != null){
      model.setModuleGroupPath(module, group == null ? null : group.getGroupPath());
    } else {
      ModuleManagerImpl.getInstanceImpl(project).setModuleGroupPath(module, group == null ? null : group.getGroupPath());
    }
  }

  AbstractProjectViewPane pane = ProjectView.getInstance(project).getCurrentProjectViewPane();
  if (pane != null) {
    pane.updateFromRoot(true);
  }

  if (!ProjectSettingsService.getInstance(project).processModulesMoved(modules, group) && pane != null) {
    if (group != null) {
      pane.selectModuleGroup(group, true);
    }
    else {
      pane.selectModule(modules[0], true);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:MoveModulesToGroupAction.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Section类代码示例发布时间:2022-05-22
下一篇:
Java EventBusService类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap