本文整理汇总了Java中com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceJavaDeleteUsageInfo类的典型用法代码示例。如果您正苦于以下问题:Java SafeDeleteReferenceJavaDeleteUsageInfo类的具体用法?Java SafeDeleteReferenceJavaDeleteUsageInfo怎么用?Java SafeDeleteReferenceJavaDeleteUsageInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SafeDeleteReferenceJavaDeleteUsageInfo类属于com.intellij.refactoring.safeDelete.usageInfo包,在下文中一共展示了SafeDeleteReferenceJavaDeleteUsageInfo类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SafeDeleteJavaCalleeChooser
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceJavaDeleteUsageInfo; //导入依赖的package包/类
public SafeDeleteJavaCalleeChooser(final PsiMethod method, Project project, final ArrayList<UsageInfo> result) {
super(method, project, "Select Methods To Cascade Safe Delete", null, new Consumer<Set<PsiMethod>>() {
@Override
public void consume(Set<PsiMethod> methods) {
result.addAll(ContainerUtil.map(methods, new Function<PsiMethod, SafeDeleteReferenceJavaDeleteUsageInfo>() {
@Override
public SafeDeleteReferenceJavaDeleteUsageInfo fun(PsiMethod m) {
return new SafeDeleteReferenceJavaDeleteUsageInfo(m, m, true);
}
}));
}
});
myProject = project;
}
示例2: createUsageInfoForParameter
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceJavaDeleteUsageInfo; //导入依赖的package包/类
@Override
public void createUsageInfoForParameter(final PsiReference reference,
final List<UsageInfo> usages,
final PsiParameter parameter,
final PsiMethod method) {
int index = method.getParameterList().getParameterIndex(parameter);
final PsiElement element = reference.getElement();
PsiCall call = null;
if (element instanceof PsiCall) {
call = (PsiCall)element;
}
else {
final PsiElement parent = element.getParent();
if (parent instanceof PsiCall) {
call = (PsiCall)parent;
} else if (parent instanceof PsiAnonymousClass) {
call = (PsiNewExpression)parent.getParent();
}
}
if (call != null) {
final PsiExpressionList argList = call.getArgumentList();
if (argList != null) {
final PsiExpression[] args = argList.getExpressions();
if (index < args.length) {
if (!parameter.isVarArgs()) {
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(args[index], parameter, true));
}
else {
for (int i = index; i < args.length; i++) {
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(args[i], parameter, true));
}
}
}
}
}
else if (element instanceof PsiDocMethodOrFieldRef) {
if (((PsiDocMethodOrFieldRef)element).getSignature() != null) {
@NonNls final StringBuffer newText = new StringBuffer();
newText.append("/** @see #").append(method.getName()).append('(');
final List<PsiParameter> parameters = new ArrayList<PsiParameter>(Arrays.asList(method.getParameterList().getParameters()));
parameters.remove(parameter);
newText.append(StringUtil.join(parameters, new Function<PsiParameter, String>() {
@Override
public String fun(PsiParameter psiParameter) {
return psiParameter.getType().getCanonicalText();
}
}, ","));
newText.append(")*/");
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, parameter, true) {
public void deleteElement() throws IncorrectOperationException {
final PsiDocMethodOrFieldRef.MyReference javadocMethodReference =
(PsiDocMethodOrFieldRef.MyReference)element.getReference();
if (javadocMethodReference != null) {
javadocMethodReference.bindToText(method.getContainingClass(), newText);
}
}
});
}
}
}
示例3: createUsageInfoForParameter
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceJavaDeleteUsageInfo; //导入依赖的package包/类
@Override
public void createUsageInfoForParameter(PsiReference reference,
List<UsageInfo> usages,
final PsiParameter parameter,
final PsiMethod method) {
int index = method.getParameterList().getParameterIndex(parameter);
final PsiElement element = reference.getElement();
GrCall call = null;
if (element instanceof GrCall) {
call = (GrCall)element;
}
else if (element.getParent() instanceof GrCall) {
call = (GrCall)element.getParent();
}
if (call != null) {
GrClosureSignature signature = GrClosureSignatureUtil.createSignature(call);
if (signature == null) return;//todo ???
GrClosureSignatureUtil.ArgInfo<PsiElement>[] argInfos = GrClosureSignatureUtil.mapParametersToArguments(signature, call);
if (argInfos == null) return; //todo???
for (PsiElement arg : argInfos[index].args) {
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(arg, parameter, true));
}
}
else if (element instanceof GrDocMethodReference) {
@NonNls final StringBuilder newText = new StringBuilder();
newText.append("/** @see ");
GrDocReferenceElement holder = ((GrDocMethodReference)element).getReferenceHolder();
if (holder != null) {
newText.append(holder.getText());
}
newText.append('#');
newText.append(method.getName());
newText.append('(');
final List<PsiParameter> parameters = new ArrayList<PsiParameter>(Arrays.asList(method.getParameterList().getParameters()));
parameters.remove(parameter);
newText.append(StringUtil.join(parameters, new Function<PsiParameter, String>() {
@Override
public String fun(PsiParameter psiParameter) {
return parameter.getType().getCanonicalText();
}
}, ","));
newText.append(")*/");
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, parameter, true) {
@Override
public void deleteElement() throws IncorrectOperationException {
((GrDocMethodReference)element).bindToText(method.getProject(), newText.toString());
}
});
}
}
示例4: createUsageInfoForParameter
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceJavaDeleteUsageInfo; //导入依赖的package包/类
@Override
public void createUsageInfoForParameter(final PsiReference reference,
final List<UsageInfo> usages,
final PsiParameter parameter,
final PsiMethod method) {
int index = method.getParameterList().getParameterIndex(parameter);
final PsiElement element = reference.getElement();
PsiCall call = null;
if (element instanceof PsiCall) {
call = (PsiCall)element;
}
else if (element.getParent() instanceof PsiCall) {
call = (PsiCall)element.getParent();
}
if (call != null) {
final PsiExpressionList argList = call.getArgumentList();
if (argList != null) {
final PsiExpression[] args = argList.getExpressions();
if (index < args.length) {
if (!parameter.isVarArgs()) {
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(args[index], parameter, true));
}
else {
for (int i = index; i < args.length; i++) {
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(args[i], parameter, true));
}
}
}
}
}
else if (element instanceof PsiDocMethodOrFieldRef) {
if (((PsiDocMethodOrFieldRef)element).getSignature() != null) {
@NonNls final StringBuffer newText = new StringBuffer();
newText.append("/** @see #").append(method.getName()).append('(');
final List<PsiParameter> parameters = new ArrayList<PsiParameter>(Arrays.asList(method.getParameterList().getParameters()));
parameters.remove(parameter);
newText.append(StringUtil.join(parameters, new Function<PsiParameter, String>() {
@Override
public String fun(PsiParameter psiParameter) {
return parameter.getType().getCanonicalText();
}
}, ","));
newText.append(")*/");
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, parameter, true) {
public void deleteElement() throws IncorrectOperationException {
final PsiDocMethodOrFieldRef.MyReference javadocMethodReference =
(PsiDocMethodOrFieldRef.MyReference)element.getReference();
if (javadocMethodReference != null) {
javadocMethodReference.bindToText(method.getContainingClass(), newText);
}
}
});
}
}
}
示例5: createUsageInfoForParameter
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteReferenceJavaDeleteUsageInfo; //导入依赖的package包/类
@Override
public void createUsageInfoForParameter(PsiReference reference,
List<UsageInfo> usages,
final PsiParameter parameter,
final PsiMethod method) {
int index = method.getParameterList().getParameterIndex(parameter);
final PsiElement element = reference.getElement();
GrCall call = null;
if (element instanceof GrCall) {
call = (GrCall)element;
}
else if (element.getParent() instanceof GrCall) {
call = (GrCall)element.getParent();
}
if (call != null) {
GrClosureSignature signature = GrClosureSignatureUtil.createSignature(call);
if (signature == null) return;//todo ???
GrClosureSignatureUtil.ArgInfo<PsiElement>[] argInfos = GrClosureSignatureUtil.mapParametersToArguments(signature, call);
if (argInfos == null) return; //todo???
for (PsiElement arg : argInfos[index].args) {
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(arg, parameter, true));
}
}
else if (element instanceof GrDocMethodReference) {
@NonNls final StringBuilder newText = new StringBuilder();
newText.append("/** @see ");
GrDocReferenceElement holder = ((GrDocMethodReference)element).getReferenceHolder();
if (holder != null) {
newText.append(holder.getText());
}
newText.append('#');
newText.append(method.getName());
newText.append('(');
final List<PsiParameter> parameters = new ArrayList<PsiParameter>(Arrays.asList(method.getParameterList().getParameters()));
parameters.remove(parameter);
newText.append(StringUtil.join(parameters, new Function<PsiParameter, String>() {
@Override
public String fun(PsiParameter psiParameter) {
return parameter.getType().getCanonicalText();
}
}, ","));
newText.append(")*/");
usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, parameter, true) {
public void deleteElement() throws IncorrectOperationException {
((GrDocMethodReference)element).bindToText(method.getProject(), newText.toString());
}
});
}
}