向PhpStorm(或其他JetBrains IDE's)添加'意圖'時,如何檢測PsiElement
是否是字符串?我將我的代碼建立在我能找到的唯一意圖示例上。我似乎無法找到適當的文件。這是據我得到:檢查PsiElement是否爲字符串
@NonNls public class SomeIntention extends PsiElementBaseIntentionAction implements IntentionAction {
public boolean isAvailable(@NotNull Project project, Editor editor, @Nullable PsiElement element) {
if (element == null || !(element instanceof /* String? */) {
return false;
}
}
}
instanceof String
顯然是行不通的,但即使使用PsiViewer我無法弄清楚如何測試它是否是一個字符串。