com.intellij.openapi.module.Module Java Examples

The following examples show how to use com.intellij.openapi.module.Module. 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: AddReplAction.java    From BashSupport with Apache License 2.0 6 votes vote down vote up
public void actionPerformed(AnActionEvent e) {
    Module module = getModule(e);

    if (module != null) {
        try {
            Project project = module.getProject();
            VirtualFile baseDir = project.getBaseDir();

            if (baseDir != null) {
                consoleRunner = new BashConsoleRunner(project, baseDir.getPath());
                consoleRunner.initAndRun();
            }
        } catch (com.intellij.execution.ExecutionException ex) {
            log.warn("Error running bash repl", ex);
        }
    }
}
 
Example #2
Source File: CompileContextImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isGenerated(VirtualFile file) {
  if (myGeneratedSources.contains(FileBasedIndex.getFileId(file))) {
    return true;
  }
  if (isUnderRoots(myRootToModuleMap.keySet(), file)) {
    return true;
  }
  final Module module = getModuleByFile(file);
  if (module != null) {
    for (AdditionalOutputDirectoriesProvider provider : AdditionalOutputDirectoriesProvider.EP_NAME.getExtensionList()) {
      for (String path : provider.getOutputDirectories(getProject(), module)) {
        if (path != null && VfsUtilCore.isAncestor(new File(path), new File(file.getPath()), true)) {
          return true;
        }
      }
    }
  }
  return false;
}
 
Example #3
Source File: ProjectUtils.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 6 votes vote down vote up
/**
 * adds run configuration dynamically
 * @param module
 * @param mainClass
 * @param boardName
 */
public static void addProjectConfiguration(final Module module, final String mainClass, final String boardName) {
    final Runnable r = new Runnable() {
        @Override
        public void run() {
            final RunManager runManager = RunManager.getInstance(module.getProject());
            final RunnerAndConfigurationSettings settings = runManager.
                    createRunConfiguration(module.getName(), EmbeddedLinuxJVMConfigurationType.getInstance().getFactory());
            final EmbeddedLinuxJVMRunConfiguration configuration = (EmbeddedLinuxJVMRunConfiguration) settings.getConfiguration();

            configuration.setName(EmbeddedLinuxJVMBundle.message("runner.name", boardName));
            configuration.getRunnerParameters().setRunAsRoot(true);
            configuration.getRunnerParameters().setMainclass(mainClass);

            runManager.addConfiguration(settings, false);
            runManager.setSelectedConfiguration(settings);

            final Notification notification = new Notification(
                    Notifications.GROUPDISPLAY_ID,
                    EmbeddedLinuxJVMBundle.getString("pi.connection.required"), EmbeddedLinuxJVMBundle.message("pi.connection.notsetup", boardName),
                    NotificationType.INFORMATION);
            com.intellij.notification.Notifications.Bus.notify(notification);
        }
    };
    r.run();
}
 
Example #4
Source File: XQueryRunProfileState.java    From intellij-xquery with Apache License 2.0 6 votes vote down vote up
private void configureConfiguration(SimpleJavaParameters parameters, XQueryRunConfiguration configuration) {
    ProgramParametersUtil.configureConfiguration(parameters, configuration);

    Project project = configuration.getProject();
    Module module = getModule(configuration);
    ;

    String alternativeJrePath = configuration.getAlternativeJrePath();
    if (alternativeJrePath != null) {
        configuration.setAlternativeJrePath(expandPath(alternativeJrePath, null, project));
    }

    String vmParameters = configuration.getVMParameters();
    if (vmParameters != null) {
        vmParameters = expandPath(vmParameters, module, project);

        for (Map.Entry<String, String> each : parameters.getEnv().entrySet()) {
            vmParameters = StringUtil.replace(vmParameters, "$" + each.getKey() + "$", each.getValue(), false);
        }
    }

    parameters.getVMParametersList().addParametersString(vmParameters);
}
 
Example #5
Source File: SimpleCompletionExtension.java    From camel-idea-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public void addCompletions(@NotNull CompletionParameters parameters, @NotNull ProcessingContext context,
                    @NotNull CompletionResultSet resultSet, @NotNull String[] query) {
    PsiElement element = parameters.getPosition();
    Module module = ModuleUtilCore.findModuleForPsiElement(element);
    if (module == null) {
        return;
    }

    List<LookupElement> results = findResults(element, getQueryAtPosition(query));
    if (!results.isEmpty()) {
        resultSet
            .withRelevanceSorter(CompletionSorter.emptySorter())
            .addAllElements(results);
        resultSet.stopHere();
    }
}
 
Example #6
Source File: IncompatibleDartPluginNotificationProvider.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) {
  if (!FlutterUtils.isFlutteryFile(file)) return null;

  final PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file);
  if (psiFile == null) return null;

  if (psiFile.getLanguage() != DartLanguage.INSTANCE) return null;

  final Module module = ModuleUtilCore.findModuleForPsiElement(psiFile);
  if (module == null) return null;

  if (!FlutterModuleUtils.isFlutterModule(module)) return null;

  final Version minimumVersion = DartPlugin.getInstance().getMinimumVersion();
  final Version dartVersion = DartPlugin.getInstance().getVersion();
  if (dartVersion.minor == 0 && dartVersion.bugfix == 0) {
    return null; // Running from sources.
  }
  return dartVersion.compareTo(minimumVersion) < 0 ? createUpdateDartPanel(myProject, module, dartVersion.toCompactString(),
                                                                           getPrintableRequiredDartVersion()) : null;
}
 
Example #7
Source File: ProjectViewImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void detachLibrary(@Nonnull final LibraryOrderEntry orderEntry, @Nonnull Project project) {
  final Module module = orderEntry.getOwnerModule();
  String message = IdeBundle.message("detach.library.from.module", orderEntry.getPresentableName(), module.getName());
  String title = IdeBundle.message("detach.library");
  int ret = Messages.showOkCancelDialog(project, message, title, Messages.getQuestionIcon());
  if (ret != Messages.OK) return;
  CommandProcessor.getInstance().executeCommand(module.getProject(), () -> {
    final Runnable action = () -> {
      ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
      OrderEntry[] orderEntries = rootManager.getOrderEntries();
      ModifiableRootModel model = rootManager.getModifiableModel();
      OrderEntry[] modifiableEntries = model.getOrderEntries();
      for (int i = 0; i < orderEntries.length; i++) {
        OrderEntry entry = orderEntries[i];
        if (entry instanceof LibraryOrderEntry && ((LibraryOrderEntry)entry).getLibrary() == orderEntry.getLibrary()) {
          model.removeOrderEntry(modifiableEntries[i]);
        }
      }
      model.commit();
    };
    ApplicationManager.getApplication().runWriteAction(action);
  }, title, null);
}
 
Example #8
Source File: FlutterUtils.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Nullable
public static Module findFlutterGradleModule(@NotNull Project project) {
  String moduleName = AndroidUtils.FLUTTER_MODULE_NAME;
  Module module = findModuleNamed(project, moduleName);
  if (module == null) {
    moduleName = flutterGradleModuleName(project);
    module = findModuleNamed(project, moduleName);
    if (module == null) {
      return null;
    }
  }
  VirtualFile file = locateModuleRoot(module);
  if (file == null) {
    return null;
  }
  file = file.getParent().getParent();
  VirtualFile meta = file.findChild(".metadata");
  if (meta == null) {
    return null;
  }
  VirtualFile android = getFlutterManagedAndroidDir(meta.getParent());
  if (android != null && android.getName().equals(".android")) {
    return module; // Only true for Flutter modules.
  }
  return null;
}
 
Example #9
Source File: VueModuleBuilder.java    From vue-for-idea with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
static void runWhenNonModalIfModuleNotDisposed(@NotNull final Runnable runnable, @NotNull final Module module) {
    StartupManager.getInstance(module.getProject()).runWhenProjectIsInitialized(new Runnable() {
        @Override
        public void run() {
            if (ApplicationManager.getApplication().getCurrentModalityState() == ModalityState.NON_MODAL) {
                runnable.run();
            } else {
                ApplicationManager.getApplication().invokeLater(runnable, ModalityState.NON_MODAL, new Condition() {
                    @Override
                    public boolean value(final Object o) {
                        return module.isDisposed();
                    }
                });
            }
        }
    });
}
 
Example #10
Source File: BeanUtils.java    From camel-idea-plugin with Apache License 2.0 6 votes vote down vote up
private List<ReferenceableBeanId> findReferenceableIds(@NotNull Module module, Predicate<String> idCondition, boolean stopOnMatch) {
    List<ReferenceableBeanId> results = new ArrayList<>();
    IdeaUtils.getService().iterateXmlDocumentRoots(module, root -> {
        if (isPartOfBeanContainer(root)) {
            IdeaUtils.getService().iterateXmlNodes(root, XmlTag.class, tag -> Optional.of(tag)
                    .filter(this::isPartOfBeanContainer)
                    .map(contextTag -> findAttributeValue(contextTag, "id").orElse(null))
                    .filter(id -> idCondition.test(id.getValue()))
                    .map(id -> createReferenceableId(tag, id))
                    .map(ref -> {
                        results.add(ref);
                        return !stopOnMatch;
                    })
                    .orElse(true));
        }
    });
    return results;
}
 
Example #11
Source File: GradleModuleBuilderPostProcessor.java    From intellij-spring-assistant with MIT License 6 votes vote down vote up
@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 #12
Source File: DefaultNavBarExtension.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static boolean processChildren(Module module, Processor<Object> processor) {
  final PsiManager psiManager = PsiManager.getInstance(module.getProject());
  ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
  VirtualFile[] roots = moduleRootManager.getContentRoots();
  for (final VirtualFile root : roots) {
    final PsiDirectory psiDirectory = ApplicationManager.getApplication().runReadAction(new Computable<PsiDirectory>() {
      @Override
      public PsiDirectory compute() {
        return psiManager.findDirectory(root);
      }
    });
    if (psiDirectory != null) {
      if (!processor.process(psiDirectory)) return false;
    }
  }
  return true;
}
 
Example #13
Source File: FilePathReferenceProvider.java    From protobuf-jetbrains-plugin with Apache License 2.0 6 votes vote down vote up
@NotNull
public Collection<PsiFileSystemItem> getRoots(@Nullable final Module module, ProtoPsiFileRoot psiFileRoot) {
    if (module == null) {
        return Collections.emptyList();
    }

    Set<PsiFileSystemItem> result = ContainerUtil.newLinkedHashSet();
    PsiManager psiManager = PsiManager.getInstance(module.getProject());

    for (SourceRootsProvider sourceRootsProvider : sourceRootsProviders) {
        VirtualFile[] sourceRoots = sourceRootsProvider.getSourceRoots(module, psiFileRoot);
        for (VirtualFile root : sourceRoots) {
            if (root != null) {
                final PsiDirectory directory = psiManager.findDirectory(root);
                if (directory != null) {
                    result.add(directory);
                }
            }
        }
    }
    return result;
}
 
Example #14
Source File: DocCommentProcessor.java    From markdown-doclet with GNU General Public License v3.0 6 votes vote down vote up
public DocCommentProcessor(PsiFile file) {
    this.file = file;
    if ( file == null ) {
        project = null;
        markdownOptions = null;
        psiElementFactory = null;
    }
    else {
        project = file.getProject();
        psiElementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
        ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
        Module module = fileIndex.getModuleForFile(file.getVirtualFile());
        if ( module == null ) {
            markdownOptions = null;
        }
        else if ( !fileIndex.isInSourceContent(file.getVirtualFile()) ) {
            markdownOptions = null;
        }
        else if ( !Plugin.moduleConfiguration(module).isMarkdownEnabled() ) {
            markdownOptions = null;
        }
        else {
            markdownOptions = Plugin.moduleConfiguration(module).getRenderingOptions();
        }
    }
}
 
Example #15
Source File: PackageNodeUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static PsiPackage[] getSubpackages(@Nonnull PsiPackage aPackage,
                                              @Nullable Module module,
                                              @Nonnull Project project,
                                              final boolean searchInLibraries) {
  final PsiDirectory[] dirs = getDirectories(aPackage, project, module, searchInLibraries);
  final Set<PsiPackage> subpackages = new HashSet<PsiPackage>();
  for (PsiDirectory dir : dirs) {
    final PsiDirectory[] subdirectories = dir.getSubdirectories();
    for (PsiDirectory subdirectory : subdirectories) {
      final PsiPackage psiPackage = PsiPackageManager.getInstance(project).findAnyPackage(subdirectory);
      if (psiPackage != null) {
        final String name = psiPackage.getName();
        // skip "default" subpackages as they should be attributed to other modules
        // this is the case when contents of one module is nested into contents of another
        if (name != null && !name.isEmpty()) {
          subpackages.add(psiPackage);
        }
      }
    }
  }
  return subpackages.toArray(new PsiPackage[subpackages.size()]);
}
 
Example #16
Source File: StepAnnotatorTest.java    From Intellij-Plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testShouldAnnotateInGaugeModule() throws Exception {
    SpecStepImpl element = mock(SpecStepImpl.class);
    Module module = mock(Module.class);

    when(helper.isGaugeModule(element)).thenReturn(true);
    when(element.getTextRange()).thenReturn(textRange);
    when(helper.getModule(element)).thenReturn(module);
    when(helper.isEmpty(element)).thenReturn(false);
    when(helper.isImplemented(element, module)).thenReturn(false);
    when(holder.createErrorAnnotation(textRange, "Undefined Step")).thenReturn(new Annotation(1, 1, new HighlightSeverity("dsf", 1), "", ""));

    new StepAnnotator(helper).annotate(element, holder);

    verify(holder, times(1)).createErrorAnnotation(textRange, "Undefined Step");
}
 
Example #17
Source File: ArmaPlugin.java    From arma-intellij-plugin with MIT License 6 votes vote down vote up
/**
 * @return the path to Arma IntelliJ Plugin's temp directory for the given module,
 * or null if the .iml directory couldn't be located
 */
@Nullable
public static String getPathToTempDirectory(@NotNull Module module) {
	final String tempFolder = "/armaplugin-temp";

	//find a place to save parse data
	VirtualFile imlVirtFile = module.getModuleFile();
	if (imlVirtFile == null) {
		String projectBasePath = module.getProject().getBasePath();
		if (projectBasePath == null) {
			return null;
		}
		return projectBasePath + tempFolder;
	}
	VirtualFile imlDir = imlVirtFile.getParent();
	if (imlDir == null) {
		return null;
	}
	return imlDir.getPath() + tempFolder;
}
 
Example #18
Source File: ModuleStructureConfigurable.java    From consulo with Apache License 2.0 6 votes vote down vote up
public AsyncResult<Void> selectOrderEntry(@Nonnull final Module module, @Nullable final OrderEntry orderEntry) {
  Place p = new Place();
  p.putPath(ProjectStructureConfigurable.CATEGORY, this);
  Runnable r = null;

  final MasterDetailsComponent.MyNode node = findModuleNode(module);
  if (node != null) {
    p.putPath(TREE_OBJECT, module);
    p.putPath(ModuleEditor.SELECTED_EDITOR_NAME, ClasspathEditor.NAME);
    r = new Runnable() {
      @Override
      public void run() {
        if (orderEntry != null) {
          ModuleEditor moduleEditor = ((ModuleConfigurable)node.getConfigurable()).getModuleEditor();
          ModuleConfigurationEditor editor = moduleEditor.getEditor(ClasspathEditor.NAME);
          if (editor instanceof ClasspathEditor) {
            ((ClasspathEditor)editor).selectOrderEntry(orderEntry);
          }
        }
      }
    };
  }
  final AsyncResult<Void> result = ProjectStructureConfigurable.getInstance(myProject).navigateTo(p, true);
  return r != null ? result.doWhenDone(r) : result;
}
 
Example #19
Source File: LogicalRootsManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private synchronized  Map<Module, MultiValuesMap<LogicalRootType, LogicalRoot>> getRoots(final ModuleManager moduleManager) {
  if (myRoots == null) {
    myRoots = new THashMap<Module, MultiValuesMap<LogicalRootType, LogicalRoot>>();

    final Module[] modules = moduleManager.getModules();
    for (Module module : modules) {
      final MultiValuesMap<LogicalRootType, LogicalRoot> map = new MultiValuesMap<LogicalRootType, LogicalRoot>();
      for (Map.Entry<LogicalRootType, Collection<NotNullFunction>> entry : myProviders.entrySet()) {
        final Collection<NotNullFunction> functions = entry.getValue();
        for (NotNullFunction function : functions) {
          map.putAll(entry.getKey(), (List<LogicalRoot>) function.fun(module));
        }
      }
      myRoots.put(module, map);
    }
  }

  return myRoots;
}
 
Example #20
Source File: ModuleCompileScope.java    From consulo with Apache License 2.0 5 votes vote down vote up
private String[] getModuleContentUrls(final Module module) {
  String[] contentRootUrls = myContentUrlsCache.get(module);
  if (contentRootUrls == null) {
    contentRootUrls = ModuleRootManager.getInstance(module).getContentRootUrls();
    myContentUrlsCache.put(module, contentRootUrls);
  }
  return contentRootUrls;
}
 
Example #21
Source File: LanguageServerWrapper.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
/** Unified private constructor to set sensible defaults in all cases */
private LanguageServerWrapper(@Nullable Module project, @Nonnull LanguageServersRegistry.LanguageServerDefinition serverDefinition,
                              @Nullable URI initialPath) {
    this.initialProject = project;
    this.initialPath = initialPath;
    this.allWatchedProjects = new HashSet<>();
    this.serverDefinition = serverDefinition;
    this.connectedDocuments = new HashMap<>();
}
 
Example #22
Source File: SQFReferenceContributor.java    From arma-intellij-plugin with MIT License 5 votes vote down vote up
/**
 * Adds all {@link SQFCommand} instances in the current module that is equal to findCommand into a list and returns it
 *
 * @param project     project
 * @param findCommand the command
 * @return list
 */
@NotNull
public static List<SQFCommand> findAllCommandInstances(@NotNull Project project, @NotNull SQFCommand findCommand) {
	List<SQFCommand> result = new ArrayList<>();
	Module m = ModuleUtil.findModuleForPsiElement(findCommand);
	if (m == null) {
		return result;
	}
	GlobalSearchScope searchScope = m.getModuleContentScope();
	Collection<VirtualFile> files = FileTypeIndex.getFiles(SQFFileType.INSTANCE, searchScope);
	for (VirtualFile virtualFile : files) {
		PsiFile file = PsiManager.getInstance(project).findFile(virtualFile);
		if (!(file instanceof SQFFile)) {
			continue;
		}
		SQFFile sqfFile = (SQFFile) file;
		PsiUtil.traverseBreadthFirstSearch(sqfFile.getNode(), astNode -> {
			PsiElement nodeAsElement = astNode.getPsi();
			if (nodeAsElement instanceof SQFCommand) {
				SQFCommand command = (SQFCommand) nodeAsElement;
				if (command.commandNameEquals(findCommand.getCommandName())) {
					result.add(command);
				}
			}
			return false;
		});
	}
	return result;
}
 
Example #23
Source File: ProjectRootsUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public static ContentFolder findContentFolderForDirectory(@Nonnull ProjectFileIndex projectFileIndex, @Nonnull VirtualFile virtualFile) {
  final Module module = projectFileIndex.getModuleForFile(virtualFile);
  if (module == null) {
    return null;
  }

  ContentFolder contentFolder = projectFileIndex.getContentFolder(virtualFile);
  if (contentFolder == null) {
    return null;
  }
  return virtualFile.equals(contentFolder.getFile()) ? contentFolder : null;
}
 
Example #24
Source File: WebProjectViewImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@javax.annotation.Nullable
private LibraryOrderEntry getSelectedLibrary() {
  final AbstractProjectViewPane viewPane = getCurrentProjectViewPane();
  DefaultMutableTreeNode node = viewPane != null ? viewPane.getSelectedNode() : null;
  if (node == null) return null;
  DefaultMutableTreeNode parent = (DefaultMutableTreeNode)node.getParent();
  if (parent == null) return null;
  Object userObject = parent.getUserObject();
  if (userObject instanceof LibraryGroupNode) {
    userObject = node.getUserObject();
    if (userObject instanceof NamedLibraryElementNode) {
      NamedLibraryElement element = ((NamedLibraryElementNode)userObject).getValue();
      OrderEntry orderEntry = element.getOrderEntry();
      return orderEntry instanceof LibraryOrderEntry ? (LibraryOrderEntry)orderEntry : null;
    }
    PsiDirectory directory = ((PsiDirectoryNode)userObject).getValue();
    VirtualFile virtualFile = directory.getVirtualFile();
    Module module = (Module)((AbstractTreeNode)((DefaultMutableTreeNode)parent.getParent()).getUserObject()).getValue();

    if (module == null) return null;
    ModuleFileIndex index = ModuleRootManager.getInstance(module).getFileIndex();
    OrderEntry entry = index.getOrderEntryForFile(virtualFile);
    if (entry instanceof LibraryOrderEntry) {
      return (LibraryOrderEntry)entry;
    }
  }

  return null;
}
 
Example #25
Source File: CompilerManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public CompileScope createModuleCompileScope(@Nonnull final Module module, final boolean includeDependentModules) {
  for (CompileModuleScopeFactory compileModuleScopeFactory : CompileModuleScopeFactory.EP_NAME.getExtensionList()) {
    FileIndexCompileScope scope = compileModuleScopeFactory.createScope(module, includeDependentModules);
    if (scope != null) {
      return scope;
    }
  }
  return new ModuleCompileScope(module, includeDependentModules);
}
 
Example #26
Source File: HaxelibClasspathUtils.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
/**
 * Get the classpath for the given module.  This does not include any
 * paths from projects or SDKs.
 *
 * @param module to look up haxelib for.
 * @return a (possibly empty) collection of classpaths.  These are NOT
 *         necessarily properly ordered, but they are unique.
 */
@NotNull
public static HaxeClasspath getModuleClasspath(@NotNull Module module) {
  ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
  if (null == rootManager) return HaxeClasspath.EMPTY_CLASSPATH;

  ModifiableRootModel rootModel = rootManager.getModifiableModel();
  LibraryTable libraryTable = rootModel.getModuleLibraryTable();
  HaxeClasspath moduleClasspath = loadClasspathFrom(libraryTable);
  rootModel.dispose();    // MUST dispose of the model.
  return moduleClasspath;
}
 
Example #27
Source File: PantsJUnitTestRunConfigurationProducer.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
private boolean hasJUnitTestClasses(PsiPackage psiPackage, Module module) {
  if (psiPackage == null) return false;
  for (PsiClass psiClass : psiPackage.getClasses(module.getModuleScope())) {
    if (TestIntegrationUtils.isTest(psiClass)) {
      return true;
    }
  }
  return false;
}
 
Example #28
Source File: ChangesModuleGroupingPolicy.java    From consulo with Apache License 2.0 5 votes vote down vote up
private ChangesBrowserNode getNodeForModule(Module module, ChangesBrowserNode root) {
  ChangesBrowserNode node = myModuleCache.get(module);
  if (node == null) {
    if (module == null) {
      node = ChangesBrowserNode.create(myProject, PROJECT_ROOT_TAG);
    }
    else {
      node = new ChangesBrowserModuleNode(module);
    }
    myModel.insertNodeInto(node, root, root.getChildCount());
    myModuleCache.put(module, node);
  }
  return node;
}
 
Example #29
Source File: FlutterModuleUtils.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@NotNull
public static Module[] getModules(@NotNull Project project) {
  // A disposed project has no modules.
  if (project.isDisposed()) return Module.EMPTY_ARRAY;

  return ModuleManager.getInstance(project).getModules();
}
 
Example #30
Source File: ArrayMetadataProxy.java    From intellij-spring-assistant with MIT License 5 votes vote down vote up
@Nullable
@Override
public Collection<? extends SuggestionDocumentationHelper> findDirectChildrenForQueryPrefix(
    Module module, String querySegmentPrefix, @Nullable Set<String> siblingsToExclude) {
  // TODO: Should each element be wrapped inside Iterale Suggestion element?
  return doWithDelegateAndReturn(delegate -> delegate
      .findDirectChildrenForQueryPrefix(module, querySegmentPrefix, siblingsToExclude), null);
}