Package com.intellij.openapi.module

Examples of com.intellij.openapi.module.Module


    if (file.getLanguage() != DartLanguage.INSTANCE && !PubspecYamlUtil.PUBSPEC_YAML.equals(file.getName())) {
      return ProblemDescriptor.EMPTY_ARRAY;
    }

    final Module module = ModuleUtilCore.findModuleForPsiElement(file);
    if (module == null) return ProblemDescriptor.EMPTY_ARRAY;

    final DartSdk sdk = DartSdk.getGlobalDartSdk();
    if (sdk == null) {
      return createProblemDescriptors(file, manager, DartBundle.message("dart.sdk.is.not.configured"),
                                      new OpenDartSettingsQuickFix(DartBundle.message("setup.dart.sdk")));
    }

    if (!DartSdkGlobalLibUtil.isDartSdkGlobalLibAttached(module, sdk.getGlobalLibName())) {
      final String message = DartSdkGlobalLibUtil.isIdeWithMultipleModuleSupport()
                             ? DartBundle.message("dart.support.is.not.enabled.for.module.0", module.getName())
                             : DartBundle.message("dart.support.is.not.enabled.for.project");

      return createProblemDescriptors(file, manager, message,
                                      new EnableDartSupportQuickFix(module, sdk.getGlobalLibName()),
                                      new OpenDartSettingsQuickFix(DartBundle.message("open.dart.settings")));
View Full Code Here


        for (VirtualFile file : files) {
          manager.openFile(file, true);

          if (PubspecYamlUtil.PUBSPEC_YAML.equals(file.getName())) {
            final AnAction pubGetAction = ActionManager.getInstance().getAction("Dart.pub.get");
            final Module module = ModuleUtilCore.findModuleForFile(file, project);
            if (pubGetAction instanceof DartPubGetAction && module != null) {
              ((DartPubGetAction)pubGetAction).performPubAction(module, file, false);
            }
          }
        }
View Full Code Here

  @Override
  @Nullable
  public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, @NotNull final FileEditor fileEditor) {
    if (file.isInLocalFileSystem() && PubspecYamlUtil.PUBSPEC_YAML.equalsIgnoreCase(file.getName())) {
      final DartSdk sdk = DartSdk.getGlobalDartSdk();
      final Module module = ModuleUtilCore.findModuleForFile(file, myProject);
      if (module != null && sdk != null && DartSdkGlobalLibUtil.isDartSdkGlobalLibAttached(module, sdk.getGlobalLibName())) {
        return new PubActionsPanel();
      }
    }
View Full Code Here

    e.getPresentation().setEnabled(visible && !ourInProgress.get());
  }

  @Nullable
  private static Pair<Module, VirtualFile> getModuleAndPubspecYamlFile(final AnActionEvent e) {
    final Module module = LangDataKeys.MODULE.getData(e.getDataContext());
    final PsiFile psiFile = CommonDataKeys.PSI_FILE.getData(e.getDataContext());

    if (module != null && psiFile != null && psiFile.getName().equalsIgnoreCase(PUBSPEC_YAML)) {
      final VirtualFile file = psiFile.getOriginalFile().getVirtualFile();
      return file != null ? Pair.create(module, file) : null;
View Full Code Here

  @Override
  public void actionPerformed(@NotNull final AnActionEvent e) {
    final Pair<Module, VirtualFile> moduleAndPubspecYamlFile = getModuleAndPubspecYamlFile(e);
    if (moduleAndPubspecYamlFile == null) return;

    final Module module = moduleAndPubspecYamlFile.first;
    final VirtualFile pubspecYamlFile = moduleAndPubspecYamlFile.second;

    performPubAction(module, pubspecYamlFile, true);
  }
View Full Code Here

  private void updateModuleExcludeByFSEvent(VirtualFileEvent event,
                                            Set<String> oldToUpdateFolders,
                                            Set<String> newToUpdateFolders) {
    VirtualFile eventFile = event.getFile();
    Module module = ModuleUtilCore.findModuleForFile(eventFile, myProject);
    if (module == null) {
      return;
    }
    VirtualFile contentRoot = getContentRoot(module, event.getParent());
    if (contentRoot == null) {
View Full Code Here

    final Collection<VirtualFile> platformsFolders = FilenameIndex.getVirtualFilesByName(myProject,
                                                                                         FOLDER_PLATFORMS,
                                                                                         GlobalSearchScope.projectScope(myProject));

    for (VirtualFile platformFolder : platformsFolders) {
      Module module = ModuleUtilCore.findModuleForFile(platformFolder, myProject);
      if (module == null) {
        continue;
      }
      VirtualFile contentRoot = getContentRoot(module, platformFolder);
      if (contentRoot == null) continue;
View Full Code Here

    myCustomPackageRootsTextWithBrowse.addBrowseFolderListener(myProject, bfListener);

    myCustomPackageRootsTextWithBrowse.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
      protected void textChanged(final DocumentEvent e) {
        final Module module = myModuleToCustomPackageRootsCurrent.keySet().iterator().next();
        final String customPackageRoots = FileUtil.toSystemIndependentName(myCustomPackageRootsTextWithBrowse.getText().trim());
        myModuleToCustomPackageRootsCurrent.put(module, StringUtil.split(customPackageRoots, SEMICOLON));
        updateErrorLabel();
      }
    });
View Full Code Here

    final Runnable runnable = new Runnable() {
      public void run() {
        final Module[] modules = ModuleManager.getInstance(project).getModules();
        for (int i = 0; i < modules.length; i++) {
          final Module module = modules[i];

          final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
          if (indicator != null) {
            indicator.setText("pub list-package-dirs");
            indicator.setText2("Module: " + module.getName());
            indicator.setIndeterminate(false);
            indicator.setFraction((i + 1.) / modules.length);
            indicator.checkCanceled();
          }
View Full Code Here

    return null;
  }

  @Nullable
  private VirtualFile initPackageRootsAndReturnPubspecYamlFile(final @NotNull VirtualFile contextFile) {
    final Module module = ModuleUtilCore.findModuleForFile(contextFile, myProject);
    if (module == null) return null;

    final VirtualFile[] customPackageRoots = DartConfigurable.getCustomPackageRoots(module);
    if (customPackageRoots.length > 0) {
      Collections.addAll(myPackageRoots, customPackageRoots);
View Full Code Here

TOP

Related Classes of com.intellij.openapi.module.Module

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.