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


Java DumbService.isDumb方法代碼示例

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


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

示例1: applyFix

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {

    PsiElement psiElement = descriptor.getPsiElement();
    if (DumbService.isDumb(project)) {
        showIsInDumpModeMessage(project, psiElement);
        return;
    }

    if (psiElement instanceof ClassReference) {
        ClassReference classReference = (ClassReference) psiElement;
        String fqn = classReference.getFQN();
        if (fqn != null) {
            String replacementFQN = LegacyClassesForIDEIndex.findReplacementClass(project, fqn);
            if (replacementFQN != null) {
                try {
                    classReference.replace(PhpPsiElementFactory.createClassReference(project, replacementFQN));
                } catch (IncorrectOperationException e) {
                    showErrorMessage(project, "Could not replace class reference", psiElement);
                }
            }
        }
    }
}
 
開發者ID:cedricziel,項目名稱:idea-php-typo3-plugin,代碼行數:25,代碼來源:LegacyClassesForIdeQuickFix.java

示例2: actionPerformed

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

    Project project = PsiUtil.getProject(anActionEvent);
    DumbService dumbService = DumbService.getInstance(project);
    if (dumbService.isDumb()) {
        dumbService.showDumbModeNotification(CodeGenBundle.message("codegen.plugin.is.not.available.during.indexing"));
        return;
    }

    JFrame frame = new JFrame();
    frame.setTitle("CodeGen-SQL");
    frame.setContentPane(new SqlEditorPanel(new IdeaContext(project)).getRootComponent());
    frame.setSize(600, 400);
    frame.setResizable(false);
    frame.setAlwaysOnTop(true);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
 
開發者ID:hykes,項目名稱:CodeGen,代碼行數:20,代碼來源:SQLGeneratorAction.java

示例3: after

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void after( final List<? extends VFileEvent> events )
{
  if( _project.isDisposed() )
  {
    return;
  }

  DumbService dumb = DumbService.getInstance( _project );
  if( dumb.isDumb() )
  {
    dumb.smartInvokeLater( () -> _after( events ) );
  }
  else
  {
    ApplicationManager.getApplication().invokeLater( () ->_after( events ) );
  }
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:18,代碼來源:FileModificationManager.java

示例4: getCatberryVersion

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Nullable
private String getCatberryVersion() {
  if (DumbService.isDumb(project))
    return null;

  final NotNullLazyValue<ModificationTracker> tracker = getCatberryTracker();
  return CachedValuesManager.getManager(project).getCachedValue(project, new CachedValueProvider<String>() {
    @Nullable
    @Override
    public Result<String> compute() {
      VirtualFile vf = project.getBaseDir().findChild("package.json");
      if (vf == null)
        return Result.create(null, tracker.getValue());
      final JsonFile file = (JsonFile) PsiManager.getInstance(project).findFile(vf);
      if (file == null || file.getTopLevelValue()==null)
        return Result.create(null, tracker.getValue());
      JsonValue value = JsonPsiUtil.findPropertyValue(file.getTopLevelValue(), "dependencies/catberry");
      if (value != null)
        return Result.create(value.getText(), file);
      return Result.create(null, tracker.getValue());
    }
  });
}
 
開發者ID:catberry,項目名稱:catberry-idea-plugin,代碼行數:24,代碼來源:CatberryProjectConfigurationManager.java

示例5: getComponentsDirectories

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
public PsiDirectory[] getComponentsDirectories() {
  if (DumbService.isDumb(project))
    return new PsiDirectory[0];

  final NotNullLazyValue<ModificationTracker> tracker = getCatberryTracker();
  ComponentsDirectoriesProvider provider = new ComponentsDirectoriesProvider(project, tracker);
  String[] res = CachedValuesManager.getManager(project).getCachedValue(project, provider);

  List<PsiDirectory> result = new ArrayList<PsiDirectory>(res.length);
  for(String path : res) {
    VirtualFile virtualFile = project.getBaseDir().findFileByRelativePath(path);
    if(virtualFile == null)
      continue;
    PsiManager manager = PsiManager.getInstance(project);
    PsiDirectory dir = manager.findDirectory(virtualFile);
    if(dir != null)
      result.add(dir);
  }
  return result.toArray(new PsiDirectory[result.size()]);
}
 
開發者ID:catberry,項目名稱:catberry-idea-plugin,代碼行數:22,代碼來源:CatberryProjectConfigurationManager.java

示例6: getUrlsToOpen

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
@Override
public Collection<Url> getUrlsToOpen(@NotNull OpenInBrowserRequest request, boolean preferLocalUrl) throws WebBrowserUrlProvider.BrowserException {
  boolean isHtmlOrXml = isHtmlOrXmlFile(request.getFile().getViewProvider().getBaseLanguage());
  if (!preferLocalUrl || !isHtmlOrXml) {
    DumbService dumbService = DumbService.getInstance(request.getProject());
    for (WebBrowserUrlProvider urlProvider : WebBrowserUrlProvider.EP_NAME.getExtensions()) {
      if ((!dumbService.isDumb() || DumbService.isDumbAware(urlProvider)) && urlProvider.canHandleElement(request)) {
        Collection<Url> urls = getUrls(urlProvider, request);
        if (!urls.isEmpty()) {
          return urls;
        }
      }
    }

    if (!isHtmlOrXml) {
      return Collections.emptyList();
    }
  }

  VirtualFile file = request.getVirtualFile();
  return file instanceof LightVirtualFile || !request.getFile().getViewProvider().isPhysical()
         ? Collections.<Url>emptyList()
         : Collections.singletonList(Urls.newFromVirtualFile(file));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:WebBrowserServiceImpl.java

示例7: getDependences

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public Object[] getDependences() {
  if (myPattern != null) {
    if (DumbService.isDumb(myElement.getProject())) {
      return new Object[] { ModificationTracker.EVER_CHANGED, ExternalResourceManager.getInstance()};
    }
    final Object[] a = { myElement, ExternalResourceManager.getInstance() };
    final PsiElementProcessor.CollectElements<XmlFile> processor = new PsiElementProcessor.CollectElements<XmlFile>();
    RelaxIncludeIndex.processForwardDependencies(myFile, processor);
    if (processor.getCollection().size() > 0) {
      return ArrayUtil.mergeArrays(a, processor.toArray());
    } else {
      return a;
    }
  }
  return new Object[]{ ModificationTracker.EVER_CHANGED };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:RngNsDescriptor.java

示例8: runCheckinHandlers

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void runCheckinHandlers(@NotNull final Runnable finishAction) {
  final VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
  final Collection<VirtualFile> files = myPanel.getVirtualFiles();

  final Runnable performCheckoutAction = new Runnable() {
    @Override
    public void run() {
      FileDocumentManager.getInstance().saveAllDocuments();
      finishAction.run();
    }
  };

  if (configuration.OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT && !DumbService.isDumb(myProject)) {
    new OptimizeImportsProcessor(myProject, CheckinHandlerUtil.getPsiFiles(myProject, files), COMMAND_NAME, performCheckoutAction).run();
  }  else {
    finishAction.run();
  }

}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:OptimizeImportsBeforeCheckinHandler.java

示例9: doGetInnerClasses

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
private PsiClass[] doGetInnerClasses() {
  if (DumbService.isDumb(getProject())) {
    LOG.debug("R_CLASS_AUGMENT: empty because of dumb mode");
    return new PsiClass[0];
  }

  final AndroidFacet facet = AndroidFacet.getInstance(myModule);
  if (facet == null) {
    LOG.debug("R_CLASS_AUGMENT: empty because no facet");
    return new PsiClass[0];
  }

  final Set<ResourceType> types =
      ResourceReferenceConverter.getResourceTypesInCurrentModule(facet);
  final List<PsiClass> result = new ArrayList<>();

  for (ResourceType type : types) {
    result.add(new ResourceTypeClass(facet, type.getName(), this));
  }
  LOG.debug("R_CLASS_AUGMENT: " + result.size() + " classes added");
  return result.toArray(new PsiClass[result.size()]);
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:23,代碼來源:AndroidPackageRClass.java

示例10: getInnerClasses

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
@Override
public PsiClass[] getInnerClasses() {
  if (DumbService.isDumb(getProject())) {
    return new PsiClass[0];
  }

  final AndroidFacet facet = AndroidFacet.getInstance(myModule);
  if (facet == null) {
    return new PsiClass[0];
  }

  final Set<String> types = ResourceReferenceConverter.getResourceTypesInCurrentModule(facet);
  final List<PsiClass> result = new ArrayList<PsiClass>();

  for (String resType : types) {
    result.add(new ResourceTypeClass(facet, resType, this));
  }
  return result.toArray(new PsiClass[result.size()]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:AndroidInMemoryRUtil.java

示例11: update

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void update(AnActionEvent event) {
    Project project = getEventProject(event);
    if (project == null) {
        this.setStatus(event, false);
        return;
    }

    if (DumbService.isDumb(project)) {
        this.setStatus(event, false);
        return;
    }

    DataContext dataContext = event.getDataContext();

    final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
    final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
    final PhpClass targetClass = editor == null || file == null ? null : PhpCodeEditUtil.findClassAtCaret(editor, file);

    if (targetClass == null) {
        setStatus(event, false);
        return;
    }

    if (ExtensionUtility.getExtensionDirectory(event) == null) {
        this.setStatus(event, false);
        return;
    }

    this.setStatus(event, PhpElementsUtil.hasSuperClass(targetClass, "\\TYPO3\\CMS\\Extbase\\Mvc\\Controller\\AbstractController"));
}
 
開發者ID:cedricziel,項目名稱:idea-php-typo3-plugin,代碼行數:31,代碼來源:ExtbaseControllerActionAction.java

示例12: update

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void update(AnActionEvent event) {
    Project project = getEventProject(event);
    if (project == null) {
        this.setStatus(event, false);
        return;
    }

    if (DumbService.isDumb(project)) {
        this.setStatus(event, false);
        return;
    }

    this.setStatus(event, ExtensionUtility.getExtensionDirectory(event) != null);
}
 
開發者ID:cedricziel,項目名稱:idea-php-typo3-plugin,代碼行數:15,代碼來源:NewExtensionFileAction.java

示例13: actionPerformed

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
  EduUsagesCollector.taskChecked();
  Project project = e.getProject();
  if (project == null) {
    return;
  }
  if (DumbService.isDumb(project)) {
    StudyCheckUtils
      .showTestResultPopUp("Checking is not available while indexing is in progress", MessageType.WARNING.getPopupBackground(), project);
    return;
  }
  StudyCheckUtils.hideTestResultsToolWindow(project);
  FileDocumentManager.getInstance().saveAllDocuments();
  Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
  if (editor == null) {
    return;
  }
  VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(editor.getDocument());
  if (virtualFile == null) {
    return;
  }
  Task task = StudyUtils.getTaskForFile(project, virtualFile);
  if (task == null) {
    return;
  }
  for (StudyCheckListener listener : Extensions.getExtensions(StudyCheckListener.EP_NAME)) {
    listener.beforeCheck(project, task);
  }
  ProgressManager.getInstance().run(new StudyCheckTask(project, task));
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:32,代碼來源:StudyCheckAction.java

示例14: actionPerformed

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
    Project project = PsiUtil.getProject(e);
    DumbService dumbService = DumbService.getInstance(project);
    if (dumbService.isDumb()) {
        dumbService.showDumbModeNotification(CodeGenBundle.message("codegen.plugin.is.not.available.during.indexing"));
        return;
    }

    Iterator<DbElement> iterator = DatabaseView.getSelectedElements(e.getDataContext(), DbElement.class).iterator();

    List<DbTable> tables = new ArrayList<>();
    while (iterator.hasNext()) {
        DbElement table = iterator.next();
        if (table instanceof DbTable) {
            tables.add((DbTable) table);
        }
    }

    ColumnEditorFrame frame = new ColumnEditorFrame();
    frame.newColumnEditorByDb(new IdeaContext(project), tables);
    frame.setSize(800, 550);
    frame.setLocationRelativeTo(null);
    frame.setAlwaysOnTop(true);
    frame.setResizable(false);
    frame.setVisible(true);
}
 
開發者ID:hykes,項目名稱:CodeGen,代碼行數:28,代碼來源:DBGeneratorAction.java

示例15: before

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public void before( final List<? extends VFileEvent> events )
{
  if( _project.isDisposed() )
  {
    return;
  }

  DumbService dumb = DumbService.getInstance( _project );
  if( !dumb.isDumb() )
  {
    _before( events );
  }
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:14,代碼來源:FileModificationManager.java


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