本文整理匯總了Java中com.intellij.psi.PsiField.EMPTY_ARRAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java PsiField.EMPTY_ARRAY屬性的具體用法?Java PsiField.EMPTY_ARRAY怎麽用?Java PsiField.EMPTY_ARRAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.intellij.psi.PsiField
的用法示例。
在下文中一共展示了PsiField.EMPTY_ARRAY屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFieldsByName
@NotNull
@Override
public PsiField[] getFieldsByName(@NotNull @NonNls String name, @NotNull GlobalSearchScope scope) {
if (!isMyScope(scope)) {
return PsiField.EMPTY_ARRAY;
}
PsiClass[] psiClasses = filterByScope(myComponent.getDataBindingEnabledFacets(), scope);
if (psiClasses.length == 0) {
return PsiField.EMPTY_ARRAY;
}
List<PsiField> result = Lists.newArrayList();
for (PsiClass psiClass : psiClasses) {
PsiField field = psiClass.findFieldByName(name, false);
if (field != null) {
result.add(field);
}
}
return result.toArray(new PsiField[result.size()]);
}
示例2: getFieldsByNameIfNotMoreThan
@NotNull
@Override
public PsiField[] getFieldsByNameIfNotMoreThan(@NonNls @NotNull String name, @NotNull GlobalSearchScope scope, int maxCount) {
Merger<PsiField> merger = null;
for (PsiShortNamesCache cache : myCaches) {
PsiField[] fields = cache.getFieldsByNameIfNotMoreThan(name, scope, maxCount);
if (fields.length == maxCount) return fields;
if (fields.length != 0) {
if (merger == null) merger = new Merger<PsiField>();
merger.add(fields);
}
}
PsiField[] result = merger == null ? null : merger.getResult();
return result == null ? PsiField.EMPTY_ARRAY : result;
}
示例3: getFieldsByName
@Override
@NotNull
public PsiField[] getFieldsByName(@NotNull String name, @NotNull GlobalSearchScope scope) {
Merger<PsiField> merger = null;
for (PsiShortNamesCache cache : myCaches) {
PsiField[] classes = cache.getFieldsByName(name, scope);
if (classes.length != 0) {
if (merger == null) merger = new Merger<PsiField>();
merger.add(classes);
}
}
PsiField[] result = merger == null ? null : merger.getResult();
return result == null ? PsiField.EMPTY_ARRAY : result;
}
示例4: getFieldsByNameIfNotMoreThan
@NotNull
@Override
public PsiField[] getFieldsByNameIfNotMoreThan(@NonNls @NotNull String name, @NotNull GlobalSearchScope scope, int maxCount) {
if (!myComponent.hasAnyDataBindingEnabledFacet()) {
return PsiField.EMPTY_ARRAY;
}
List<PsiField> psiFields = myFieldsByNameCache.getValue().get(name);
PsiField[] selected = filterByScope(psiFields, scope, PsiField.class, PsiField.EMPTY_ARRAY);
if (selected.length > maxCount) {
return PsiField.EMPTY_ARRAY;
}
return selected;
}
示例5: getFieldsByName
@NotNull
@Override
public PsiField[] getFieldsByName(@NotNull @NonNls String name, @NotNull GlobalSearchScope scope) {
if (!myComponent.hasAnyDataBindingEnabledFacet()) {
return PsiField.EMPTY_ARRAY;
}
List<PsiField> psiFields = myFieldsByNameCache.getValue().get(name);
return filterByScope(psiFields, scope, PsiField.class, PsiField.EMPTY_ARRAY);
}
示例6: getFieldsByNameIfNotMoreThan
@NotNull
@Override
public PsiField[] getFieldsByNameIfNotMoreThan(@NonNls @NotNull String name, @NotNull GlobalSearchScope scope, int maxCount) {
PsiField[] fields = getFieldsByName(name, scope);
if (fields.length > maxCount) {
return PsiField.EMPTY_ARRAY;
}
return fields;
}
示例7: getFieldsByName
@Override
@NotNull
public PsiField[] getFieldsByName(@NotNull @NonNls String name, @NotNull GlobalSearchScope scope) {
final Collection<? extends PsiField> fields = StubIndex.getElements(GrFieldNameIndex.KEY, name, myProject,
new GrSourceFilterScope(scope), GrField.class);
if (fields.isEmpty()) return PsiField.EMPTY_ARRAY;
return fields.toArray(new PsiField[fields.size()]);
}
示例8: chooseOriginalMembers
@Override
@Nullable
protected ClassMember[] chooseOriginalMembers(PsiClass aClass, Project project) {
myEqualsFields = null;
myHashCodeFields = null;
myNonNullFields = PsiField.EMPTY_ARRAY;
GlobalSearchScope scope = aClass.getResolveScope();
final PsiMethod equalsMethod = GroovyGenerateEqualsHelper
.findMethod(aClass, GroovyGenerateEqualsHelper.getEqualsSignature(project, scope));
final PsiMethod hashCodeMethod = GroovyGenerateEqualsHelper.findMethod(aClass, GroovyGenerateEqualsHelper.getHashCodeSignature());
boolean needEquals = equalsMethod == null;
boolean needHashCode = hashCodeMethod == null;
if (!needEquals && !needHashCode) {
String text = aClass instanceof PsiAnonymousClass
? GroovyCodeInsightBundle.message("generate.equals.and.hashcode.already.defined.warning.anonymous")
: GroovyCodeInsightBundle.message("generate.equals.and.hashcode.already.defined.warning", aClass.getQualifiedName());
if (Messages.showYesNoDialog(project, text,
GroovyCodeInsightBundle.message("generate.equals.and.hashcode.already.defined.title"),
Messages.getQuestionIcon()) == Messages.YES) {
if (!ApplicationManager.getApplication().runWriteAction(new Computable<Boolean>() {
@Override
public Boolean compute() {
try {
equalsMethod.delete();
hashCodeMethod.delete();
return Boolean.TRUE;
}
catch (IncorrectOperationException e) {
LOG.error(e);
return Boolean.FALSE;
}
}
}).booleanValue()) {
return null;
}
else {
needEquals = needHashCode = true;
}
}
else {
return null;
}
}
GenerateEqualsWizard wizard = new GenerateEqualsWizard(project, aClass, needEquals, needHashCode);
if (!wizard.showAndGet()) {
return null;
}
myEqualsFields = wizard.getEqualsFields();
myHashCodeFields = wizard.getHashCodeFields();
myNonNullFields = wizard.getNonNullFields();
return DUMMY_RESULT;
}