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


Java LibraryProjectStructureElement类代码示例

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


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

示例1: init

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Override
public void init(final StructureConfigurableContext context) {
  super.init(context);

  addItemsChangeListener(new ItemsChangeListener() {
    @Override
    public void itemChanged(@Nullable Object deletedItem) {
      if (deletedItem instanceof Library) {
        final Library library = (Library)deletedItem;
        final MyNode node = findNodeByObject(myRoot, library);
        if (node != null) {
          final TreeNode parent = node.getParent();
          node.removeFromParent();
          ((DefaultTreeModel)myTree.getModel()).reload(parent);
        }
        myContext.getDaemonAnalyzer().removeElement(new LibraryProjectStructureElement(myContext, library));
      }
    }

    @Override
    public void itemsExternallyChanged() {
      //do nothing
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ModuleStructureConfigurable.java

示例2: getSelectedElement

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Override
protected ProjectStructureElement getSelectedElement() {
  final List<SourceItemNode> nodes = myTree.getSelectedSourceItemNodes();
  if (nodes.size() != 1) return null;
  ArtifactsTreeNode node = nodes.get(0);
  if (!(node instanceof SourceItemNode)) {
    return null;
  }

  PackagingSourceItem sourceItem = ((SourceItemNode)node).getSourceItem();
  if (sourceItem == null) return null;

  final StructureConfigurableContext context = getContext();
  if (sourceItem instanceof ModuleOutputSourceItem) {
    return new ModuleProjectStructureElement(context, ((ModuleOutputSourceItem)sourceItem).getModule());
  }
  else if (sourceItem instanceof LibrarySourceItem) {
    return new LibraryProjectStructureElement(context, ((LibrarySourceItem)sourceItem).getLibrary());
  }
  else if (sourceItem instanceof ArtifactSourceItem) {
    return myArtifactContext.getOrCreateArtifactElement(((ArtifactSourceItem)sourceItem).getArtifact());
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SourceItemFindUsagesAction.java

示例3: getSelectedElement

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Override
protected ProjectStructureElement getSelectedElement() {
  final OrderEntry entry = getSelectedEntry();
  if (entry instanceof LibraryOrderEntry) {
    final Library library = ((LibraryOrderEntry)entry).getLibrary();
    if (library != null) {
      return new LibraryProjectStructureElement(getContext(), library);
    }
  }
  else if (entry instanceof ModuleOrderEntry) {
    final Module module = ((ModuleOrderEntry)entry).getModule();
    if (module != null) {
      return new ModuleProjectStructureElement(getContext(), module);
    }
  }
  else if (entry instanceof JdkOrderEntry) {
    final Sdk jdk = ((JdkOrderEntry)entry).getJdk();
    if (jdk != null) {
      return new SdkProjectStructureElement(getContext(), jdk);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ClasspathPanelImpl.java

示例4: getSelectedElement

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Override
protected ProjectStructureElement getSelectedElement() {
  final OrderEntry entry = getSelectedEntry();
  if (entry instanceof LibraryOrderEntry) {
    final Library library = ((LibraryOrderEntry)entry).getLibrary();
    if (library != null) {
      return new LibraryProjectStructureElement(getContext(), library);
    }
  }
  else if (entry instanceof ModuleOrderEntry) {
    final Module module = ((ModuleOrderEntry)entry).getModule();
    if (module != null) {
      return new ModuleProjectStructureElement(getContext(), module);
    }
  }
  else if (entry instanceof ModuleExtensionWithSdkOrderEntry) {
    final Sdk sdk = ((ModuleExtensionWithSdkOrderEntry)entry).getSdk();
    if (sdk != null) {
      return new SdkProjectStructureElement(getContext(), sdk);
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:ClasspathPanelImpl.java

示例5: update

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
  final ProjectStructureElement element = myConfigurable.getSelectedElement();
  boolean visible = false;
  if (element instanceof LibraryProjectStructureElement) {
    final LibraryEx library = (LibraryEx)((LibraryProjectStructureElement)element).getLibrary();
    visible = !LibraryEditingUtil.getSuitableModules(ModuleStructureConfigurable.getInstance(myProject), library.getKind(), library).isEmpty();
  }
  e.getPresentation().setVisible(visible);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AddLibraryToModuleDependenciesAction.java

示例6: actionPerformed

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final LibraryProjectStructureElement element = (LibraryProjectStructureElement)myConfigurable.getSelectedElement();
  if (element == null) return;
  final Library library = element.getLibrary();
  LibraryEditingUtil.showDialogAndAddLibraryToDependencies(library, myProject, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AddLibraryToModuleDependenciesAction.java

示例7: checkCanApply

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Override
public void checkCanApply() throws ConfigurationException {
  super.checkCanApply();
  checkForEmptyAndDuplicatedNames("Library", CommonBundle.getErrorTitle(), LibraryConfigurable.class);
  for (LibraryConfigurable configurable : getLibraryConfigurables()) {
    if (configurable.getDisplayName().isEmpty()) {
      ((LibraryProjectStructureElement)configurable.getProjectStructureElement()).navigate();
      throw new ConfigurationException("Library name is not specified");
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BaseLibrariesConfigurable.java

示例8: getProjectStructureElements

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@NotNull
@Override
protected Collection<? extends ProjectStructureElement> getProjectStructureElements() {
  final List<ProjectStructureElement> result = new ArrayList<ProjectStructureElement>();
  for (LibraryConfigurable libraryConfigurable : getLibraryConfigurables()) {
    result.add(new LibraryProjectStructureElement(myContext, libraryConfigurable.getEditableObject()));
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:BaseLibrariesConfigurable.java

示例9: createLibraryNode

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
public void createLibraryNode(Library library) {
  final LibraryTable table = library.getTable();
  if (table != null) {
    final String level = table.getTableLevel();
    final LibraryConfigurable configurable =
      new LibraryConfigurable(myContext.createModifiableModelProvider(level), library, myContext, TREE_UPDATER);
    final MyNode node = new MyNode(configurable);
    addNode(node, myRoot);
    final ProjectStructureDaemonAnalyzer daemonAnalyzer = myContext.getDaemonAnalyzer();
    daemonAnalyzer.queueUpdate(new LibraryProjectStructureElement(myContext, library));
    daemonAnalyzer.queueUpdateForAllElementsWithErrors();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:BaseLibrariesConfigurable.java

示例10: removeLibraries

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
public void removeLibraries(@NotNull List<LibraryProjectStructureElement> libraries) {
  List<TreePath> pathsToRemove = new ArrayList<TreePath>();
  for (LibraryProjectStructureElement element : libraries) {
    getModelProvider().getModifiableModel().removeLibrary(element.getLibrary());
    MyNode node = findNodeByObject(myRoot, element.getLibrary());
    if (node != null) {
      pathsToRemove.add(TreeUtil.getPathFromRoot(node));
    }
  }
  myContext.getDaemonAnalyzer().removeElements(libraries);
  removePaths(pathsToRemove.toArray(new TreePath[pathsToRemove.size()]));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:BaseLibrariesConfigurable.java

示例11: LibraryConfigurable

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
protected LibraryConfigurable(final StructureLibraryTableModifiableModelProvider modelProvider,
                              final Library library,
                              final StructureConfigurableContext context,
                              final Runnable updateTree) {
  super(true, updateTree);
  myModel = modelProvider;
  myContext = context;
  myProject = context.getProject();
  myLibrary = library;
  myProjectStructureElement = new LibraryProjectStructureElement(context, myLibrary);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:LibraryConfigurable.java

示例12: replaceElement

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Override
public void replaceElement(final ProjectStructureElement newElement) {
  Library library = ((LibraryProjectStructureElement)newElement).getLibrary();
  PackagingElement<?> newLibraryElement = PackagingElementFactory.getInstance().createLibraryFiles(library.getName(),
                                                                                                   library.getTable().getTableLevel(),
                                                                                                   null);
  replaceElement(newLibraryElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:UsageInArtifact.java

示例13: checkCanApply

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Override
public void checkCanApply() throws ConfigurationException {
  super.checkCanApply();
  for (LibraryConfigurable configurable : getLibraryConfigurables()) {
    if (configurable.getDisplayName().isEmpty()) {
      ((LibraryProjectStructureElement)configurable.getProjectStructureElement()).navigate();
      throw new ConfigurationException("Library name is not specified");
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:BaseLibrariesConfigurable.java

示例14: removeLibrary

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
public void removeLibrary(@NotNull LibraryProjectStructureElement element) {
  getModelProvider().getModifiableModel().removeLibrary(element.getLibrary());
  myContext.getDaemonAnalyzer().removeElement(element);
  final MyNode node = findNodeByObject(myRoot, element.getLibrary());
  if (node != null) {
    removePaths(TreeUtil.getPathFromRoot(node));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:BaseLibrariesConfigurable.java

示例15: getProjectStructureElements

import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement; //导入依赖的package包/类
@Nonnull
@Override
protected Collection<? extends ProjectStructureElement> getProjectStructureElements() {
  final List<ProjectStructureElement> result = new ArrayList<ProjectStructureElement>();
  for (LibraryConfigurable libraryConfigurable : getLibraryConfigurables()) {
    result.add(new LibraryProjectStructureElement(myContext, libraryConfigurable.getEditableObject()));
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:BaseLibrariesConfigurable.java


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