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


Java PsiElementBaseIntentionAction类代码示例

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


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

示例1: isAvailableHere

import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction; //导入依赖的package包/类
private static boolean isAvailableHere(Editor editor, PsiFile psiFile, PsiElement psiElement, boolean inProject, IntentionAction action) {
  try {
    Project project = psiFile.getProject();
    if (action instanceof SuppressIntentionActionFromFix) {
      final ThreeState shouldBeAppliedToInjectionHost = ((SuppressIntentionActionFromFix)action).isShouldBeAppliedToInjectionHost();
      if (editor instanceof EditorWindow && shouldBeAppliedToInjectionHost == ThreeState.YES) {
        return false;
      }
      if (!(editor instanceof EditorWindow) && shouldBeAppliedToInjectionHost == ThreeState.NO) {
        return false;
      }
    }
    
    if (action instanceof PsiElementBaseIntentionAction) {
      if (!inProject || psiElement == null || !((PsiElementBaseIntentionAction)action).isAvailable(project, editor, psiElement)) return false;
    }
    else if (!action.isAvailable(project, editor, psiFile)) {
      return false;
    }
  }
  catch (IndexNotReadyException e) {
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ShowIntentionActionsHandler.java

示例2: isAvailableHere

import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction; //导入依赖的package包/类
private static boolean isAvailableHere(Editor editor, PsiFile psiFile, PsiElement psiElement, boolean inProject, IntentionAction action) {
  try {
    Project project = psiFile.getProject();
    if (action instanceof PsiElementBaseIntentionAction) {
      if (!inProject || psiElement == null || !((PsiElementBaseIntentionAction)action).isAvailable(project, editor, psiElement)) return false;
    }
    else if (!action.isAvailable(project, editor, psiFile)) {
      return false;
    }
  }
  catch (IndexNotReadyException e) {
    return false;
  }
  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:ShowIntentionActionsHandler.java

示例3: availableFor

import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction; //导入依赖的package包/类
public static boolean availableFor(@Nonnull PsiFile psiFile, @Nonnull Editor editor, @Nonnull IntentionAction action) {
  if (!psiFile.isValid()) return false;

  int offset = editor.getCaretModel().getOffset();
  PsiElement psiElement = psiFile.findElementAt(offset);
  boolean inProject = psiFile.getManager().isInProject(psiFile);
  try {
    Project project = psiFile.getProject();
    if (action instanceof IntentionActionDelegate) action = ((IntentionActionDelegate)action).getDelegate();
    if (action instanceof IntentionActionDelegate) action = ((IntentionActionDelegate)action).getDelegate();
    if (action instanceof SuppressIntentionActionFromFix) {
      final ThreeState shouldBeAppliedToInjectionHost = ((SuppressIntentionActionFromFix)action).isShouldBeAppliedToInjectionHost();
      if (editor instanceof EditorWindow && shouldBeAppliedToInjectionHost == ThreeState.YES) {
        return false;
      }
      if (!(editor instanceof EditorWindow) && shouldBeAppliedToInjectionHost == ThreeState.NO) {
        return false;
      }
    }

    if (action instanceof PsiElementBaseIntentionAction) {
      if (!inProject || psiElement == null || !((PsiElementBaseIntentionAction)action).isAvailable(project, editor, psiElement)) return false;
    }
    else if (!action.isAvailable(project, editor, psiFile)) {
      return false;
    }
  }
  catch (IndexNotReadyException e) {
    return false;
  }
  return true;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:33,代码来源:ShowIntentionActionsHandler.java


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