本文整理汇总了Java中com.intellij.openapi.roots.ui.configuration.ModuleEditor类的典型用法代码示例。如果您正苦于以下问题:Java ModuleEditor类的具体用法?Java ModuleEditor怎么用?Java ModuleEditor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModuleEditor类属于com.intellij.openapi.roots.ui.configuration包,在下文中一共展示了ModuleEditor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLibraryOrderEntry
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的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: addLibraryOrderEntry
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的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();
}
示例3: selectOrderEntry
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
public ActionCallback selectOrderEntry(@Nonnull final Module module, @Nullable final OrderEntry orderEntry) {
Place p = new Place();
p.putPath(ProjectStructureConfigurable.CATEGORY, this);
Runnable r = null;
final MasterDetailsComponent.MyNode node = findModuleNode(module);
if (node != null) {
p.putPath(TREE_OBJECT, module);
p.putPath(ModuleEditor.SELECTED_EDITOR_NAME, ClasspathEditor.NAME);
r = new Runnable() {
@Override
public void run() {
if (orderEntry != null) {
ModuleEditor moduleEditor = ((ModuleConfigurable)node.getConfigurable()).getModuleEditor();
ModuleConfigurationEditor editor = moduleEditor.getEditor(ClasspathEditor.NAME);
if (editor instanceof ClasspathEditor) {
((ClasspathEditor)editor).selectOrderEntry(orderEntry);
}
}
}
};
}
final ActionCallback result = ProjectStructureConfigurable.getInstance(myProject).navigateTo(p, true);
return r != null ? result.doWhenDone(r) : result;
}
示例4: getHelpTopic
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
@Override
@Nullable
@NonNls
public String getHelpTopic() {
ModuleEditor editor = getModuleEditor();
return editor == null ? null : editor.getHelpTopic();
}
示例5: queryPlace
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
@Override
public void queryPlace(@NotNull final Place place) {
final ModuleEditor editor = getModuleEditor();
if (editor != null) {
editor.queryPlace(place);
}
}
示例6: updateModuleEditorSelection
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
private void updateModuleEditorSelection(final NamedConfigurable configurable) {
if (configurable instanceof ModuleConfigurable){
final ModuleConfigurable moduleConfigurable = (ModuleConfigurable)configurable;
final ModuleEditor editor = moduleConfigurable.getModuleEditor();
if (editor != null) { //already deleted
editor.init(myHistory);
}
}
if (configurable instanceof FacetConfigurable) {
((FacetConfigurable)configurable).getEditor().onFacetSelected();
}
}
示例7: selectOrderEntry
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
public ActionCallback selectOrderEntry(@NotNull final Module module, @Nullable final OrderEntry orderEntry) {
for (final ModuleStructureExtension extension : ModuleStructureExtension.EP_NAME.getExtensions()) {
final ActionCallback callback = extension.selectOrderEntry(module, orderEntry);
if (callback != null) {
return callback;
}
}
Place p = new Place();
p.putPath(ProjectStructureConfigurable.CATEGORY, this);
Runnable r = null;
final MasterDetailsComponent.MyNode node = findModuleNode(module);
if (node != null) {
p.putPath(TREE_OBJECT, module);
p.putPath(ModuleEditor.SELECTED_EDITOR_NAME, ClasspathEditor.NAME);
r = new Runnable() {
@Override
public void run() {
if (orderEntry != null) {
ModuleEditor moduleEditor = ((ModuleConfigurable)node.getConfigurable()).getModuleEditor();
ModuleConfigurationEditor editor = moduleEditor.getEditor(ClasspathEditor.NAME);
if (editor instanceof ClasspathEditor) {
((ClasspathEditor)editor).selectOrderEntry(orderEntry);
}
}
}
};
}
final ActionCallback result = ProjectStructureConfigurable.getInstance(myProject).navigateTo(p, true);
return r != null ? result.doWhenDone(r) : result;
}
示例8: removeLibraryOrderEntry
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的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();
}
示例9: getUsagesInElement
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
@Override
public List<ProjectStructureElementUsage> getUsagesInElement() {
final List<ProjectStructureElementUsage> usages = new ArrayList<ProjectStructureElementUsage>();
final ModuleEditor moduleEditor = myContext.getModulesConfigurator().getModuleEditor(myModule);
if (moduleEditor != null) {
for (OrderEntry entry : moduleEditor.getOrderEntries()) {
if (entry instanceof ModuleOrderEntry) {
ModuleOrderEntry moduleOrderEntry = (ModuleOrderEntry)entry;
final Module module = moduleOrderEntry.getModule();
if (module != null) {
usages.add(new UsageInModuleClasspath(myContext, this, new ModuleProjectStructureElement(myContext, module), moduleOrderEntry.getScope()));
}
}
else if (entry instanceof LibraryOrderEntry) {
LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)entry;
final Library library = libraryOrderEntry.getLibrary();
if (library != null) {
usages.add(new UsageInModuleClasspath(myContext, this, new LibraryProjectStructureElement(myContext, library),
libraryOrderEntry.getScope()));
}
}
else if (entry instanceof JdkOrderEntry) {
final Sdk jdk = ((JdkOrderEntry)entry).getJdk();
if (jdk != null) {
usages.add(new UsageInModuleClasspath(myContext, this, new SdkProjectStructureElement(myContext, jdk), null));
}
}
}
}
return usages;
}
示例10: replaceElement
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
@Override
public void replaceElement(final ProjectStructureElement newElement) {
final ModuleEditor editor = myContext.getModulesConfigurator().getModuleEditor(myModule);
if (editor != null) {
final ModifiableRootModel rootModel = editor.getModifiableRootModelProxy();
OrderEntryUtil.replaceLibrary(rootModel, ((LibraryProjectStructureElement)mySourceElement).getLibrary(),
((LibraryProjectStructureElement)newElement).getLibrary());
myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, myModule));
}
}
示例11: getSourceOrThis
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
@NotNull
private Library getSourceOrThis() {
final InvocationHandler invocationHandler = Proxy.isProxyClass(myLibrary.getClass()) ? Proxy.getInvocationHandler(myLibrary) : null;
final Library realLibrary = invocationHandler instanceof ModuleEditor.ProxyDelegateAccessor ?
(Library)((ModuleEditor.ProxyDelegateAccessor)invocationHandler).getDelegate() : myLibrary;
final Library source = realLibrary instanceof LibraryImpl? ((LibraryImpl)realLibrary).getSource() : null;
return source != null ? source : myLibrary;
}
示例12: getModuleModifiableModel
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
@Override
@Nullable
public ModifiableRootModel getModuleModifiableModel(final Module module) {
final Project project = module.getProject();
final ModulesConfigurator configurator = getModulesConfigurator(project);
if (configurator != null) {
if (!configurator.isModuleModelCommitted()) {
final ModuleEditor moduleEditor = configurator.getModuleEditor(module);
if (moduleEditor != null) {
return moduleEditor.getModifiableRootModelProxy();
}
}
}
return ModuleRootManager.getInstance(module).getModifiableModel();
}
示例13: createContext
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
protected FacetEditorContext createContext(final @NotNull Facet facet, final @Nullable FacetEditorContext parentContext) {
Module module = facet.getModule();
ModulesConfigurator modulesConfigurator = myContext.getModulesConfigurator();
ModuleEditor moduleEditor = modulesConfigurator.getModuleEditor(module);
if (moduleEditor == null) {
LOG.error("ModuleEditor[" + module.getName() + "]==null: disposed = " + module.isDisposed() + ", is in model = "
+ Arrays.asList(modulesConfigurator.getModules()).contains(module));
}
final ModuleConfigurationState state = moduleEditor.createModuleConfigurationState();
return new MyProjectConfigurableContext(facet, parentContext, state);
}
示例14: getHelpTopic
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
@Override
@Nullable
@NonNls
public String getHelpTopic() {
final ModuleEditor moduleEditor = getModuleEditor();
return moduleEditor != null ? moduleEditor.getHelpTopic() : null;
}
示例15: queryPlace
import com.intellij.openapi.roots.ui.configuration.ModuleEditor; //导入依赖的package包/类
@Override
public void queryPlace(@Nonnull final Place place) {
final ModuleEditor editor = getModuleEditor();
if (editor != null) {
editor.queryPlace(place);
}
}