本文整理汇总了Java中com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement类的典型用法代码示例。如果您正苦于以下问题:Java ModuleProjectStructureElement类的具体用法?Java ModuleProjectStructureElement怎么用?Java ModuleProjectStructureElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleProjectStructureElement类属于com.intellij.openapi.roots.ui.configuration.projectRoot.daemon包,在下文中一共展示了ModuleProjectStructureElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLibraryOrderEntry
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
public void addLibraryOrderEntry(final Module module, final Library library) {
Component parent = WindowManager.getInstance().suggestParentWindow(module.getProject());
final ModuleEditor moduleEditor = myContext.myModulesConfigurator.getModuleEditor(module);
LOG.assertTrue(moduleEditor != null, "Current module editor was not initialized");
final ModifiableRootModel modelProxy = moduleEditor.getModifiableRootModelProxy();
final OrderEntry[] entries = modelProxy.getOrderEntries();
for (OrderEntry entry : entries) {
if (entry instanceof LibraryOrderEntry && Comparing.strEqual(entry.getPresentableName(), library.getName())) {
if (Messages.showYesNoDialog(parent,
ProjectBundle.message("project.roots.replace.library.entry.message", entry.getPresentableName()),
ProjectBundle.message("project.roots.replace.library.entry.title"),
Messages.getInformationIcon()) == Messages.YES) {
modelProxy.removeOrderEntry(entry);
break;
}
}
}
modelProxy.addLibraryEntry(library);
myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, module));
myTree.repaint();
}
示例2: remove
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
@Override
public boolean remove(@NotNull Collection<Module> modules) {
ModulesConfigurator modulesConfigurator = myContext.myModulesConfigurator;
List<Module> deleted = modulesConfigurator.deleteModules(modules);
if (deleted.isEmpty()) {
return false;
}
for (Module module : deleted) {
List<Facet> removed = modulesConfigurator.getFacetsConfigurator().removeAllFacets(module);
FacetStructureConfigurable.getInstance(myProject).removeFacetNodes(removed);
myContext.getDaemonAnalyzer().removeElement(new ModuleProjectStructureElement(myContext, module));
for (final ModuleStructureExtension extension : ModuleStructureExtension.EP_NAME.getExtensions()) {
extension.moduleRemoved(module);
}
}
return true;
}
示例3: getSelectedElement
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的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;
}
示例4: removeSelectedItems
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
private void removeSelectedItems(final List removedRows) {
if (removedRows.isEmpty()) {
return;
}
for (final Object removedRow : removedRows) {
final ClasspathTableItem<?> item = (ClasspathTableItem<?>)((Object[])removedRow)[ClasspathTableModel.ITEM_COLUMN];
final OrderEntry orderEntry = item.getEntry();
if (orderEntry == null) {
continue;
}
getRootModel().removeOrderEntry(orderEntry);
}
final int[] selectedRows = myEntryTable.getSelectedRows();
myModel.fireTableDataChanged();
TableUtil.selectRows(myEntryTable, selectedRows);
final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(myState.getProject()).getContext();
context.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule()));
}
示例5: getSelectedElement
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的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;
}
示例6: addLibraryOrderEntry
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
public void addLibraryOrderEntry(final Module module, final Library library) {
Component parent = WindowManager.getInstance().suggestParentWindow(module.getProject());
final ModuleEditor moduleEditor = myContext.myModulesConfigurator.getModuleEditor(module);
LOG.assertTrue(moduleEditor != null, "Current module editor was not initialized");
final ModifiableRootModel modelProxy = moduleEditor.getModifiableRootModelProxy();
final OrderEntry[] entries = modelProxy.getOrderEntries();
for (OrderEntry entry : entries) {
if (entry instanceof LibraryOrderEntry && Comparing.strEqual(entry.getPresentableName(), library.getName())) {
if (Messages.showYesNoDialog(parent,
ProjectBundle.message("project.roots.replace.library.entry.message", entry.getPresentableName()),
ProjectBundle.message("project.roots.replace.library.entry.title"),
Messages.getInformationIcon()) == DialogWrapper.OK_EXIT_CODE) {
modelProxy.removeOrderEntry(entry);
break;
}
}
}
modelProxy.addLibraryEntry(library);
myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, module));
myTree.repaint();
}
示例7: removeModule
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
@Override
protected boolean removeModule(final Module module) {
ModulesConfigurator modulesConfigurator = myContext.myModulesConfigurator;
if (!modulesConfigurator.deleteModule(module)) {
//wait for confirmation
return false;
}
List<Facet> removed = modulesConfigurator.getFacetsConfigurator().removeAllFacets(module);
FacetStructureConfigurable.getInstance(myProject).removeFacetNodes(removed);
myContext.getDaemonAnalyzer().removeElement(new ModuleProjectStructureElement(myContext, module));
for (final ModuleStructureExtension extension : ModuleStructureExtension.EP_NAME.getExtensions()) {
extension.moduleRemoved(module);
}
return true;
}
示例8: removeSelectedItems
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
private void removeSelectedItems(final List removedRows) {
if (removedRows.isEmpty()) {
return;
}
for (final Object removedRow : removedRows) {
final ClasspathTableItem<?> item = (ClasspathTableItem<?>)((Object[])removedRow)[ClasspathTableModel.ITEM_COLUMN];
final OrderEntry orderEntry = item.getEntry();
getRootModel().removeOrderEntry(orderEntry);
}
final int[] selectedRows = myEntryTable.getSelectedRows();
myModel.fireTableDataChanged();
TableUtil.selectRows(myEntryTable, selectedRows);
final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(myState.getProject()).getContext();
context.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(context, getRootModel().getModule()));
}
示例9: getSelectedElement
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的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;
}
示例10: ModuleConfigurable
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
public ModuleConfigurable(ModulesConfigurator modulesConfigurator,
Module module,
final Runnable updateTree) {
super(true, updateTree);
myModule = module;
myModuleName = myModule.getName();
myConfigurator = modulesConfigurator;
myContext = ModuleStructureConfigurable.getInstance(myModule.getProject()).getContext();
myProjectStructureElement = new ModuleProjectStructureElement(myContext, myModule);
}
示例11: getProjectStructureElements
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
@NotNull
@Override
protected Collection<? extends ProjectStructureElement> getProjectStructureElements() {
final List<ProjectStructureElement> result = new ArrayList<ProjectStructureElement>();
for (Module module : myModuleManager.getModules()) {
result.add(new ModuleProjectStructureElement(myContext, module));
}
return result;
}
示例12: removeLibraryOrderEntry
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
public void removeLibraryOrderEntry(final Module module, final Library library) {
final ModuleEditor moduleEditor = myContext.myModulesConfigurator.getModuleEditor(module);
LOG.assertTrue(moduleEditor != null, "Current module editor was not initialized");
final ModifiableRootModel modelProxy = moduleEditor.getModifiableRootModelProxy();
final OrderEntry[] entries = modelProxy.getOrderEntries();
for (OrderEntry entry : entries) {
if (entry instanceof LibraryOrderEntry && Comparing.strEqual(entry.getPresentableName(), library.getName())) {
modelProxy.removeOrderEntry(entry);
break;
}
}
myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, module));
myTree.repaint();
}
示例13: addModuleNode
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的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
}
示例14: clearCaches
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
private void clearCaches() {
final ModuleStructureConfigurable rootConfigurable = ModuleStructureConfigurable.getInstance(myProject);
Module[] modules = rootConfigurable.getModules();
for (Module module : modules) {
final StructureConfigurableContext context = rootConfigurable.getContext();
context.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(context, module));
}
}
示例15: moduleStateChanged
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement; //导入依赖的package包/类
@Override
public void moduleStateChanged(final ModifiableRootModel moduleRootModel) {
for (ModuleEditor.ChangeListener listener : myAllModulesChangeListeners) {
listener.moduleStateChanged(moduleRootModel);
}
myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, moduleRootModel.getModule()));
}