com.intellij.openapi.roots.CompilerModuleExtension Java Examples
The following examples show how to use
com.intellij.openapi.roots.CompilerModuleExtension.
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: ModuleEditorImpl.java From intellij with Apache License 2.0 | 6 votes |
@Override public Module createModule(String moduleName, ModuleType moduleType) { Module module = moduleModel.findModuleByName(moduleName); if (module == null) { File imlFile = new File(imlDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION); removeImlFile(imlFile); module = moduleModel.newModule(imlFile.getPath(), moduleType.getId()); module.setOption(EXTERNAL_SYSTEM_ID_KEY, EXTERNAL_SYSTEM_ID_VALUE); } module.setOption(Module.ELEMENT_TYPE, moduleType.getId()); ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel(); modules.put(module.getName(), modifiableModel); modifiableModel.clear(); modifiableModel.inheritSdk(); CompilerModuleExtension compilerSettings = modifiableModel.getModuleExtension(CompilerModuleExtension.class); if (compilerSettings != null) { compilerSettings.inheritCompilerOutputPath(false); } return module; }
Example #2
Source File: HaxeConfigurationEditor.java From intellij-haxe with Apache License 2.0 | 6 votes |
public HaxeConfigurationEditor(Module module, CompilerModuleExtension extension) { myModule = module; myExtension = extension; addActionListeners(); initExtensions(); myMainClassLabel.setLabelFor(myMainClassFieldWithButton.getTextField()); myParametersLabel.setLabelFor(myAppArguments.getTextField()); myFolderLabel.setLabelFor(myFolderTextField.getTextField()); ButtonGroup group = new ButtonGroup(); group.add(myHxmlFileRadioButton); group.add(myNmmlFileRadioButton); group.add(myUserPropertiesRadioButton); group.add(myOpenFLFileRadioButton); }
Example #3
Source File: MavenImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
protected void assertModuleOutput(String moduleName, String output, String testOutput) { CompilerModuleExtension e = getCompilerExtension(moduleName); assertFalse(e.isCompilerOutputPathInherited()); assertEquals(output, getAbsolutePath(e.getCompilerOutputUrl())); assertEquals(testOutput, getAbsolutePath(e.getCompilerOutputUrlForTests())); }
Example #4
Source File: ClassesExportAction.java From patcher with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(AnActionEvent e) { try { com.intellij.openapi.actionSystem.DataContext dataContext = e.getDataContext(); PsiJavaFile javaFile = (PsiJavaFile) ((PsiFile) DataKeys.PSI_FILE.getData(dataContext)).getContainingFile(); String sourceName = javaFile.getName(); Module module = (Module) DataKeys.MODULE.getData(dataContext); String compileRoot = CompilerModuleExtension.getInstance(module).getCompilerOutputPath().getPath(); getVirtualFile(sourceName, CompilerModuleExtension.getInstance(module).getCompilerOutputPath().getChildren(), compileRoot); VirtualFileManager.getInstance().syncRefresh(); } catch (Exception ex) { ex.printStackTrace(); Messages.showErrorDialog("Please build your module or project!!!", "error"); } }
Example #5
Source File: GaugeLibHelper.java From Intellij-Plugin with Apache License 2.0 | 5 votes |
private void checkProjectSourceAndOutputDirectory(ModifiableRootModel modifiableModel) { VirtualFile[] sourceRoots = modifiableModel.getSourceRoots(); if (sourceRoots.length < 1) { ContentEntry contentEntry = modifiableModel.addContentEntry(modifiableModel.getProject().getBaseDir()); VirtualFile srcPath = srcPath(modifiableModel); if (srcPath != null) { contentEntry.addSourceFolder(srcPath, false); } CompilerModuleExtension compilerModuleExtension = modifiableModel.getModuleExtension(CompilerModuleExtension.class); compilerModuleExtension.setCompilerOutputPath(outputPath(modifiableModel.getModule())); compilerModuleExtension.setCompilerOutputPathForTests(testOutputPath(modifiableModel.getModule())); compilerModuleExtension.inheritCompilerOutputPath(false); compilerModuleExtension.commit(); } }
Example #6
Source File: HaxeModuleBuilder.java From intellij-haxe with Apache License 2.0 | 5 votes |
@Override public void moduleCreated(@NotNull Module module) { final CompilerModuleExtension model = (CompilerModuleExtension)CompilerModuleExtension.getInstance(module).getModifiableModel(true); model.setCompilerOutputPath(model.getCompilerOutputUrl()); model.inheritCompilerOutputPath(false); createHelloWorldIfEligible(module); model.commit(); }
Example #7
Source File: MavenImportingTestCase.java From intellij-quarkus with Eclipse Public License 2.0 | 4 votes |
protected CompilerModuleExtension getCompilerExtension(String module) { ModuleRootManager m = getRootManager(module); return CompilerModuleExtension.getInstance(m.getModule()); }
Example #8
Source File: ProjectFromSourcesBuilderImplModified.java From tmc-intellij with MIT License | 4 votes |
private static void setupRootModel( ProjectDescriptor projectDescriptor, final ModuleDescriptor descriptor, final ModifiableRootModel rootModel, final Map<LibraryDescriptor, Library> projectLibs) { final CompilerModuleExtension compilerModuleExtension = rootModel.getModuleExtension(CompilerModuleExtension.class); compilerModuleExtension.setExcludeOutput(true); rootModel.inheritSdk(); //Module root model seems to store .iml files root dependencies. (src, test, lib) logger.info("Starting setupRootModel in ProjectFromSourcesBuilderImplModified"); final Set<File> contentRoots = descriptor.getContentRoots(); for (File contentRoot : contentRoots) { final LocalFileSystem lfs = LocalFileSystem.getInstance(); VirtualFile moduleContentRoot = lfs.refreshAndFindFileByPath( FileUtil.toSystemIndependentName(contentRoot.getPath())); if (moduleContentRoot != null) { final ContentEntry contentEntry = rootModel.addContentEntry(moduleContentRoot); final Collection<DetectedSourceRoot> sourceRoots = descriptor.getSourceRoots(contentRoot); for (DetectedSourceRoot srcRoot : sourceRoots) { final String srcpath = FileUtil.toSystemIndependentName(srcRoot.getDirectory().getPath()); final VirtualFile sourceRoot = lfs.refreshAndFindFileByPath(srcpath); if (sourceRoot != null) { contentEntry.addSourceFolder( sourceRoot, shouldBeTestRoot(srcRoot.getDirectory()), getPackagePrefix(srcRoot)); } } } } logger.info("Inherits compiler output path from project"); compilerModuleExtension.inheritCompilerOutputPath(true); logger.info("Starting to create module level libraries"); final LibraryTable moduleLibraryTable = rootModel.getModuleLibraryTable(); for (LibraryDescriptor libDescriptor : ModuleInsight.getLibraryDependencies( descriptor, projectDescriptor.getLibraries())) { final Library projectLib = projectLibs.get(libDescriptor); if (projectLib != null) { rootModel.addLibraryEntry(projectLib); } else { // add as module library final Collection<File> jars = libDescriptor.getJars(); for (File file : jars) { Library library = moduleLibraryTable.createLibrary(); Library.ModifiableModel modifiableModel = library.getModifiableModel(); modifiableModel.addRoot( VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES); modifiableModel.commit(); } } } logger.info("Ending setupRootModel in ProjectFromSourcesBuilderImplModified"); }
Example #9
Source File: HaxeModuleConfigurationEditor.java From intellij-haxe with Apache License 2.0 | 4 votes |
public HaxeModuleConfigurationEditor(ModuleConfigurationState state) { haxeConfigurationEditor = new HaxeConfigurationEditor(state.getRootModel().getModule(), state.getRootModel().getModuleExtension( CompilerModuleExtension.class)); }