Java Code Examples for com.intellij.openapi.module.ModuleType#get()
The following examples show how to use
com.intellij.openapi.module.ModuleType#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DWCleanAction.java From intellij-demandware with MIT License | 6 votes |
public void actionPerformed(AnActionEvent e) { Project project = e.getProject(); if (project != null) { for (Module module : ModuleManager.getInstance(project).getModules()) { if (ModuleType.get(module) instanceof DWModuleType) { ModuleServiceManager.getService(module, DWServerConnection.class); ProgressManager.getInstance().run( new DWCleanTask(project, module, "Cleaning cartridges...", true, PerformInBackgroundOption.ALWAYS_BACKGROUND) ); } } } }
Example 2
Source File: GaugeModuleConfigurationProvider.java From Intellij-Plugin with Apache License 2.0 | 6 votes |
@Override public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) { final Module module = state.getRootModel().getModule(); final ModuleType moduleType = ModuleType.get(module); if (!(moduleType instanceof GaugeModuleType)) { return ModuleConfigurationEditor.EMPTY; } final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance(); List<ModuleConfigurationEditor> editors = new ArrayList<>(); editors.add(editorFactory.createModuleContentRootsEditor(state)); editors.add(editorFactory.createOutputEditor(state)); editors.add(editorFactory.createClasspathEditor(state)); return editors.toArray(new ModuleConfigurationEditor[editors.size()]); }
Example 3
Source File: DojoToolkitModuleEditorProvider.java From needsmoredojo with Apache License 2.0 | 6 votes |
@Override public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState moduleConfigurationState) { final Module module = moduleConfigurationState.getRootModel().getModule(); if (ModuleType.get(module) != DojoToolkitModuleType.getInstance()) return ModuleConfigurationEditor.EMPTY; final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance(); List<ModuleConfigurationEditor> editors = new ArrayList<ModuleConfigurationEditor>(); //editors.add(editorFactory.createModuleContentRootsEditor(moduleConfigurationState)); for(Module theModule : ModuleManager.getInstance(moduleConfigurationState.getProject()).getModules()) { ModuleType theType = ModuleType.get(theModule); int i=0; } return editors.toArray(new ModuleConfigurationEditor[editors.size()]); }
Example 4
Source File: OCamlDefaultModuleEditorsProvider.java From reasonml-idea-plugin with MIT License | 5 votes |
@NotNull @Override public ModuleConfigurationEditor[] createEditors(@NotNull ModuleConfigurationState state) { Module module = state.getRootModel().getModule(); if (ModuleType.get(module) instanceof OCamlModuleType) { return new ModuleConfigurationEditor[]{ new OCamlContentEntriesEditor(module.getName(), state) }; } return ModuleConfigurationEditor.EMPTY; }
Example 5
Source File: BlazePythonSyncPlugin.java From intellij with Apache License 2.0 | 5 votes |
private static void updatePythonFacet( Project project, BlazeContext context, BlazeProjectData blazeProjectData, Module workspaceModule, ModifiableRootModel workspaceModifiableModel) { if (!PythonFacetUtil.usePythonFacets()) { return; } if (!blazeProjectData.getWorkspaceLanguageSettings().isLanguageActive(LanguageClass.PYTHON) || blazeProjectData.getWorkspaceLanguageSettings().isWorkspaceType(WorkspaceType.PYTHON)) { removeFacet(workspaceModule); return; } if (ModuleType.get(workspaceModule) instanceof PythonModuleTypeBase) { return; } LibraryContributingFacet<?> pythonFacet = getOrCreatePythonFacet(project, context, workspaceModule, blazeProjectData); if (pythonFacet == null) { return; } Library pythonLib = getFacetLibrary(pythonFacet); if (pythonLib != null) { workspaceModifiableModel.addLibraryEntry(pythonLib); } }
Example 6
Source File: HaskellModuleConfigurationEditor.java From intellij-haskforce with Apache License 2.0 | 5 votes |
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) { Module module = state.getRootModel().getModule(); if (!(ModuleType.get(module) instanceof HaskellModuleType)) { return ModuleConfigurationEditor.EMPTY; } return new ModuleConfigurationEditor[]{ new JavaContentEntriesEditor(module.getName(), state), // new CabalFilesEditor(state), new ClasspathEditor(state), }; }
Example 7
Source File: HaxeCompiler.java From intellij-haxe with Apache License 2.0 | 5 votes |
private static List<Module> getModulesToCompile(final CompileScope scope /*, final Project project */) { final List<Module> result = new ArrayList<Module>(); for (final Module module : scope.getAffectedModules()) { if (ModuleType.get(module) != HaxeModuleType.getInstance()) continue; result.add(module); /* boolean skipBuilding = false; // default: always build //-- are any changes since last build if (changeSetMap.get(module) != null) { // was built at least once, in past ... final Set<String> latestChangeSet = new HashSet<String>(); Collection<VirtualFile> vFileCollection = FileTypeIndex .getFiles(HaxeFileType.HAXE_FILE_TYPE, module.getModuleWithDependenciesScope()); final VirtualFile[] virtualFiles = vFileCollection.toArray(new VirtualFile[0]); for (VirtualFile file : virtualFiles) { final FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(file); if (fileStatus.equals(FileStatus.NOT_CHANGED) || fileStatus.equals(FileStatus.UNKNOWN)) continue; latestChangeSet.add(file.getPath()); } skipBuilding = latestChangeSet.equals(changeSetMap.get(module)); changeSetMap.put(module, latestChangeSet); } else { changeSetMap.put(module, new HashSet<String>()); } skipBuildMap.put(module, new Boolean(skipBuilding)); if (! skipBuilding) { result.add(module); } */ } return result; }
Example 8
Source File: HaxeModuleConfigurationEditorProvider.java From intellij-haxe with Apache License 2.0 | 5 votes |
public ModuleConfigurationEditor[] createEditors(final ModuleConfigurationState state) { final Module module = state.getRootModel().getModule(); if (ModuleType.get(module) != HaxeModuleType.getInstance()) { return ModuleConfigurationEditor.EMPTY; } return new ModuleConfigurationEditor[]{ new CommonContentEntriesEditor(module.getName(), state, JavaSourceRootType.SOURCE, JavaSourceRootType.TEST_SOURCE), new ClasspathEditor(state), new HaxeModuleConfigurationEditor(state) }; }
Example 9
Source File: CppCompiler.java From CppTools with Apache License 2.0 | 5 votes |
@NotNull public ProcessingItem[] getProcessingItems(final CompileContext compileContext) { final List<ProcessingItem> processingItems = new ArrayList<ProcessingItem>(); boolean doneSave = false; Module[] affectedModules = ApplicationManager.getApplication().runReadAction(new Computable<Module[]>() { public Module[] compute() { return compileContext.getCompileScope().getAffectedModules(); } }); for(Module module: affectedModules) { Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (ModuleType.get(module) == CppModuleType.getInstance() || (sdk != null && sdk.getSdkType() == CppSdkType.getInstance())) { processingItems.add(new MyProcessingItem(module)); if (!doneSave) { BuildState.saveDocuments(); doneSave = true; } VirtualFile moduleFile = module.getModuleFile(); if (moduleFile == null) { BuildState.saveAll(); } } } return processingItems.toArray(new ProcessingItem[processingItems.size()]); }
Example 10
Source File: CppCompiler.java From CppTools with Apache License 2.0 | 5 votes |
public boolean validateConfiguration(CompileScope compileScope) { EnvironmentFacade facade = EnvironmentFacade.getInstance(); for(Module module:compileScope.getAffectedModules()) { if (ModuleType.get(module) == CppModuleType.getInstance()) { Sdk sdk = ModuleRootManager.getInstance(module).getSdk(); if (!(sdk.getSdkType() == CppSdkType.getInstance())) { Messages.showMessageDialog(module.getProject(), "C/Cpp module type is not configured", "C/C++ compiler problem", Messages.getErrorIcon()); return false; } } } return true; }
Example 11
Source File: CppModuleConfigurationEditorProvider.java From CppTools with Apache License 2.0 | 5 votes |
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) { final Module module = state.getRootModel().getModule(); if (ModuleType.get(module) != CppModuleType.getInstance()) return new ModuleConfigurationEditor[0]; ModifiableRootModel rootModel = state.getRootModel(); DefaultModuleConfigurationEditorFactory defaultModuleConfigurationEditorFactory = DefaultModuleConfigurationEditorFactory.getInstance(); return new ModuleConfigurationEditor[] { defaultModuleConfigurationEditorFactory.createModuleContentRootsEditor(state), defaultModuleConfigurationEditorFactory.createClasspathEditor(state), }; }
Example 12
Source File: DWBulkFileListener.java From intellij-demandware with MIT License | 4 votes |
@Override public void after(@NotNull List<? extends VFileEvent> events) { Project[] projects = ProjectManager.getInstance().getOpenProjects(); for (VFileEvent event : events) { VirtualFile eventFile = event.getFile(); if (eventFile != null && !eventFile.isDirectory()) { for (Project project : projects) { Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(eventFile); if (module != null) { ModuleType CurrentModuleType = ModuleType.get(module); // Bail out if auto uploads are not enabled. if (!DWSettingsProvider.getInstance(module).getAutoUploadEnabled()) { return; } if (CurrentModuleType instanceof DWModuleType) { for (VirtualFile sourceRoot : ModuleRootManager.getInstance(module).getSourceRoots()) { if (eventFile.getPath().contains(sourceRoot.getPath())) { ProgressManager.getInstance().run( new DWUpdateFileTask( project, module, "Syncing files to: " + DWSettingsProvider.getInstance(module).getHostname(), true, PerformInBackgroundOption.ALWAYS_BACKGROUND, sourceRoot.getPath(), eventFile.getPath() ) ); } } } } } } } }
Example 13
Source File: CreateClassAction.java From intellij-haxe with Apache License 2.0 | 4 votes |
@Override protected boolean isAvailable(DataContext dataContext) { final Module module = LangDataKeys.MODULE.getData(dataContext); return super.isAvailable(dataContext) && module != null && ModuleType.get(module) == HaxeModuleType.getInstance(); }
Example 14
Source File: CreateNMMLFileAction.java From intellij-haxe with Apache License 2.0 | 4 votes |
@Override protected boolean isAvailable(DataContext dataContext) { final Module module = LangDataKeys.MODULE.getData(dataContext); return super.isAvailable(dataContext) && module != null && ModuleType.get(module) == HaxeModuleType.getInstance(); }