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


Java DefaultConstructorImplicitUsageInfo類代碼示例

本文整理匯總了Java中com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo的典型用法代碼示例。如果您正苦於以下問題:Java DefaultConstructorImplicitUsageInfo類的具體用法?Java DefaultConstructorImplicitUsageInfo怎麽用?Java DefaultConstructorImplicitUsageInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DefaultConstructorImplicitUsageInfo類屬於com.intellij.refactoring.util.usageInfo包,在下文中一共展示了DefaultConstructorImplicitUsageInfo類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldPropagateToNonPhysicalMethod

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
private static boolean shouldPropagateToNonPhysicalMethod(PsiMethod method,
                                                          ArrayList<UsageInfo> result,
                                                          PsiClass containingClass,
                                                          final Set<PsiMethod> propagateMethods) {
  for (PsiMethod psiMethod : propagateMethods) {
    if (!psiMethod.isPhysical() && Comparing.strEqual(psiMethod.getName(), containingClass.getName())) {
      result.add(new DefaultConstructorImplicitUsageInfo(psiMethod, containingClass, method));
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:JavaChangeSignatureUsageSearcher.java

示例2: isMethodInUsages

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
public static boolean isMethodInUsages(IntroduceParameterData data, PsiMethod method, UsageInfo[] usages) {
  PsiManager manager = PsiManager.getInstance(data.getProject());
  for (UsageInfo info : usages) {
    if (!(info instanceof DefaultConstructorImplicitUsageInfo) &&  manager.areElementsEquivalent(info.getElement(), method)) {
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:IntroduceParameterUtil.java

示例3: findUsages

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
@NotNull
@Override
protected UsageInfo[] findUsages() {
  List<UsageInfo> result = new ArrayList<UsageInfo>();

  final PsiMethod toSearchFor = (PsiMethod)myHelper.getToSearchFor();

  for (PsiReference ref1 : MethodReferencesSearch.search(toSearchFor, GlobalSearchScope.projectScope(myProject), true)) {
    PsiElement ref = ref1.getElement();
    if (ref.getLanguage() != GroovyLanguage.INSTANCE) {
      result.add(new OtherLanguageUsageInfo(ref1));
      continue;
    }

    if (ref instanceof PsiMethod && ((PsiMethod)ref).isConstructor()) {
      DefaultConstructorImplicitUsageInfo implicitUsageInfo =
        new DefaultConstructorImplicitUsageInfo((PsiMethod)ref, ((PsiMethod)ref).getContainingClass(), toSearchFor);
      result.add(implicitUsageInfo);
    }
    else if (ref instanceof PsiClass) {
      result.add(new NoConstructorClassUsageInfo((PsiClass)ref));
    }
    else if (!PsiTreeUtil.isAncestor(myMethod, ref, false)) {
      result.add(new ExternalUsageInfo(ref));
    }
    else {
      result.add(new ChangedMethodCallInfo(ref));
    }
  }

  Collection<PsiMethod> overridingMethods = OverridingMethodsSearch.search(toSearchFor, true).findAll();

  for (PsiMethod overridingMethod : overridingMethods) {
    result.add(new UsageInfo(overridingMethod));
  }

  final UsageInfo[] usageInfos = result.toArray(new UsageInfo[result.size()]);
  return UsageViewUtil.removeDuplicatedUsages(usageInfos);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:40,代碼來源:ExtractClosureFromMethodProcessor.java

示例4: findUsages

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
@NotNull
@Override
protected UsageInfo[] findUsages() {
  List<UsageInfo> result = new ArrayList<UsageInfo>();

  final PsiMethod toSearchFor = (PsiMethod)myHelper.getToSearchFor();

  for (PsiReference ref1 : MethodReferencesSearch.search(toSearchFor, GlobalSearchScope.projectScope(myProject), true)) {
    PsiElement ref = ref1.getElement();
    if (ref.getLanguage() != GroovyFileType.GROOVY_LANGUAGE) {
      result.add(new OtherLanguageUsageInfo(ref1));
      continue;
    }

    if (ref instanceof PsiMethod && ((PsiMethod)ref).isConstructor()) {
      DefaultConstructorImplicitUsageInfo implicitUsageInfo =
        new DefaultConstructorImplicitUsageInfo((PsiMethod)ref, ((PsiMethod)ref).getContainingClass(), toSearchFor);
      result.add(implicitUsageInfo);
    }
    else if (ref instanceof PsiClass) {
      result.add(new NoConstructorClassUsageInfo((PsiClass)ref));
    }
    else if (!PsiTreeUtil.isAncestor(myMethod, ref, false)) {
      result.add(new ExternalUsageInfo(ref));
    }
    else {
      result.add(new ChangedMethodCallInfo(ref));
    }
  }

  Collection<PsiMethod> overridingMethods = OverridingMethodsSearch.search(toSearchFor, true).findAll();

  for (PsiMethod overridingMethod : overridingMethods) {
    result.add(new UsageInfo(overridingMethod));
  }

  final UsageInfo[] usageInfos = result.toArray(new UsageInfo[result.size()]);
  return UsageViewUtil.removeDuplicatedUsages(usageInfos);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:40,代碼來源:ExtractClosureFromMethodProcessor.java

示例5: findUsages

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
@NotNull
protected UsageInfo[] findUsages() {
  ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();

  PsiMethod[] overridingMethods =
    OverridingMethodsSearch.search(myMethodToSearchFor, true).toArray(PsiMethod.EMPTY_ARRAY);
  for (PsiMethod overridingMethod : overridingMethods) {
    result.add(new UsageInfo(overridingMethod));
  }
  if (!myGenerateDelegate) {
    PsiReference[] refs =
      MethodReferencesSearch.search(myMethodToSearchFor, GlobalSearchScope.projectScope(myProject), true).toArray(PsiReference.EMPTY_ARRAY);


    for (PsiReference ref1 : refs) {
      PsiElement ref = ref1.getElement();
      if (ref instanceof PsiMethod && ((PsiMethod)ref).isConstructor()) {
        DefaultConstructorImplicitUsageInfo implicitUsageInfo =
          new DefaultConstructorImplicitUsageInfo((PsiMethod)ref, ((PsiMethod)ref).getContainingClass(), myMethodToSearchFor);
        result.add(implicitUsageInfo);
      }
      else if (ref instanceof PsiClass) {
        result.add(new NoConstructorClassUsageInfo((PsiClass)ref));
      }
      else if (!IntroduceParameterUtil.insideMethodToBeReplaced(ref, myMethodToReplaceIn)) {
        result.add(new ExternalUsageInfo(ref));
      }
      else {
        result.add(new ChangedMethodCallInfo(ref));
      }
    }
  }

  if (myReplaceAllOccurrences) {
    for (PsiElement expr : getOccurrences()) {
      result.add(new InternalUsageInfo(expr));
    }
  }
  else {
    if (myExpressionToSearch != null && myExpressionToSearch.isValid()) {
      result.add(new InternalUsageInfo(myExpressionToSearch));
    }
  }

  final UsageInfo[] usageInfos = result.toArray(new UsageInfo[result.size()]);
  return UsageViewUtil.removeDuplicatedUsages(usageInfos);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:48,代碼來源:IntroduceParameterProcessor.java

示例6: processUsage

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
@Override
public boolean processUsage(ChangeInfo changeInfo, UsageInfo usageInfo, boolean beforeMethodChange, UsageInfo[] usages) {
  if (!(changeInfo instanceof JavaChangeInfo)) return false;

  PsiElement element = usageInfo.getElement();
  if (element == null) return false;
  if (!GroovyLanguage.INSTANCE.equals(element.getLanguage())) return false;

  if (beforeMethodChange) {
    if (usageInfo instanceof OverriderUsageInfo) {
      processPrimaryMethodInner(((JavaChangeInfo)changeInfo), (GrMethod)((OverriderUsageInfo)usageInfo).getOverridingMethod(),
                                ((OverriderUsageInfo)usageInfo).getBaseMethod());
    }
  }
  else {
    if (usageInfo instanceof GrMethodCallUsageInfo) {
      processMethodUsage(element, ((JavaChangeInfo)changeInfo), ((GrMethodCallUsageInfo)usageInfo).isToChangeArguments(),
                         ((GrMethodCallUsageInfo)usageInfo).isToCatchExceptions(),
                         ((GrMethodCallUsageInfo)usageInfo).getMapToArguments(), ((GrMethodCallUsageInfo)usageInfo).getSubstitutor());
      return true;
    }
    else if (usageInfo instanceof DefaultConstructorImplicitUsageInfo) {
      processConstructor(
        (GrMethod)((DefaultConstructorImplicitUsageInfo)usageInfo).getConstructor(),
        (JavaChangeInfo)changeInfo);
      return true;
    }
    else if (usageInfo instanceof NoConstructorClassUsageInfo) {
      processClassUsage((GrTypeDefinition)((NoConstructorClassUsageInfo)usageInfo).getPsiClass(), ((JavaChangeInfo)changeInfo));
      return true;
    }
    else if (usageInfo instanceof ChangeSignatureParameterUsageInfo) {
      String newName = ((ChangeSignatureParameterUsageInfo)usageInfo).newParameterName;
      ((PsiReference)element).handleElementRename(newName);
      return true;
    }
    else {
      PsiReference ref = element.getReference();
      if (ref != null && changeInfo.getMethod() != null) {
        ref.bindToElement(changeInfo.getMethod());
        return true;
      }
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:47,代碼來源:GrChangeSignatureUsageProcessor.java

示例7: findUsages

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
@NotNull
@Override
protected UsageInfo[] findUsages() {
  ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();

  final PsiMethod toSearchFor = ((PsiMethod)mySettings.getToSearchFor());

  if (!mySettings.generateDelegate()) {
    Collection<PsiReference> refs =
      MethodReferencesSearch.search(toSearchFor, GlobalSearchScope.projectScope(myProject), true).findAll();

    for (PsiReference ref1 : refs) {
      PsiElement ref = ref1.getElement();
      if (ref instanceof PsiMethod && ((PsiMethod)ref).isConstructor()) {
        DefaultConstructorImplicitUsageInfo implicitUsageInfo =
          new DefaultConstructorImplicitUsageInfo((PsiMethod)ref, ((PsiMethod)ref).getContainingClass(), toSearchFor);
        result.add(implicitUsageInfo);
      }
      else if (ref instanceof PsiClass) {
        if (ref instanceof GrAnonymousClassDefinition) {
          result.add(new ExternalUsageInfo(((GrAnonymousClassDefinition)ref).getBaseClassReferenceGroovy()));
        }
        else if (ref instanceof PsiAnonymousClass) {
          result.add(new ExternalUsageInfo(((PsiAnonymousClass)ref).getBaseClassReference()));
        }
        else {
          result.add(new NoConstructorClassUsageInfo((PsiClass)ref));
        }
      }
      else if (!PsiTreeUtil.isAncestor(mySettings.getToReplaceIn(), ref, false)) {
        result.add(new ExternalUsageInfo(ref));
      }
      else {
        result.add(new ChangedMethodCallInfo(ref));
      }
    }
  }

  if (mySettings.replaceAllOccurrences()) {
    if (mySettings.getVar() != null) {
      for (PsiElement element : GrIntroduceHandlerBase.collectVariableUsages(mySettings.getVar(), mySettings.getToReplaceIn())) {
        result.add(new InternalUsageInfo(element));
      }
    }
    else {
      PsiElement[] exprs = GroovyIntroduceParameterUtil.getOccurrences(mySettings);
      for (PsiElement expr : exprs) {
        result.add(new InternalUsageInfo(expr));
      }
    }
  }
  else {
    if (mySettings.getExpression() != null) {
      result.add(new InternalUsageInfo(mySettings.getExpression()));
    }
  }

  Collection<PsiMethod> overridingMethods = OverridingMethodsSearch.search(toSearchFor, true).findAll();

  for (PsiMethod overridingMethod : overridingMethods) {
    result.add(new UsageInfo(overridingMethod));
  }

  final UsageInfo[] usageInfos = result.toArray(new UsageInfo[result.size()]);
  return UsageViewUtil.removeDuplicatedUsages(usageInfos);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:67,代碼來源:GrIntroduceParameterProcessor.java

示例8: findUsages

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
@NotNull
protected UsageInfo[] findUsages() {
  ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();

  PsiMethod[] overridingMethods =
    OverridingMethodsSearch.search(myMethodToSearchFor, true).toArray(PsiMethod.EMPTY_ARRAY);
  for (PsiMethod overridingMethod : overridingMethods) {
    result.add(new UsageInfo(overridingMethod));
  }
  if (!myGenerateDelegate) {
    PsiReference[] refs =
      MethodReferencesSearch.search(myMethodToSearchFor, GlobalSearchScope.projectScope(myProject), true).toArray(PsiReference.EMPTY_ARRAY);


    for (PsiReference ref1 : refs) {
      PsiElement ref = ref1.getElement();
      if (ref instanceof PsiMethod && ((PsiMethod)ref).isConstructor()) {
        DefaultConstructorImplicitUsageInfo implicitUsageInfo =
          new DefaultConstructorImplicitUsageInfo((PsiMethod)ref, ((PsiMethod)ref).getContainingClass(), myMethodToSearchFor);
        result.add(implicitUsageInfo);
      }
      else if (ref instanceof PsiClass) {
        result.add(new NoConstructorClassUsageInfo((PsiClass)ref));
      }
      else if (!IntroduceParameterUtil.insideMethodToBeReplaced(ref, myMethodToReplaceIn)) {
        result.add(new ExternalUsageInfo(ref));
      }
      else {
        result.add(new ChangedMethodCallInfo(ref));
      }
    }
  }

  if (myReplaceAllOccurences) {
    for (PsiElement expr : getOccurrences()) {
      result.add(new InternalUsageInfo(expr));
    }
  }
  else {
    if (myExpressionToSearch != null && myExpressionToSearch.isValid()) {
      result.add(new InternalUsageInfo(myExpressionToSearch));
    }
  }

  final UsageInfo[] usageInfos = result.toArray(new UsageInfo[result.size()]);
  return UsageViewUtil.removeDuplicatedUsages(usageInfos);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:48,代碼來源:IntroduceParameterProcessor.java

示例9: processUsage

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
public boolean processUsage(ChangeInfo changeInfo, UsageInfo usageInfo, boolean beforeMethodChange, UsageInfo[] usages) {
  if (!(changeInfo instanceof JavaChangeInfo)) return false;

  PsiElement element = usageInfo.getElement();
  if (element == null) return false;
  if (!GroovyFileType.GROOVY_LANGUAGE.equals(element.getLanguage())) return false;

  if (beforeMethodChange) {
    if (usageInfo instanceof OverriderUsageInfo) {
      processPrimaryMethodInner(((JavaChangeInfo)changeInfo), (GrMethod)((OverriderUsageInfo)usageInfo).getElement(),
                                ((OverriderUsageInfo)usageInfo).getBaseMethod());
    }
  }
  else {
    if (usageInfo instanceof GrMethodCallUsageInfo) {
      processMethodUsage(element, ((JavaChangeInfo)changeInfo), ((GrMethodCallUsageInfo)usageInfo).isToChangeArguments(),
                         ((GrMethodCallUsageInfo)usageInfo).isToCatchExceptions(),
                         ((GrMethodCallUsageInfo)usageInfo).getMapToArguments(), ((GrMethodCallUsageInfo)usageInfo).getSubstitutor());
      return true;
    }
    else if (usageInfo instanceof DefaultConstructorImplicitUsageInfo) {
      processConstructor(
        (GrMethod)((DefaultConstructorImplicitUsageInfo)usageInfo).getConstructor(),
        (JavaChangeInfo)changeInfo);
      return true;
    }
    else if (usageInfo instanceof NoConstructorClassUsageInfo) {
      processClassUsage((GrTypeDefinition)((NoConstructorClassUsageInfo)usageInfo).getPsiClass(), ((JavaChangeInfo)changeInfo));
      return true;
    }
    else if (usageInfo instanceof ChangeSignatureParameterUsageInfo) {
      String newName = ((ChangeSignatureParameterUsageInfo)usageInfo).newParameterName;
      ((PsiReference)element).handleElementRename(newName);
      return true;
    }
    else {
      PsiReference ref = element.getReference();
      if (ref != null && changeInfo.getMethod() != null) {
        ref.bindToElement(changeInfo.getMethod());
        return true;
      }
    }
  }
  return false;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:46,代碼來源:GrChangeSignatureUsageProcessor.java

示例10: findUsages

import com.intellij.refactoring.util.usageInfo.DefaultConstructorImplicitUsageInfo; //導入依賴的package包/類
@NotNull
@Override
protected UsageInfo[] findUsages() {
  ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();

  final PsiMethod toSearchFor = ((PsiMethod)mySettings.getToSearchFor());

  if (!mySettings.generateDelegate()) {
    Collection<PsiReference> refs =
      MethodReferencesSearch.search(toSearchFor, GlobalSearchScope.projectScope(myProject), true).findAll();

    for (PsiReference ref1 : refs) {
      PsiElement ref = ref1.getElement();
      if (ref instanceof PsiMethod && ((PsiMethod)ref).isConstructor()) {
        DefaultConstructorImplicitUsageInfo implicitUsageInfo =
          new DefaultConstructorImplicitUsageInfo((PsiMethod)ref, ((PsiMethod)ref).getContainingClass(), toSearchFor);
        result.add(implicitUsageInfo);
      }
      else if (ref instanceof PsiClass) {
        if (ref instanceof GrAnonymousClassDefinition) {
          result.add(new ExternalUsageInfo(((GrAnonymousClassDefinition)ref).getBaseClassReferenceGroovy()));
        }
        else if (ref instanceof PsiAnonymousClass) {
          result.add(new ExternalUsageInfo(((PsiAnonymousClass)ref).getBaseClassReference()));
        }
        else {
          result.add(new NoConstructorClassUsageInfo((PsiClass)ref));
        }
      }
      else if (!PsiTreeUtil.isAncestor(mySettings.getToReplaceIn(), ref, false)) {
        result.add(new ExternalUsageInfo(ref));
      }
      else {
        result.add(new ChangedMethodCallInfo(ref));
      }
    }
  }

  if (mySettings.replaceAllOccurrences()) {
    PsiElement[] exprs = GroovyIntroduceParameterUtil.getOccurrences(mySettings);
    for (PsiElement expr : exprs) {
      result.add(new InternalUsageInfo(expr));
    }
  }
  else {
    if (mySettings.getExpression() != null) {
      result.add(new InternalUsageInfo(mySettings.getExpression()));
    }
  }

  Collection<PsiMethod> overridingMethods = OverridingMethodsSearch.search(toSearchFor, true).findAll();

  for (PsiMethod overridingMethod : overridingMethods) {
    result.add(new UsageInfo(overridingMethod));
  }

  final UsageInfo[] usageInfos = result.toArray(new UsageInfo[result.size()]);
  return UsageViewUtil.removeDuplicatedUsages(usageInfos);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:60,代碼來源:GrIntroduceParameterProcessor.java


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