本文整理汇总了Java中com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog类的典型用法代码示例。如果您正苦于以下问题:Java ChooseModulesDialog类的具体用法?Java ChooseModulesDialog怎么用?Java ChooseModulesDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChooseModulesDialog类属于com.intellij.openapi.roots.ui.configuration包,在下文中一共展示了ChooseModulesDialog类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showDialogAndAddLibraryToDependencies
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
public static void showDialogAndAddLibraryToDependencies(final Library library, final Project project, boolean allowEmptySelection) {
for (ProjectStructureValidator validator : EP_NAME.getExtensions()) {
if (validator.addLibraryToDependencies(library, project, allowEmptySelection)) {
return;
}
}
final ModuleStructureConfigurable moduleStructureConfigurable = ModuleStructureConfigurable.getInstance(project);
final List<Module> modules =
LibraryEditingUtil.getSuitableModules(moduleStructureConfigurable, ((LibraryEx)library).getKind(), library);
if (modules.isEmpty()) return;
final ChooseModulesDialog
dlg = new ChooseModulesDialog(moduleStructureConfigurable.getProject(), modules, ProjectBundle.message("choose.modules.dialog.title"),
ProjectBundle
.message("choose.modules.dialog.description", library.getName()));
if (dlg.showAndGet()) {
final List<Module> chosenModules = dlg.getChosenElements();
for (Module module : chosenModules) {
moduleStructureConfigurable.addLibraryOrderEntry(module, library);
}
}
}
示例2: actionPerformed
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
if (project == null) return;
List<Module> pluginModules = new ArrayList<Module>();
for (Module aModule : ModuleManager.getInstance(project).getModules()) {
if (PluginModuleType.isOfType(aModule)) {
pluginModules.add(aModule);
}
}
ChooseModulesDialog dialog = new ChooseModulesDialog(project,
pluginModules,
DevKitBundle.message("select.plugin.modules.title"),
DevKitBundle.message("select.plugin.modules.description"));
if (dialog.showAndGet()) {
doPrepare(dialog.getChosenElements(), project);
}
}
示例3: showDialogAndAddLibraryToDependencies
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
public static void showDialogAndAddLibraryToDependencies(final Library library, final Project project, boolean allowEmptySelection) {
for (ProjectStructureValidator validator : EP_NAME.getExtensions()) {
if (validator.addLibraryToDependencies(library, project, allowEmptySelection)) {
return;
}
}
final ModuleStructureConfigurable moduleStructureConfigurable = ModuleStructureConfigurable.getInstance(project);
final List<Module> modules = LibraryEditingUtil.getSuitableModules(moduleStructureConfigurable, ((LibraryEx)library).getKind(), library);
if (modules.isEmpty()) return;
final ChooseModulesDialog
dlg = new ChooseModulesDialog(moduleStructureConfigurable.getProject(), modules, ProjectBundle.message("choose.modules.dialog.title"),
ProjectBundle
.message("choose.modules.dialog.description", library.getName()));
dlg.show();
if (dlg.isOK()) {
final List<Module> chosenModules = dlg.getChosenElements();
for (Module module : chosenModules) {
moduleStructureConfigurable.addLibraryOrderEntry(module, library);
}
}
}
示例4: createArtifact
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
@Nullable
@Override
@RequiredReadAction
public NewArtifactConfiguration createArtifact()
{
List<Module> modules = new ArrayList<>();
for(Module module : myContext.getModulesProvider().getModules())
{
if(ModuleUtilCore.getExtension(module, JavaWebModuleExtension.class) != null)
{
modules.add(module);
}
}
ChooseModulesDialog dialog = new ChooseModulesDialog(myContext.getProject(), modules, "Choose Module", "Choose Module For Artifact Creation");
dialog.setSingleSelectionMode();
List<Module> selectedModules = dialog.showAndGetResult();
if(selectedModules.size() != 1)
{
return null;
}
return doCreateArtifactTemplate(modules.get(0), myContext);
}
示例5: showDialogForFacets
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
public static AndroidFacet showDialogForFacets(Project project, List<AndroidFacet> facets) {
List<Module> modules = Lists.newArrayList();
String previousModuleName = getPreviousModuleName(project);
List<Module> previousSelectedModule = null;
for (AndroidFacet facet : facets) {
Module module = facet.getModule();
modules.add(module);
if (module.getName().equals(previousModuleName)) {
previousSelectedModule = Lists.newArrayList(module);
}
}
ChooseModulesDialog dialog = new ChooseModulesDialog(project, modules, "Choose Module", "");
dialog.setSingleSelectionMode();
if (previousSelectedModule != null) {
dialog.selectElements(previousSelectedModule);
}
dialog.show();
List<Module> chosenElements = dialog.getChosenElements();
if (chosenElements.isEmpty()) {
return null;
}
Module chosenModule = chosenElements.get(0);
saveModuleName(project, chosenModule.getName());
int chosenModuleIndex = modules.indexOf(chosenModule);
return facets.get(chosenModuleIndex);
}
示例6: chooseElements
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
@Override
@NotNull
public List<Module> chooseElements() {
ChooseModulesDialog dialog = new ChooseModulesDialog(myClasspathPanel.getComponent(), myItems, myTitle, myDescription);
dialog.show();
return dialog.getChosenElements();
}
示例7: addRow
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
@Override
public void addRow() {
final Set<Module> projectModules = new HashSet<Module>(Arrays.asList(ModuleManager.getInstance(myProject).getModules()));
projectModules.removeAll(getAllModules());
final ChooseModulesDialog chooser =
new ChooseModulesDialog(ProcessedModulesTable.this, new ArrayList<Module>(projectModules), "ChooseModule");
if (chooser.showAndGet()) {
final List<Module> chosen = chooser.getChosenElements();
for (Module module : chosen) {
addElement(module, null);
}
}
}
示例8: createArtifact
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
@Override
public NewArtifactConfiguration createArtifact() {
Module module = null;
if (myModules.size() == 1) {
module = myModules.get(0);
} else {
final ChooseModulesDialog dialog = new ChooseModulesDialog(myModules.get(0).getProject(), myModules,
"Select Module",
"Selected module output would to be included in the artifact");
dialog.setSingleSelectionMode();
if (dialog.showAndGet()) {
final List<Module> elements = dialog.getChosenElements();
if (elements.isEmpty()) {
return null;
}
module = elements.get(0);
}
}
if (module == null) return null;
final CompositePackagingElement<?> rootElement = JavaFxApplicationArtifactType.this.createRootElement(module.getName());
final CompositePackagingElement<?>
subElement = PackagingElementFactory.getInstance().createArchive(FileUtil.sanitizeFileName(module.getName()) + ".jar");
final PackagingElement<?> moduleOutputElement = PackagingElementFactory.getInstance().createModuleOutput(module);
subElement.addFirstChild(moduleOutputElement);
rootElement.addFirstChild(subElement);
return new NewArtifactConfiguration(rootElement, module.getName(), JavaFxApplicationArtifactType.this);
}
示例9: addRow
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
@Override
public void addRow() {
final Set<Module> projectModules = new HashSet<Module>(Arrays.asList(ModuleManager.getInstance(myProject).getModules()));
projectModules.removeAll(getAllModules());
final ChooseModulesDialog chooser = new ChooseModulesDialog(ProcessedModulesTable.this, new ArrayList<Module>(projectModules), "ChooseModule");
chooser.show();
if (chooser.isOK()) {
final List<Module> chosen = chooser.getChosenElements();
for (Module module : chosen) {
addElement(module, null);
}
}
}
示例10: createArtifact
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
@Override
public NewArtifactConfiguration createArtifact() {
Module module = null;
if (myModules.size() == 1) {
module = myModules.get(0);
} else {
final ChooseModulesDialog dialog = new ChooseModulesDialog(myModules.get(0).getProject(), myModules,
"Select Module",
"Selected module output would to be included in the artifact");
dialog.setSingleSelectionMode();
dialog.show();
if (dialog.isOK()) {
final List<Module> elements = dialog.getChosenElements();
if (elements.isEmpty()) {
return null;
}
module = elements.get(0);
}
}
if (module == null) return null;
final CompositePackagingElement<?> rootElement = JavaFxApplicationArtifactType.this.createRootElement(module.getName());
final CompositePackagingElement<?>
subElement = PackagingElementFactory.getInstance().createArchive(FileUtil.sanitizeFileName(module.getName()) + ".jar");
final PackagingElement<?> moduleOutputElement = PackagingElementFactory.getInstance().createModuleOutput(module);
subElement.addFirstChild(moduleOutputElement);
rootElement.addFirstChild(subElement);
return new NewArtifactConfiguration(rootElement, module.getName(), JavaFxApplicationArtifactType.this);
}
示例11: createArtifact
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
@Override
public NewArtifactConfiguration createArtifact()
{
Module module = null;
if(myModules.size() == 1)
{
module = myModules.get(0);
}
else
{
final ChooseModulesDialog dialog = new ChooseModulesDialog(myModules.get(0).getProject(), myModules, "Select Module", "Selected module output would to be included in the artifact");
dialog.setSingleSelectionMode();
dialog.show();
if(dialog.isOK())
{
final List<Module> elements = dialog.getChosenElements();
if(elements.isEmpty())
{
return null;
}
module = elements.get(0);
}
}
if(module == null)
{
return null;
}
final CompositePackagingElement<?> rootElement = JavaFxApplicationArtifactType.this.createRootElement(module.getName());
final CompositePackagingElement<?> subElement = JarArtifactType.getInstance().createRootElement(FileUtil.sanitizeFileName(module.getName()));
final PackagingElement<?> moduleOutputElement = ProductionModuleOutputElementType.getInstance().createElement(module.getProject(), ModuleUtil.createPointer(module));
subElement.addFirstChild(moduleOutputElement);
rootElement.addFirstChild(subElement);
return new NewArtifactConfiguration(rootElement, module.getName(), JavaFxApplicationArtifactType.this);
}
示例12: chooseModules
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
@Override
public List<Module> chooseModules(final List<Module> modules, final String title) {
return new ChooseModulesDialog(getProject(), modules, title, null).showAndGetResult();
}
示例13: actionPerformed
import com.intellij.openapi.roots.ui.configuration.ChooseModulesDialog; //导入依赖的package包/类
/**
* Opens Choose Module dialog for user to select a module, then opens the appropriate App Engine
* Framework Support dialog to add App Engine support.
*/
@Override
public void actionPerformed(AnActionEvent event) {
Project project = event.getProject();
if (project == null) {
return;
}
List<Module> suitableModules = getModulesWithoutAppEngineSupport(project);
String frameworkNameInTitle = getTemplatePresentation().getText();
if (suitableModules.isEmpty()) {
Messages.showErrorDialog(
project,
GctBundle.message("appengine.add.framework.support.no.modules.message", FRAMEWORK_NAME),
GctBundle.message(
"appengine.add.framework.support.no.modules.title", frameworkNameInTitle));
return;
}
ChooseModulesDialog chooseModulesDialog =
new ChooseModulesDialog(
project,
suitableModules,
GctBundle.message("appengine.add.framework.support.choose.module.dialog.title"),
GctBundle.message(
"appengine.add.framework.support.choose.module.dialog.description",
FRAMEWORK_NAME));
chooseModulesDialog.setSingleSelectionMode();
chooseModulesDialog.setOKActionEnabled(false);
if (chooseModulesDialog.getPreferredFocusedComponent() instanceof JTable) {
JTable chooseModuleTable = (JTable) chooseModulesDialog.getPreferredFocusedComponent();
ListSelectionModel selectionModel = chooseModuleTable.getSelectionModel();
if (selectionModel != null) {
selectionModel.addListSelectionListener(
e -> chooseModulesDialog.setOKActionEnabled(chooseModuleTable.getSelectedRow() != -1));
}
}
chooseModulesDialog.show();
final List<Module> elements = chooseModulesDialog.getChosenElements();
if (!chooseModulesDialog.isOK() || elements.size() != 1) {
return;
}
Module module = elements.get(0);
AddAppEngineFrameworkSupportDialog frameworkSupportDialog =
new AddAppEngineFrameworkSupportDialog(
GctBundle.message("appengine.add.framework.support.dialog.title", frameworkNameInTitle),
project,
module,
getModuleConfigurable(module));
frameworkSupportDialog.show();
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:61,代码来源:AddAppEngineFrameworkSupportAction.java