當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。