本文整理汇总了Java中com.intellij.refactoring.util.usageInfo.NoConstructorClassUsageInfo类的典型用法代码示例。如果您正苦于以下问题:Java NoConstructorClassUsageInfo类的具体用法?Java NoConstructorClassUsageInfo怎么用?Java NoConstructorClassUsageInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NoConstructorClassUsageInfo类属于com.intellij.refactoring.util.usageInfo包,在下文中一共展示了NoConstructorClassUsageInfo类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findUsages
import com.intellij.refactoring.util.usageInfo.NoConstructorClassUsageInfo; //导入依赖的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);
}
示例2: findUsages
import com.intellij.refactoring.util.usageInfo.NoConstructorClassUsageInfo; //导入依赖的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);
}
示例3: findUsages
import com.intellij.refactoring.util.usageInfo.NoConstructorClassUsageInfo; //导入依赖的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);
}
示例4: processUsage
import com.intellij.refactoring.util.usageInfo.NoConstructorClassUsageInfo; //导入依赖的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;
}
示例5: findUsages
import com.intellij.refactoring.util.usageInfo.NoConstructorClassUsageInfo; //导入依赖的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);
}
示例6: findUsages
import com.intellij.refactoring.util.usageInfo.NoConstructorClassUsageInfo; //导入依赖的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);
}
示例7: processUsage
import com.intellij.refactoring.util.usageInfo.NoConstructorClassUsageInfo; //导入依赖的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;
}
示例8: findUsages
import com.intellij.refactoring.util.usageInfo.NoConstructorClassUsageInfo; //导入依赖的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);
}