本文整理匯總了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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}