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


Java DumbService.getInstance方法代碼示例

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


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

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

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

示例3: commitAndRunInSmartMode

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
private static void commitAndRunInSmartMode(final Runnable runnable, final Project project) {
  while (true) {
    final DumbService dumbService = DumbService.getInstance(project);
    dumbService.waitForSmartMode();
    boolean passed = PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Computable<Boolean>() {
      @Override
      public Boolean compute() {
        if (dumbService.isDumb()) return false;
        runnable.run();
        return true;
      }
    });
    if (passed) {
      break;
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:AnalysisScope.java

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

示例5: createJavaParameters

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
  final JavaParameters javaParameters = super.createJavaParameters();
  final JUnitConfiguration.Data data = getConfiguration().getPersistentData();
  final DumbService dumbService = DumbService.getInstance(getConfiguration().getProject());
  try {
    dumbService.setAlternativeResolveEnabled(true);
    getClassFilter(data);//check if junit found
  }
  finally {
    dumbService.setAlternativeResolveEnabled(false);
  }
  createTempFiles(javaParameters);

  createServerSocket(javaParameters);
  return javaParameters;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:TestPackage.java

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

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

示例8: filteredFinders

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@NotNull
private PsiElementFinder[] filteredFinders() {
  DumbService dumbService = DumbService.getInstance(getProject());
  PsiElementFinder[] finders = finders();
  if (dumbService.isDumb()) {
    List<PsiElementFinder> list = dumbService.filterByDumbAwareness(finders);
    finders = list.toArray(new PsiElementFinder[list.size()]);
  }
  return finders;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:JavaPsiFacadeImpl.java

示例9: isDumbMode

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
private boolean isDumbMode() {
  final DumbService dumbService = DumbService.getInstance(myProject);
  boolean isDumb = dumbService.isDumb();
  if (isDumb) {
    // wait some time
    for (int idx = 0; idx < 5; idx++) {
      TimeoutUtil.sleep(10L);
      isDumb = dumbService.isDumb();
      if (!isDumb) {
        break;
      }
    }
  }
  return isDumb;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:DefaultMessageHandler.java

示例10: DefaultHighlightVisitor

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
public DefaultHighlightVisitor(@NotNull Project project, boolean highlightErrorElements, boolean runAnnotators, boolean batchMode) {
  myProject = project;
  myHighlightErrorElements = highlightErrorElements;
  myRunAnnotators = runAnnotators;
  myErrorFilters = Extensions.getExtensions(HighlightErrorFilter.EP_NAME, project);
  myDumbService = DumbService.getInstance(project);
  myBatchMode = batchMode;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:DefaultHighlightVisitor.java

示例11: navigate

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void navigate(@Nullable final MouseEvent event, @Nullable final PsiElement elt) {
  final List<PsiElement> list;

  DumbService dumbService = elt != null ? DumbService.getInstance(elt.getProject()) : null;
  if (dumbService != null) dumbService.setAlternativeResolveEnabled(true);
  try {
    list = getTargetElements();
  }
  finally {
    if (dumbService != null) dumbService.setAlternativeResolveEnabled(false);
  }
  
  if (list.isEmpty()) {
    if (myEmptyText != null) {
      if (event != null) {
        final JComponent label = HintUtil.createErrorLabel(myEmptyText);
        label.setBorder(IdeBorderFactory.createEmptyBorder(2, 7, 2, 7));
        JBPopupFactory.getInstance().createBalloonBuilder(label)
          .setFadeoutTime(3000)
          .setFillColor(HintUtil.ERROR_COLOR)
          .createBalloon()
          .show(new RelativePoint(event), Balloon.Position.above);
      }
    }
    return;
  }
  if (list.size() == 1) {
    PsiNavigateUtil.navigate(list.iterator().next());
  }
  else {
    if (event != null) {
      final JBPopup popup = NavigationUtil.getPsiElementPopup(PsiUtilCore.toPsiElementArray(list), myCellRenderer.compute(), myPopupTitle);
      popup.show(new RelativePoint(event));
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:38,代碼來源:NavigationGutterIconRenderer.java

示例12: getProvider

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Nullable
public static WebBrowserUrlProvider getProvider(@NotNull OpenInBrowserRequest request) {
  DumbService dumbService = DumbService.getInstance(request.getProject());
  for (WebBrowserUrlProvider urlProvider : WebBrowserUrlProvider.EP_NAME.getExtensions()) {
    if ((!dumbService.isDumb() || DumbService.isDumbAware(urlProvider)) && urlProvider.canHandleElement(request)) {
      return urlProvider;
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:WebBrowserServiceImpl.java

示例13: afterSync

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void afterSync(
    Project project, BlazeContext context, SyncMode syncMode, SyncResult syncResult) {
  if (syncResult.successful()) {
    DumbService dumbService = DumbService.getInstance(project);
    dumbService.queueTask(new ResourceFolderRegistry.PopulateCachesTask(project));
  }
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:9,代碼來源:BlazeAndroidSyncListener.java

示例14: processTypeVars

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
private String processTypeVars( PsiDirectory dir, String fqnExtended, Function<PsiTypeParameter,String> processor )
{
  boolean alt = false;
  DumbService dumbService = DumbService.getInstance( dir.getProject() );
  if( dumbService.isDumb() )
  {
    dumbService.setAlternativeResolveEnabled( alt = true );
  }
  try
  {
    PsiClass extendedClass = JavaPsiFacadeEx.getInstanceEx( dir.getProject() ).findClass( fqnExtended );
    if( extendedClass == null )
    {
      return "";
    }
    PsiTypeParameter[] typeParameters = extendedClass.getTypeParameters();
    if( typeParameters.length == 0 )
    {
      return "";
    }

    StringBuilder sb = new StringBuilder();
    sb.append( "<" );
    for( int i = 0; i < typeParameters.length; i++ )
    {
      PsiTypeParameter tp = typeParameters[i];
      if( i > 0 )
      {
        sb.append( ", " );
      }
      sb.append( processor.fun( tp ) );
    }
    sb.append( "> " );
    return sb.toString();
  }
  finally
  {
    if( alt )
    {
      dumbService.setAlternativeResolveEnabled( false );
    }
  }
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:44,代碼來源:CreateExtensionMethodsClassAction.java

示例15: run

import com.intellij.openapi.project.DumbService; //導入方法依賴的package包/類
@Override
public void run() {
    final DumbService dumbService = DumbService.getInstance(myProject);
    if (dumbService.isDumb()) dumbService.runWhenSmart(new InitRunnable());
    else init(myProject);
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:7,代碼來源:LuaPsiManager.java


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