本文整理汇总了Java中com.intellij.openapi.util.Conditions.instanceOf方法的典型用法代码示例。如果您正苦于以下问题:Java Conditions.instanceOf方法的具体用法?Java Conditions.instanceOf怎么用?Java Conditions.instanceOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.Conditions
的用法示例。
在下文中一共展示了Conditions.instanceOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkQualifier
import com.intellij.openapi.util.Conditions; //导入方法依赖的package包/类
private static boolean checkQualifier(PsiElement qualifier) {
if (qualifier == null) {
return true;
}
final Condition<PsiElement> callExpressionCondition = Conditions.instanceOf(PsiCallExpression.class);
final Condition<PsiElement> nonFinalFieldRefCondition = new Condition<PsiElement>() {
@Override
public boolean value(PsiElement expression) {
if (expression instanceof PsiReferenceExpression) {
PsiElement element = ((PsiReferenceExpression)expression).resolve();
if (element instanceof PsiField && !((PsiField)element).hasModifierProperty(PsiModifier.FINAL)) {
return true;
}
}
return false;
}
};
return SyntaxTraverser
.psiTraverser()
.withRoot(qualifier)
.filter(Conditions.or(callExpressionCondition, nonFinalFieldRefCondition)).toList().isEmpty();
}
示例2: checkQualifier
import com.intellij.openapi.util.Conditions; //导入方法依赖的package包/类
public static boolean checkQualifier(@Nullable PsiElement qualifier)
{
if(qualifier == null)
{
return true;
}
final Condition<PsiElement> callExpressionCondition = Conditions.instanceOf(PsiCallExpression.class);
final Condition<PsiElement> nonFinalFieldRefCondition = expression -> {
if(expression instanceof PsiReferenceExpression)
{
PsiElement element = ((PsiReferenceExpression) expression).resolve();
if(element instanceof PsiField && !((PsiField) element).hasModifierProperty(PsiModifier.FINAL))
{
return true;
}
}
return false;
};
return SyntaxTraverser.psiTraverser().withRoot(qualifier).filter(Conditions.or(callExpressionCondition, nonFinalFieldRefCondition)).toList().isEmpty();
}
示例3: JavaNewModuleBuilderPanel
import com.intellij.openapi.util.Conditions; //导入方法依赖的package包/类
public JavaNewModuleBuilderPanel()
{
super(new VerticalFlowLayout());
ProjectSdksModel sdksModel = new ProjectSdksModel();
sdksModel.reset();
myComboBox = new SdkComboBox(sdksModel, Conditions.instanceOf(JavaSdk.class), false);
add(LabeledComponent.create(myComboBox, "JDK").setLabelLocation(BorderLayout.WEST));
}