use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class GrSelectModuleAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
if (project == null)
return;
GroovyConsoleUtil.selectModuleAndRun(project, module -> {
final Module existingModule = myProjectConsole.getSelectedModule(myFile);
if (module.equals(existingModule))
return;
final GroovyConsole existingConsole = myFile.getUserData(GroovyConsole.GROOVY_CONSOLE);
if (existingConsole != null)
existingConsole.stop();
myProjectConsole.setFileModule(myFile, module);
myFile.putUserData(GroovyConsole.GROOVY_CONSOLE, null);
ProjectView.getInstance(project).refresh();
}, e.getDataContext());
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class GrSelectModuleAction method update.
@Override
public void update(AnActionEvent e) {
if (myProjectConsole.isProjectConsole(myFile)) {
final Module module = myProjectConsole.getSelectedModule(myFile);
e.getPresentation().setText(getText(module));
} else {
e.getPresentation().setVisible(false);
}
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class MavenProjectImporter method formatModules.
private static String formatModules(final Collection<Module> modules) {
StringBuilder res = new StringBuilder();
int i = 0;
for (Module module : modules) {
res.append('\'').append(module.getName()).append("'\n");
if (++i > 20)
break;
}
if (i > 20) {
res.append("\n ... and other ").append(modules.size() - 20).append(" modules");
}
return res.toString();
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class MavenRootModelAdapter method addModuleDependency.
public void addModuleDependency(@NotNull String moduleName, @NotNull DependencyScope scope, boolean testJar) {
Module m = findModuleByName(moduleName);
ModuleOrderEntry e;
if (m != null) {
e = myRootModel.addModuleOrderEntry(m);
} else {
AccessToken accessToken = ReadAction.start();
try {
e = myRootModel.addInvalidModuleEntry(moduleName);
} finally {
accessToken.finish();
}
}
e.setScope(scope);
if (testJar) {
((ModuleOrderEntryImpl) e).setProductionOnTestDependency(true);
}
if (myOrderEntriesBeforeJdk.contains(moduleName)) {
moveLastOrderEntryBeforeJdk();
}
}
use of com.intellij.openapi.module.Module in project intellij-community by JetBrains.
the class MavenProjectImporter method ensureModuleCreated.
private boolean ensureModuleCreated(MavenProject project) {
if (myMavenProjectToModule.get(project) != null)
return false;
final String path = myMavenProjectToModulePath.get(project);
// for some reason newModule opens the existing iml file, so we
// have to remove it beforehand.
deleteExistingImlFile(path);
final Module module = myModuleModel.newModule(path, project.getModuleType().getId());
myMavenProjectToModule.put(project, module);
myCreatedModules.add(module);
return true;
}
Aggregations