當前位置: 首頁>>代碼示例>>Java>>正文


Java PsiField.EMPTY_ARRAY屬性代碼示例

本文整理匯總了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()]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:BrShortNamesCache.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:CompositeShortNamesCache.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:CompositeShortNamesCache.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:DataBindingShortNamesCache.java

示例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);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:DataBindingShortNamesCache.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:BrShortNamesCache.java

示例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()]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:GroovyShortNamesCache.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:56,代碼來源:GroovyGenerateEqualsHandler.java


注:本文中的com.intellij.psi.PsiField.EMPTY_ARRAY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。