当前位置: 首页>>代码示例>>Java>>正文


Java IndexNotReadyException类代码示例

本文整理汇总了Java中com.intellij.openapi.project.IndexNotReadyException的典型用法代码示例。如果您正苦于以下问题:Java IndexNotReadyException类的具体用法?Java IndexNotReadyException怎么用?Java IndexNotReadyException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IndexNotReadyException类属于com.intellij.openapi.project包,在下文中一共展示了IndexNotReadyException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的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

示例2: getExpressionRangeAtOffset

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
@Nullable
@Override
public TextRange getExpressionRangeAtOffset(final Project project, final Document document, final int offset, final boolean sideEffectsAllowed) {
    final Ref<TextRange> currentRange = Ref.create(null);
    PsiDocumentManager.getInstance(project).commitAndRunReadAction(() -> {
        try {
            PsiElement elementAtCursor = XDebuggerUtil.getInstance().findContextElement(PsiDocumentManager
                    .getInstance(project).getPsiFile(document).getVirtualFile(), offset, project, false);
            if (elementAtCursor == null) return;
            Pair<PsiElement, TextRange> pair = findExpression(elementAtCursor, sideEffectsAllowed);
            if (pair != null) {
                currentRange.set(pair.getSecond());
            }
        } catch (IndexNotReadyException ignored) {}
    });
    return currentRange.get();
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:18,代码来源:LuaDebuggerEvaluator.java

示例3: isImplementingLambdaMethod

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
private static boolean isImplementingLambdaMethod(PsiClass baseClass) {
  if (!baseClass.hasModifierProperty(PsiModifier.ABSTRACT)) return false;

  for (final PsiMethod method : baseClass.getMethods()) {
    if (method.hasModifierProperty(PsiModifier.ABSTRACT)) {
      return true;
    }
  }

  try {
    return !OverrideImplementExploreUtil.getMethodSignaturesToImplement(baseClass).isEmpty();
  }
  catch (IndexNotReadyException e) {
    return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaFoldingBuilderBase.java

示例4: getExpressionRangeAtOffset

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
@Nullable
@Override
public TextRange getExpressionRangeAtOffset(final Project project, final Document document, final int offset, final boolean sideEffectsAllowed) {
  final Ref<TextRange> currentRange = Ref.create(null);
  PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Runnable() {
    @Override
    public void run() {
      try {
        PsiElement elementAtCursor = DebuggerUtilsEx.findElementAt(PsiDocumentManager.getInstance(project).getPsiFile(document), offset);
        if (elementAtCursor == null) {
          return;
        }
        Pair<PsiElement, TextRange> pair = findExpression(elementAtCursor, sideEffectsAllowed);
        if (pair != null) {
          currentRange.set(pair.getSecond());
        }
      } catch (IndexNotReadyException ignored) {}
    }
  });
  return currentRange.get();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaDebuggerEvaluator.java

示例5: getPsiField

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
public PsiField getPsiField() {
  final SourcePosition sourcePosition = getSourcePosition();
  try {
    final PsiField field = ApplicationManager.getApplication().runReadAction(new Computable<PsiField>() {
      @Override
      public PsiField compute() {
        final PsiClass psiClass = getPsiClassAt(sourcePosition);
        return psiClass != null ? psiClass.findFieldByName(getFieldName(), true) : null;
      }
    });
    if (field != null) {
      return field;
    }
  } catch (IndexNotReadyException ignored) {}
  return PositionUtil.getPsiElementAt(getProject(), PsiField.class, sourcePosition);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FieldBreakpoint.java

示例6: visitMethodCallExpression

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
@Override
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
  if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkEnumSuperConstructorCall(expression));
  if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkSuperQualifierType(myFile.getProject(), expression));
  // in case of JSP synthetic method call, do not check
  if (myFile.isPhysical() && !myHolder.hasErrorResults()) {
    try {
      myHolder.add(HighlightMethodUtil.checkMethodCall(expression, myResolveHelper, myLanguageLevel,myJavaSdkVersion));
    }
    catch (IndexNotReadyException ignored) { }
  }

  if (!myHolder.hasErrorResults()) myHolder.add(HighlightMethodUtil.checkConstructorCallMustBeFirstStatement(expression));
  if (!myHolder.hasErrorResults()) myHolder.add(HighlightMethodUtil.checkSuperAbstractMethodDirectCall(expression));

  if (!myHolder.hasErrorResults()) visitExpression(expression);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:HighlightVisitorImpl.java

示例7: visitNewExpression

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
@Override
public void visitNewExpression(PsiNewExpression expression) {
  final PsiType type = expression.getType();
  final PsiClass aClass = PsiUtil.resolveClassInType(type);
  myHolder.add(HighlightUtil.checkUnhandledExceptions(expression, null));
  if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkAnonymousInheritFinal(expression));
  if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkQualifiedNew(expression, type, aClass));
  if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkCreateInnerClassFromStaticContext(expression, type, aClass));
  if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkTypeParameterInstantiation(expression));
  if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkInstantiationOfAbstractClass(aClass, expression));
  try {
    if (!myHolder.hasErrorResults()) HighlightMethodUtil.checkNewExpression(expression, type, myHolder, myJavaSdkVersion);
  }
  catch (IndexNotReadyException ignored) { }
  if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkEnumInstantiation(expression, aClass));
  if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkGenericArrayCreation(expression, type));
  if (!myHolder.hasErrorResults()) registerConstructorCall(expression);

  if (!myHolder.hasErrorResults()) visitExpression(expression);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HighlightVisitorImpl.java

示例8: isReassigned

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
private boolean isReassigned(@NotNull PsiVariable variable) {
  try {
    boolean reassigned;
    if (variable instanceof PsiParameter) {
      reassigned = myReassignedParameters.get((PsiParameter)variable) == 2;
    }
    else  {
      reassigned = HighlightControlFlowUtil.isReassigned(variable, myFinalVarProblems);
    }

    return reassigned;
  }
  catch (IndexNotReadyException e) {
    return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:HighlightVisitorImpl.java

示例9: checkUnreachableStatement

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
static HighlightInfo checkUnreachableStatement(@Nullable PsiCodeBlock codeBlock) {
  if (codeBlock == null) return null;
  // do not compute constant expressions for if() statement condition
  // see JLS 14.20 Unreachable Statements
  try {
    AllVariablesControlFlowPolicy policy = AllVariablesControlFlowPolicy.getInstance();
    final ControlFlow controlFlow = ControlFlowFactory.getInstance(codeBlock.getProject()).getControlFlow(codeBlock, policy, false, false);
    final PsiElement unreachableStatement = ControlFlowUtil.getUnreachableStatement(controlFlow);
    if (unreachableStatement != null) {
      String description = JavaErrorMessages.message("unreachable.statement");
      return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(unreachableStatement).descriptionAndTooltip(description).create();
    }
  }
  catch (AnalysisCanceledException e) {
    // incomplete code
  }
  catch (IndexNotReadyException ignored) {
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HighlightControlFlowUtil.java

示例10: getClassPosition

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
public static int getClassPosition(final PsiClass aClass) {
  if (aClass == null || !aClass.isValid()) {
    return 0;
  }
  try {
    int pos = aClass instanceof JspClass ? ElementPresentationUtil.CLASS_KIND_JSP : ElementPresentationUtil.getClassKind(aClass);
    //abstract class before concrete
    if (pos == ElementPresentationUtil.CLASS_KIND_CLASS || pos == ElementPresentationUtil.CLASS_KIND_EXCEPTION) {
      boolean isAbstract = aClass.hasModifierProperty(PsiModifier.ABSTRACT) && !aClass.isInterface();
      if (isAbstract) {
        pos --;
      }
    }
    return pos;
  }
  catch (IndexNotReadyException e) {
    return 0;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ClassTreeNode.java

示例11: showSettings

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
@NotNull
private AnAction showSettings() {
  final ConfigurableUsageTarget configurableUsageTarget = getConfigurableTarget(myTargets);
  String description = null;
  try {
    description = configurableUsageTarget == null ? null : "Show settings for "+configurableUsageTarget.getLongDescriptiveName();
  }
  catch (IndexNotReadyException ignored) {
  }
  if (description == null) {
    description = "Show find usages settings dialog";
  }
  return new AnAction("Settings...", description, AllIcons.General.ProjectSettings) {
    {
      KeyboardShortcut shortcut = configurableUsageTarget == null ? getShowUsagesWithSettingsShortcut() : configurableUsageTarget.getShortcut();
      if (shortcut != null) {
        registerCustomShortcutSet(new CustomShortcutSet(shortcut), getComponent());
      }
    }
    @Override
    public void actionPerformed(AnActionEvent e) {
      FindManager.getInstance(getProject()).showSettingsAndFindUsages(myTargets);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:UsageViewImpl.java

示例12: ApplyAction

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
public ApplyAction() {
  super(CommonBundle.getApplyButtonText());
  final Runnable updateRequest = new Runnable() {
    @Override
    public void run() {
      if (!isShowing()) return;
      try {
        setEnabled(myConfigurable != null && myConfigurable.isModified());
      }
      catch (IndexNotReadyException ignored) {
      }
      addUpdateRequest(this);
    }
  };

  // invokeLater necessary to make sure dialog is already shown so we calculate modality state correctly.
  SwingUtilities.invokeLater(new Runnable() {
    @Override
    public void run() {
      addUpdateRequest(updateRequest);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SingleConfigurableEditor.java

示例13: update

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
public void update(AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    presentation.setEnabled(false);
    // make it invisible only in main menu to avoid initial invisibility in toolbars
    presentation.setVisible(!ActionPlaces.isMainMenuOrActionSearch(event.getPlace()));
    return;
  }
  OccurenceNavigator navigator = getNavigator(event.getDataContext());
  if (navigator == null) {
    presentation.setEnabled(false);
    // make it invisible only in main menu to avoid initial invisibility in toolbars
    presentation.setVisible(!ActionPlaces.isMainMenuOrActionSearch(event.getPlace()));
    return;
  }
  presentation.setVisible(true);
  try {
    presentation.setEnabled(hasOccurenceToGo(navigator));
    presentation.setText(getDescription(navigator));
  }
  catch (IndexNotReadyException e) {
    presentation.setEnabled(false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:OccurenceNavigatorActionBase.java

示例14: getSelection

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
@Nullable
public static VcsSelection getSelection(VcsContext context) {

  VcsSelection selectionFromEditor = getSelectionFromEditor(context);
  if (selectionFromEditor != null) {
    return selectionFromEditor;
  }
  for(VcsSelectionProvider provider: Extensions.getExtensions(VcsSelectionProvider.EP_NAME)) {
    try {
      final VcsSelection vcsSelection = provider.getSelection(context);
      if (vcsSelection != null) return vcsSelection;
    }
    catch (IndexNotReadyException ignored) {
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:VcsSelectionUtil.java

示例15: searchDefinitions

import com.intellij.openapi.project.IndexNotReadyException; //导入依赖的package包/类
@Nullable("For the case the search has been cancelled")
protected PsiElement[] searchDefinitions(final PsiElement element, final Editor editor) {
  final PsiElement[][] result = new PsiElement[1][];
  if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    @Override
    public void run() {
      try {
        result[0] = DefinitionsScopedSearch.search(element, getSearchScope(element, editor)).toArray(PsiElement.EMPTY_ARRAY);
      }
      catch (IndexNotReadyException e) {
        dumbModeNotification(element);
        result[0] = null;
      }
    }
  }, SEARCHING_FOR_IMPLEMENTATIONS, true, element.getProject())) {
    return null;
  }
  return result[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ImplementationSearcher.java


注:本文中的com.intellij.openapi.project.IndexNotReadyException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。