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


Java DumbService類代碼示例

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


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

示例1: perform

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
@Override
public void perform(Project project, MavenEmbeddersManager mavenEmbeddersManager,
    MavenConsole mavenConsole, MavenProgressIndicator mavenProgressIndicator) {
  debug(() -> log.debug(
      "Project imported successfully, will trigger indexing via dumbservice for project "
          + project.getName()));
  DumbService.getInstance(project).smartInvokeLater(() -> {
    log.debug("Will attempt to trigger indexing for project " + project.getName());

    try {
      SuggestionIndexService service =
          ServiceManager.getService(project, SuggestionIndexService.class);

      if (!service.canProvideSuggestions(project, module)) {
        service.reindex(project, module);
      } else {
        debug(() -> log.debug(
            "Index is already built, no point in rebuilding index for project " + project
                .getName()));
      }
    } catch (Throwable e) {
      log.error("Error occurred while indexing project " + project.getName(), e);
    }
  });
}
 
開發者ID:1tontech,項目名稱:intellij-spring-assistant,代碼行數:26,代碼來源:MavenProcessorTask.java

示例2: 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

示例3: getType

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
@Nullable
@Override
public PhpType getType(PsiElement psiElement) {
    if (DumbService.getInstance(psiElement.getProject()).isDumb()) {
        return null;
    }

    if (!(psiElement instanceof MethodReference) || !PhpElementsUtil.isMethodWithFirstStringOrFieldReference(psiElement, "get")) {
        return null;
    }

    MethodReference methodReference = (MethodReference) psiElement;
    if (methodReference.getParameters().length == 0) {
        return null;
    }

    PsiElement firstParam = methodReference.getParameters()[0];
    if (firstParam instanceof PhpReference) {
        PhpReference ref = (PhpReference) firstParam;
        if (ref.getText().toLowerCase().contains("::class")) {
            return new PhpType().add("#" + this.getKey() + ref.getSignature());
        }
    }

    return null;
}
 
開發者ID:cedricziel,項目名稱:idea-php-typo3-plugin,代碼行數:27,代碼來源:ObjectManagerTypeProvider.java

示例4: smartInvokeAndWait

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
public static void smartInvokeAndWait(final Project p, final ModalityState state, final Runnable r) {
    if (isNoBackgroundMode() || ApplicationManager.getApplication().isDispatchThread()) {
        r.run();
    } else {
        final Semaphore semaphore = new Semaphore();
        semaphore.down();
        DumbService.getInstance(p).smartInvokeLater(() -> {
            try {
                r.run();
            } finally {
                semaphore.up();
            }
        }, state);
        semaphore.waitFor();
    }
}
 
開發者ID:seedstack,項目名稱:intellij-plugin,代碼行數:17,代碼來源:NavigatorUtil.java

示例5: commit

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
@Nullable
@Override
public List<Module> commit(Project project,
                           ModifiableModuleModel modifiableModuleModel,
                           ModulesProvider modulesProvider,
                           ModifiableArtifactModel modifiableArtifactModel) {

    logger.debug("Initializing module builder instance.");
    ProcessingModuleBuilder processingModuleBuilder = new ProcessingModuleBuilder();
    processingModuleBuilder.setGenerateTemplateSketchClass(false);

    logger.debug("Creating modules for project '" + project + "' at path '" + getParameters().projectCreationRoot + "'.");

    List<Module> modules = processingModuleBuilder.commit(project, modifiableModuleModel, modulesProvider);

    Collection<VirtualFile> importablePdeFiles = new LinkedList<>(getParameters().importablePdeFiles);

    logger.info("Identified a total of " + importablePdeFiles.size() + " PDE files for import from '" + getParameters().root + "'.");

    ImportSketchClasses importSketchClasses = new ImportSketchClasses(this, project, modules, importablePdeFiles);
    DumbService.getInstance(project).smartInvokeLater(importSketchClasses);

    return modules;
}
 
開發者ID:mistodev,項目名稱:processing-idea,代碼行數:25,代碼來源:ProcessingImportBuilder.java

示例6: 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

示例7: 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

示例8: annotate

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
@Override
public void annotate( PsiElement element, AnnotationHolder holder )
{
  if( DumbService.getInstance( element.getProject() ).isDumb() )
  {
    // skip processing during index rebuild
    return;
  }

  PsiClass psiExtensionClass = findExtensionClass( element );

  if( psiExtensionClass != null )
  {
    // The enclosing class a @Extension class, verify usage of @This etc.

    verifyPackage( element, holder );
    verifyExtensionInterfaces( element, holder );
    verifyExtensionMethods( element, holder );
  }
  else
  {
    // The enclosing class is *not* an extension class; usage of @This or @Extension on methods are errors

    errrantThisOrExtension( element, holder );
  }
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:27,代碼來源:ExtensionClassAnnotator.java

示例9: findClasses

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
@Override
public PsiClass[] findClasses( String fqn, GlobalSearchScope globalSearchScope )
{
  //System.out.println( "PsiClass[] findClasses() : " + fqn + " : " + globalSearchScope );

  if( DumbService.getInstance( globalSearchScope.getProject() ).isDumb() )
  {
    // skip processing during index rebuild
    return PsiClass.EMPTY_ARRAY;
  }

  List<PsiClass> psiClasses = new ArrayList<>();
  List<ManModule> modules = findModules( globalSearchScope );
  for( ManModule m : modules )
  {
    PsiClass psiClass = ManifoldPsiClassCache.instance().getPsiClass( globalSearchScope, m, fqn );
    if( psiClass != null )
    {
      psiClasses.add( psiClass );
    }
  }
  return psiClasses.toArray( new PsiClass[psiClasses.size()] );
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:24,代碼來源:ManTypeFinder.java

示例10: findClass

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
@Override
public PsiClass findClass( String fqn, GlobalSearchScope globalSearchScope )
{
  //System.out.println( "findClass() : " + fqn + " : " + globalSearchScope );

  if( DumbService.getInstance( globalSearchScope.getProject() ).isDumb() )
  {
    // skip processing during index rebuild
    return null;
  }

  List<ManModule> modules = findModules( globalSearchScope );

  for( ManModule m : modules )
  {
    PsiClass psiClass = ManifoldPsiClassCache.instance().getPsiClass( globalSearchScope, m, fqn );
    if( psiClass != null )
    {
      return psiClass;
    }
  }
  return null;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:24,代碼來源:ManTypeFinder.java

示例11: actionPerformed

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    final Editor editor = e.getRequiredData(CommonDataKeys.EDITOR);
    final PsiFile psiFile = e.getRequiredData(CommonDataKeys.PSI_FILE);
    
    CommandProcessor.getInstance().executeCommand(project, () -> {
        try {
            MultiHighlightHandler.invoke(project, editor, psiFile);
        } catch (IndexNotReadyException ex) {
            DumbService.getInstance(project)
                    .showDumbModeNotification("MultiHighlight requires indices "
                            + "and cannot be performed until they are built");
        }
    }, "MultiHighlight", null);
}
 
開發者ID:huoguangjin,項目名稱:MultiHighlight,代碼行數:17,代碼來源:MultiHighlightAction.java

示例12: getMuleHome

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
@Nullable
private static String getMuleHome(@NotNull Module module) {
    if (!DumbService.isDumb(module.getProject())) {
        final OrderEnumerator enumerator = ModuleRootManager.getInstance(module)
                .orderEntries().recursively().librariesOnly().exportedOnly();
        final String[] home = new String[1];
        enumerator.forEachLibrary(library -> {
            if (MuleLibraryKind.MULE_LIBRARY_KIND.equals(((LibraryEx) library).getKind()) &&
                    library.getFiles(OrderRootType.CLASSES) != null &&
                    library.getFiles(OrderRootType.CLASSES).length > 0) {
                home[0] = getMuleHome(library.getFiles(OrderRootType.CLASSES)[0]);
                return false;
            } else {
                return true;
            }
        });

        return home[0];
    }
    return null;
}
 
開發者ID:machaval,項目名稱:mule-intellij-plugins,代碼行數:22,代碼來源:MuleSdk.java

示例13: 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

示例14: 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

示例15: EditorGutterComponentImpl

import com.intellij.openapi.project.DumbService; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public EditorGutterComponentImpl(EditorImpl editor) {
  myEditor = editor;
  myLineNumberConvertor = ID;
  if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
    installDnD();
  }
  setOpaque(true);
  myAnchorsDisplayStrategy = new FoldingAnchorsOverlayStrategy(editor);

  Project project = myEditor.getProject();
  if (project != null) {
    project.getMessageBus().connect(myEditor.getDisposable()).subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
      @Override
      public void enteredDumbMode() {
      }

      @Override
      public void exitDumbMode() {
        updateSize();
      }
    });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:EditorGutterComponentImpl.java


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