Java Code Examples for com.intellij.openapi.module.Module#getProject()
The following examples show how to use
com.intellij.openapi.module.Module#getProject() .
These examples are extracted from open source projects.
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 Project: intellij-quarkus File: GradleToolDelegate.java License: Eclipse Public License 2.0 | 6 votes |
@Override public void processImport(Module module) { Project project = module.getProject(); File gradleFile = null; for(VirtualFile virtualFile : ModuleRootManager.getInstance(module).getContentRoots()) { File baseDir = VfsUtilCore.virtualToIoFile(virtualFile); File file = new File(baseDir, "build.gradle"); if (file.exists()) { gradleFile = file; break; } } if (gradleFile != null) { ProjectImportProvider gradleProjectImportProvider = getGradleProjectImportProvider(); ProjectImportBuilder gradleProjectImportBuilder = gradleProjectImportProvider.getBuilder(); AddModuleWizard wizard = new AddModuleWizard(project, gradleFile.getPath(), new ProjectImportProvider[]{gradleProjectImportProvider}); if (wizard.getStepCount() == 0 || wizard.showAndGet()) { gradleProjectImportBuilder.commit(project, (ModifiableModuleModel)null, (ModulesProvider)null); } } }
Example 2
Source Project: intellij-quarkus File: MavenToolDelegate.java License: Eclipse Public License 2.0 | 6 votes |
@Override public void processImport(Module module) { Project project = module.getProject(); VirtualFile pomFile = null; VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots(); for(VirtualFile contentRoot : contentRoots) { VirtualFile child = contentRoot.findChild("pom.xml"); if (child != null) { pomFile = child; break; } } if (pomFile != null) { MavenProjectsManager mavenProjectsManager = MavenProjectsManager.getInstance(project); mavenProjectsManager.addManagedFiles(Collections.singletonList(pomFile)); } }
Example 3
Source Project: intellij-spring-assistant File: GradleModuleBuilderPostProcessor.java License: MIT License | 6 votes |
@Override public boolean postProcess(Module module) { // TODO: Find a way to use GradleModuleBuilder instead of GradleProjectImportBuilder when adding a child module to the parent Project project = module.getProject(); VirtualFile gradleFile = findFileUnderRootInModule(module, "build.gradle"); if (gradleFile == null) { // not a gradle project return true; } else { ProjectDataManager projectDataManager = getService(ProjectDataManager.class); GradleProjectImportBuilder importBuilder = new GradleProjectImportBuilder(projectDataManager); GradleProjectImportProvider importProvider = new GradleProjectImportProvider(importBuilder); AddModuleWizard addModuleWizard = new AddModuleWizard(project, gradleFile.getPath(), importProvider); if (addModuleWizard.getStepCount() > 0 && !addModuleWizard .showAndGet()) { // user has cancelled import project prompt return true; } else { // user chose to import via the gradle import prompt importBuilder.commit(project, null, null); return false; } } }
Example 4
Source Project: intellij File: BlazeCreateResourceFileDialog.java License: Apache License 2.0 | 6 votes |
private void updateRootElementTextField() { final CreateTypedResourceFileAction action = getSelectedAction(myResourceTypeCombo); if (action != null) { final Module module = myFacet.getModule(); final List<String> allowedTagNames = action.getSortedAllowedTagNames(myFacet); myRootElementField = new TextFieldWithAutoCompletion<>( module.getProject(), new StringsCompletionProvider(allowedTagNames, null), true, null); myRootElementField.setEnabled(allowedTagNames.size() > 1); myRootElementField.setText(action.isChooseTagName() ? "" : action.getDefaultRootTag(module)); myRootElementFieldWrapper.removeAll(); myRootElementFieldWrapper.add(myRootElementField, BorderLayout.CENTER); myRootElementLabel.setLabelFor(myRootElementField); } }
Example 5
Source Project: intellij-spring-assistant File: MavenModuleBuilderPostProcessor.java License: MIT License | 5 votes |
@Override public boolean postProcess(Module module) { // TODO: Find a way to use GradleModuleBuilder instead of GradleProjectImportBuilder when adding a child module to the parent Project project = module.getProject(); VirtualFile pomFile = findFileUnderRootInModule(module, "pom.xml"); if (pomFile == null) { // not a maven project return true; } else { MavenProjectsManager mavenProjectsManager = getInstance(project); mavenProjectsManager.addManagedFiles(singletonList(pomFile)); return false; } }
Example 6
Source Project: intellij File: BlazeModuleSystem.java License: Apache License 2.0 | 5 votes |
BlazeModuleSystem(Module module) { this.module = module; this.project = module.getProject(); classFileFinder = BlazeClassFileFinderFactory.createBlazeClassFileFinder(module); sampleDataDirectoryProvider = new BlazeSampleDataDirectoryProvider(module); isWorkspaceModule = BlazeDataStorage.WORKSPACE_MODULE_NAME.equals(module.getName()); }
Example 7
Source Project: intellij File: BlazeAndroidRunConfigurationValidationUtil.java License: Apache License 2.0 | 5 votes |
public static List<ValidationError> validateModule(@Nullable Module module) { List<ValidationError> errors = Lists.newArrayList(); if (module == null) { errors.add( ValidationError.fatal( "No run configuration module found. Have you successfully synced your project?")); return errors; } final Project project = module.getProject(); if (AndroidProjectInfo.getInstance(project).requiredAndroidModelMissing()) { errors.add(ValidationError.fatal(SYNC_FAILED_ERR_MSG)); } return errors; }
Example 8
Source Project: consulo File: AnalyzeDependenciesDialog.java License: Apache License 2.0 | 5 votes |
/** * The constructor * * @param module the dialog that allows analyzing dependencies */ protected AnalyzeDependenciesDialog(Module module) { super(module.getProject(), true); setTitle("Analyze Dependencies for " + module.getName()); setModal(false); myComponent = new AnalyzeDependenciesComponent(module); Disposer.register(myDisposable, new Disposable() { @Override public void dispose() { myComponent.disposeUIResources(); } }); setOKButtonText("Close"); init(); }
Example 9
Source Project: railways File: RailwaysSettingsDialog.java License: MIT License | 5 votes |
protected RailwaysSettingsDialog(@NotNull Module module) { super(module.getProject()); setTitle("Configure Railways - module '" + module.getName() + "'"); // Create panel and reset components myPanel = new RailwaysSettingsForm(module); myPanel.reset(); // Important to call inherited init() method. init(); }
Example 10
Source Project: intellij-haxe File: HaxeCompiler.java License: Apache License 2.0 | 5 votes |
public static HaxeCommonCompilerUtil.CompilationContext createDummyCompilationContext(final Module module) { DummyCompileContext context = new DummyCompileContext() { @Override public Project getProject() { return module.getProject(); } }; return createCompilationContext(context, module, null); }
Example 11
Source Project: consulo File: SourceScope.java License: Apache License 2.0 | 5 votes |
public ModuleWithDependenciesAndLibsDependencies(final Module module) { super(module.getProject()); myMainScope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module); final Map<Module, Collection<Module>> map = buildAllDependencies(module.getProject()); if (map == null) return; final Collection<Module> modules = map.get(module); for (final Module dependency : modules) { myScopes.add(GlobalSearchScope.moduleWithLibrariesScope(dependency)); } }
Example 12
Source Project: consulo File: ModuleCompileScope.java License: Apache License 2.0 | 5 votes |
public ModuleCompileScope(final Module module, boolean includeDependentModules) { myProject = module.getProject(); myScopeModules = new HashSet<Module>(); if (includeDependentModules) { buildScopeModulesSet(module); } else { myScopeModules.add(module); } myModules = ModuleManager.getInstance(myProject).getModules(); }
Example 13
Source Project: consulo File: LibrariesContainerFactory.java License: Apache License 2.0 | 4 votes |
@Nonnull public static LibrariesContainer createContainer(@Nonnull Module module) { return new LibrariesContainerImpl(module.getProject(), module, null); }
Example 14
Source Project: intellij File: PsiBasedClassFileFinder.java License: Apache License 2.0 | 4 votes |
public PsiBasedClassFileFinder(Module module) { this.module = module; project = module.getProject(); }
Example 15
Source Project: intellij File: BlazeCreateXmlResourcePanel.java License: Apache License 2.0 | 4 votes |
public BlazeCreateXmlResourcePanel( Module module, ResourceType resourceType, ResourceFolderType folderType, @Nullable String resourceName, @Nullable String resourceValue, boolean chooseName, boolean chooseValue, boolean chooseFilename, @Nullable VirtualFile defaultFile, @Nullable VirtualFile contextFile, Function<Module, IdeResourceNameValidator> nameValidatorFactory) { setupUi(); setChangeNameVisible(false); setChangeValueVisible(false); setChangeFileNameVisible(chooseFilename); myModule = module; myContextFile = contextFile; if (chooseName) { setChangeNameVisible(true); } if (!StringUtil.isEmpty(resourceName)) { myNameField.setText(resourceName); } if (chooseValue) { setChangeValueVisible(true); if (!StringUtil.isEmpty(resourceValue)) { myValueField.setText(resourceValue); } } myResourceType = resourceType; ApplicationManager.getApplication().assertReadAccessAllowed(); // Set up UI to choose the base directory if needed (use context to prune selection). myResDirLabel.setVisible(false); myResDirCombo.setVisible(false); myResDirCombo.addBrowseFolderListener( module.getProject(), FileChooserDescriptorFactory.createSingleFolderDescriptor()); setupResourceDirectoryCombo(); if (defaultFile == null) { final String defaultFileName = AndroidResourceUtilCompat.getDefaultResourceFileName(myResourceType); if (defaultFileName != null) { myFileNameCombo.getEditor().setItem(defaultFileName); } } myDirectoriesLabel.setLabelFor(myDirectoriesPanel); mySubdirPanel = new CreateXmlResourceSubdirPanel(module.getProject(), folderType, myDirectoriesPanel, this); myResourceNameValidator = nameValidatorFactory.apply(getModule()); if (defaultFile != null) { resetFromFile(defaultFile, module.getProject()); } }
Example 16
Source Project: consulo File: PackageNodeUtil.java License: Apache License 2.0 | 4 votes |
public ModuleLibrariesSearchScope(@Nonnull Module module) { super(module.getProject()); myModule = module; }
Example 17
Source Project: consulo File: LibrariesContainerFactory.java License: Apache License 2.0 | 4 votes |
@Nonnull public static LibrariesContainer createContainer(@Nonnull ModifiableRootModel rootModel) { Module module = rootModel.getModule(); return new LibrariesContainerImpl(module.getProject(), module, rootModel); }
Example 18
Source Project: consulo File: ModuleNode.java License: Apache License 2.0 | 4 votes |
public ModuleNode(Module module) { super(module.getProject()); myModule = module; }
Example 19
Source Project: consulo File: ModuleStructurePane.java License: Apache License 2.0 | 4 votes |
public ModuleStructurePane(Module module) { super(module.getProject()); myModule = module; }
Example 20
Source Project: consulo File: FileRecursiveIterator.java License: Apache License 2.0 | 4 votes |
FileRecursiveIterator(@Nonnull Module module) { this(module.getProject(), ContainerUtil.<PsiDirectory, VirtualFile>map(collectModuleDirectories(module), psiDir -> psiDir.getVirtualFile())); }