當前位置: 首頁>>代碼示例>>Java>>正文


Java DumbService.allowStartingDumbModeInside方法代碼示例

本文整理匯總了Java中com.intellij.openapi.project.DumbService.allowStartingDumbModeInside方法的典型用法代碼示例。如果您正苦於以下問題:Java DumbService.allowStartingDumbModeInside方法的具體用法?Java DumbService.allowStartingDumbModeInside怎麽用?Java DumbService.allowStartingDumbModeInside使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.project.DumbService的用法示例。


在下文中一共展示了DumbService.allowStartingDumbModeInside方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doOKAction

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
protected void doOKAction() {
  final LibraryCompositionSettings settings = myPanel.apply();
  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      if (settings != null && settings.downloadFiles(myPanel.getMainPanel())) {
        if (myModifiableRootModel == null) {
          final ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
          new WriteAction() {
            @Override
            protected void run(@NotNull final Result result) {
              addLibraries(model, settings);
              model.commit();
            }
          }.execute();
        }
        else {
          addLibraries(myModifiableRootModel, settings);
        }

      }
      AddCustomLibraryDialog.super.doOKAction();
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:AddCustomLibraryDialog.java

示例2: doOKAction

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
protected void doOKAction() {
  if (myAddSupportPanel.hasSelectedFrameworks()) {
    if (!myAddSupportPanel.downloadLibraries()) {
      int answer = Messages.showYesNoDialog(myAddSupportPanel.getMainPanel(),
                                            ProjectBundle.message("warning.message.some.required.libraries.wasn.t.downloaded"),
                                            CommonBundle.getWarningTitle(), Messages.getWarningIcon());
      if (answer != Messages.YES) {
        return;
      }
    }

    DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
      @Override
      public void run() {
        new WriteAction() {
          protected void run(@NotNull final Result result) {
            ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
            myAddSupportPanel.addSupport(myModule, model);
            model.commit();
          }
        }.execute();
      }
    });
  }
  super.doOKAction();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:AddFrameworkSupportDialog.java

示例3: performRename

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void performRename(final String newName) {
  final RenamePsiElementProcessor elementProcessor = RenamePsiElementProcessor.forElement(myPsiElement);
  elementProcessor.setToSearchInComments(myPsiElement, isSearchInComments());
  if (myCbSearchTextOccurences.isEnabled()) {
    elementProcessor.setToSearchForTextOccurrences(myPsiElement, isSearchInNonJavaFiles());
  }
  if (mySuggestedNameInfo != null) {
    mySuggestedNameInfo.nameChosen(newName);
  }

  final RenameProcessor processor = createRenameProcessor(newName);

  for(Map.Entry<AutomaticRenamerFactory, JCheckBox> e: myAutomaticRenamers.entrySet()) {
    e.getKey().setEnabled(e.getValue().isSelected());
    if (e.getValue().isSelected()) {
      processor.addRenamerFactory(e.getKey());
    }
  }

  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_MODAL, new Runnable() {
    @Override
    public void run() {
      invokeRefactoring(processor);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:RenameDialog.java

示例4: doOKAction

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
protected final void doOKAction() {
  final Ref<Boolean> result = Ref.create(false);
  DumbService.allowStartingDumbModeInside(
      DumbModePermission.MAY_START_BACKGROUND,
      new Runnable() {
        @Override
        public void run() {
          result.set(doFinishAction());
        }
      });
  if (!result.get()) {
    return;
  }
  super.doOKAction();
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:17,代碼來源:BlazeNewProjectWizard.java

示例5: doOKAction

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void doOKAction() {
  myEditor.flushModifications();

  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    public void run() {
      if (myEditor.canApply()) {
        myEditor.apply();
        if (!updateStatus()) return;
      }

      saveCurrentConfigurable();

      ApplicationManager.getApplication().saveAll();

      IdeSettingsDialog.super.doOKAction();
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:IdeSettingsDialog.java

示例6: canClose

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public boolean canClose(final String inputString) {
  if (inputString.length() == 0) {
    return super.canClose(inputString);
  }

  final PsiDirectory psiDirectory = getDirectory();

  final Project project = psiDirectory.getProject();
  final boolean[] result = {false};
  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      final FileType type = FileTypeChooser.getKnownFileTypeOrAssociate(new FakeVirtualFile(psiDirectory.getVirtualFile(), getFileName(inputString)),
                                                                        project);
      result[0] = type != null && MyValidator.super.canClose(getFileName(inputString));
    }
  });
  return result[0];
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:CreateFileAction.java

示例7: createCloseActionListener

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
protected final ActionListener createCloseActionListener() {
  return new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      boolean isValid = checkValid();
      if (isValid && myCallback != null) {
        final DialogWrapper dialog = DialogWrapper.findInstance(myCreateButton);
        if (dialog != null) {
          dialog.close(DialogWrapper.OK_EXIT_CODE);
        }
        DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
          @Override
          public void run() {
            myCallback.consume(ProjectSettingsStepBase.this);
          }
        });
      }
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:ProjectSettingsStepBase.java

示例8: actionPerformed

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
  final ProjectStructureElement selectedElement = mySourceConfigurable.getSelectedElement();
  if (!(selectedElement instanceof LibraryProjectStructureElement)) return;
  final StructureConfigurableContext context = mySourceConfigurable.myContext;
  final LibraryProjectStructureElement libraryElement = (LibraryProjectStructureElement)selectedElement;
  final LibraryEx oldLibrary = (LibraryEx)context.getLibrary(libraryElement.getLibrary().getName(), mySourceConfigurable.getLevel());
  LOG.assertTrue(oldLibrary != null);

  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      final Library newLibrary = doCopy(oldLibrary);
      if (newLibrary == null) return;

      final Collection<ProjectStructureElementUsage> usages = context.getDaemonAnalyzer().getUsages(libraryElement);
      for (ProjectStructureElementUsage usage : usages) {
        usage.replaceElement(new LibraryProjectStructureElement(context, newLibrary));
      }

      if (!myCopy) {
        mySourceConfigurable.removeLibrary(libraryElement);
      }
      ProjectStructureConfigurable.getInstance(myProject).selectProjectOrGlobalLibrary(newLibrary, true);
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:ChangeLibraryLevelAction.java

示例9: doOKAction

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
protected void doOKAction() {
  if (DumbService.isDumb(myProject)) {
    Messages.showMessageDialog(myProject, "Safe delete refactoring is not available while indexing is in progress", "Indexing", null);
    return;
  }

  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      if (myCallback != null && isSafeDelete()) {
        myCallback.run(SafeDeleteDialog.this);
      } else {
        SafeDeleteDialog.super.doOKAction();
      }
    }
  });

  final RefactoringSettings refactoringSettings = RefactoringSettings.getInstance();
  if (myCbSafeDelete != null) {
    refactoringSettings.SAFE_DELETE_WHEN_DELETE = myCbSafeDelete.isSelected();
  }
  if (isSafeDelete()) {
    if (myDelegate == null) {
      refactoringSettings.SAFE_DELETE_SEARCH_IN_COMMENTS = isSearchInComments();
      if (myCbSearchTextOccurrences != null) {
        refactoringSettings.SAFE_DELETE_SEARCH_IN_NON_JAVA = isSearchForTextOccurences();
      }
    } else {
      myDelegate.setToSearchInComments(myElements[0], isSearchInComments());

      if (myCbSearchTextOccurrences != null) {
        myDelegate.setToSearchForTextOccurrences(myElements[0], isSearchForTextOccurences());
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:38,代碼來源:SafeDeleteDialog.java

示例10: doOKAction

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
protected void doOKAction() {
  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      addLibrary();
    }
  });
  super.doOKAction();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:CreateLibraryFromFilesDialog.java

示例11: actionPerformed

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
  VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
  final Module module = getModule(e, files);
  if (module == null) {
    return;
  }

  final ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel();
  for (VirtualFile file : files) {
    ContentEntry entry = findContentEntry(model, file);
    if (entry != null) {
      final SourceFolder[] sourceFolders = entry.getSourceFolders();
      for (SourceFolder sourceFolder : sourceFolders) {
        if (Comparing.equal(sourceFolder.getFile(), file)) {
          entry.removeSourceFolder(sourceFolder);
          break;
        }
      }
      modifyRoots(file, entry);
    }
  }
  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        @Override
        public void run() {
          model.commit();
          module.getProject().save();
        }
      });
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:36,代碼來源:MarkRootActionBase.java

示例12: doOKAction

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
protected void doOKAction() {
  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      try {
        if (myConfigurable.isModified()) {
          myConfigurable.apply();
          mySaveAllOnClose = true;
        }
      }
      catch (ConfigurationException e) {
        if (e.getMessage() != null) {
          if (myProject != null) {
            Messages.showMessageDialog(myProject, e.getMessage(), e.getTitle(), Messages.getErrorIcon());
          }
          else {
            Messages.showMessageDialog(getRootPane(), e.getMessage(), e.getTitle(), Messages.getErrorIcon());
          }
        }
        return;
      }

      SingleConfigurableEditor.super.doOKAction();
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:SingleConfigurableEditor.java

示例13: actionPerformed

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent event) {
  if (myPerformAction) return;
  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      try {
        myPerformAction = true;
        if (myConfigurable.isModified()) {
          myConfigurable.apply();
          mySaveAllOnClose = true;
          setCancelButtonText(CommonBundle.getCloseButtonText());
        }
      }
      catch (ConfigurationException e) {
        if (myProject != null) {
          Messages.showMessageDialog(myProject, e.getMessage(), e.getTitle(), Messages.getErrorIcon());
        }
        else {
          Messages.showMessageDialog(getRootPane(), e.getMessage(), e.getTitle(),
                                     Messages.getErrorIcon());
        }
      } finally {
        myPerformAction = false;
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:29,代碼來源:SingleConfigurableEditor.java

示例14: doOKAction

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void doOKAction() {
  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      if (myEditor.apply()) {
        ApplicationManager.getApplication().saveAll();
        SettingsDialog.super.doOKAction();
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:SettingsDialog.java

示例15: actionPerformed

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void actionPerformed(final ActionEvent e) {
  DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
    @Override
    public void run() {
      myEditor.apply();
    }
  });
  myEditor.revalidate();
  myEditor.repaint();
  updateStatus();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:IdeSettingsDialog.java


注:本文中的com.intellij.openapi.project.DumbService.allowStartingDumbModeInside方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。