use of com.intellij.openapi.module.JavaModuleType in project android by JetBrains.
the class AndroidGradleProjectComponent method checkForSupportedModules.
/**
* Verifies that the project, if it is an Android Gradle project, does not have any modules that are not known by Gradle. For example,
* when adding a plain IDEA Java module.
* Do not call this method from {@link ModuleListener#moduleAdded(Project, Module)} because the settings that this method look for are
* not present when importing a valid Gradle-aware module, resulting in false positives.
*/
public void checkForSupportedModules() {
Module[] modules = ModuleManager.getInstance(myProject).getModules();
if (modules.length == 0 || !isBuildWithGradle(myProject)) {
return;
}
List<Module> unsupportedModules = new ArrayList<>();
for (Module module : modules) {
ModuleType moduleType = ModuleType.get(module);
if (moduleType instanceof JavaModuleType) {
if (!GRADLE_SYSTEM_ID.getId().equals(ExternalSystemModulePropertyManager.getInstance(module).getExternalSystemId())) {
unsupportedModules.add(module);
}
}
}
if (unsupportedModules.size() == 0) {
return;
}
String s = join(unsupportedModules, Module::getName, ", ");
AndroidGradleNotification.getInstance(myProject).showBalloon("Unsupported Modules Detected", "Compilation is not supported for following modules: " + s + ". Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.", NotificationType.ERROR);
}
use of com.intellij.openapi.module.JavaModuleType in project intellij-plugins by JetBrains.
the class GrCucumberExtension method collectAllStepDefsProviders.
@Override
protected void collectAllStepDefsProviders(@NotNull List<VirtualFile> providers, @NotNull Project project) {
final Module[] modules = ModuleManager.getInstance(project).getModules();
for (Module module : modules) {
if (ModuleType.get(module) instanceof JavaModuleType) {
final VirtualFile[] roots = ModuleRootManager.getInstance(module).getContentRoots();
ContainerUtil.addAll(providers, roots);
}
}
}
use of com.intellij.openapi.module.JavaModuleType in project intellij-community by JetBrains.
the class DefaultModuleEditorsProvider method createEditors.
@Override
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) {
ModifiableRootModel rootModel = state.getRootModel();
Module module = rootModel.getModule();
if (!(ModuleType.get(module) instanceof JavaModuleType)) {
return ModuleConfigurationEditor.EMPTY;
}
String moduleName = module.getName();
List<ModuleConfigurationEditor> editors = new ArrayList<>();
editors.add(new ContentEntriesEditor(moduleName, state));
editors.add(new OutputEditor(state));
editors.add(new ClasspathEditor(state));
return editors.toArray(new ModuleConfigurationEditor[editors.size()]);
}
use of com.intellij.openapi.module.JavaModuleType in project intellij-community by JetBrains.
the class DotProjectFileHelper method saveDotProjectFile.
public static void saveDotProjectFile(@NotNull Module module, @NotNull String storageRoot) throws IOException {
try {
Document doc;
if (ModuleType.get(module) instanceof JavaModuleType) {
doc = JDOMUtil.loadDocument(DotProjectFileHelper.class.getResource("template.project.xml"));
} else {
doc = JDOMUtil.loadDocument(DotProjectFileHelper.class.getResource("template.empty.project.xml"));
}
doc.getRootElement().getChild(EclipseXml.NAME_TAG).setText(module.getName());
final File projectFile = new File(storageRoot, EclipseXml.PROJECT_FILE);
if (!FileUtil.createIfDoesntExist(projectFile)) {
return;
}
EclipseJDOMUtil.output(doc.getRootElement(), projectFile, module.getProject());
ApplicationManager.getApplication().runWriteAction(() -> {
LocalFileSystem.getInstance().refreshAndFindFileByPath(FileUtil.toSystemIndependentName(projectFile.getPath()));
});
} catch (JDOMException e) {
LOG.error(e);
}
}
Aggregations