本文整理汇总了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;
}
示例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;
}
示例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;
}