本文整理汇总了Java中com.intellij.psi.PsiSubstitutor类的典型用法代码示例。如果您正苦于以下问题:Java PsiSubstitutor类的具体用法?Java PsiSubstitutor怎么用?Java PsiSubstitutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PsiSubstitutor类属于com.intellij.psi包,在下文中一共展示了PsiSubstitutor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateImpl
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
@Override
public void updateImpl(PresentationData data) {
String name = PsiFormatUtil.formatMethod(
(PsiMethod)getPsiElement(),
PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME |
PsiFormatUtilBase.SHOW_TYPE |
PsiFormatUtilBase.TYPE_AFTER |
PsiFormatUtilBase.SHOW_PARAMETERS,
PsiFormatUtilBase.SHOW_TYPE
);
int c = name.indexOf('\n');
if (c > -1) {
name = name.substring(0, c - 1);
}
data.setPresentableText(name);
}
示例2: updateImpl
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
@Override
public void updateImpl(PresentationData data) {
String name = PsiFormatUtil.formatMethod(
getValue(),
PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME |
PsiFormatUtilBase.SHOW_TYPE |
PsiFormatUtilBase.TYPE_AFTER |
PsiFormatUtilBase.SHOW_PARAMETERS,
PsiFormatUtilBase.SHOW_TYPE
);
int c = name.indexOf('\n');
if (c > -1) {
name = name.substring(0, c - 1);
}
data.setPresentableText(name);
}
示例3: toString
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
public String toString() {
final PsiMethod method = (PsiMethod)getPsiElement();
if (method == null || !method.isValid()) return "";
if (DumbService.isDumb(myProject)) return method.getName();
String name = PsiFormatUtil.formatMethod(
method,
PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_TYPE | PsiFormatUtil.TYPE_AFTER | PsiFormatUtil.SHOW_PARAMETERS,
PsiFormatUtil.SHOW_TYPE
);
int c = name.indexOf('\n');
if (c > -1) {
name = name.substring(0, c - 1);
}
return name;
}
示例4: getListCellRendererComponent
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
PsiMethod method = (PsiMethod) value;
final String text = PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY,
PsiFormatUtil.SHOW_CONTAINING_CLASS | PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS,
PsiFormatUtil.SHOW_TYPE);
setText(text);
Icon icon = method.getIcon(Iconable.ICON_FLAG_VISIBILITY);
if(icon != null) setIcon(icon);
return this;
}
示例5: OverridingMethodsDialog
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
public OverridingMethodsDialog(Project project, List<UsageInfo> overridingMethods) {
super(project, true);
myOverridingMethods = overridingMethods;
myChecked = new boolean[myOverridingMethods.size()];
for (int i = 0; i < myChecked.length; i++) {
myChecked[i] = true;
}
myMethodText = new String[myOverridingMethods.size()];
for (int i = 0; i < myMethodText.length; i++) {
myMethodText[i] = PsiFormatUtil.formatMethod(
((SafeDeleteOverridingMethodUsageInfo) myOverridingMethods.get(i)).getOverridingMethod(),
PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_CONTAINING_CLASS
| PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS | PsiFormatUtilBase.SHOW_TYPE,
PsiFormatUtilBase.SHOW_TYPE
);
}
myUsagePreviewPanel = new UsagePreviewPanel(project, new UsageViewPresentation());
setTitle(RefactoringBundle.message("unused.overriding.methods.title"));
init();
}
示例6: processQuery
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
@Override
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters queryParameters, @NotNull Processor<PsiReference> consumer) {
final PsiMethod method = queryParameters.getMethod();
final String propertyName;
if (GdkMethodUtil.isCategoryMethod(method, null, null, PsiSubstitutor.EMPTY)) {
final GrGdkMethod cat = GrGdkMethodImpl.createGdkMethod(method, false, null);
propertyName = GroovyPropertyUtils.getPropertyName((PsiMethod)cat);
}
else {
propertyName = GroovyPropertyUtils.getPropertyName(method);
}
if (propertyName == null) return;
final SearchScope onlyGroovyFiles = GroovyScopeUtil.restrictScopeToGroovyFiles(queryParameters.getEffectiveSearchScope(), GroovyScopeUtil.getEffectiveScope(method));
queryParameters.getOptimizer().searchWord(propertyName, onlyGroovyFiles, UsageSearchContext.IN_CODE, true, method);
if (!GroovyPropertyUtils.isPropertyName(propertyName)) {
queryParameters.getOptimizer().searchWord(StringUtil.decapitalize(propertyName), onlyGroovyFiles, UsageSearchContext.IN_CODE, true, method);
}
}
示例7: inferExpectedSignatures
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
@NotNull
@Override
public List<PsiType[]> inferExpectedSignatures(@NotNull final PsiMethod method,
@NotNull PsiSubstitutor substitutor,
@NotNull String[] options) {
return Collections.singletonList(ContainerUtil.map(options, new Function<String, PsiType>() {
@Override
public PsiType fun(String value) {
try {
PsiType type = JavaPsiFacade.getElementFactory(method.getProject()).createTypeFromText(value, method);
return DefaultGroovyMethods.asBoolean(type) ? type : PsiType.NULL;
}
catch (IncorrectOperationException e) {
return PsiType.NULL;
}
}
}, new PsiType[options.length]));
}
示例8: inferExpectedSignatures
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
@NotNull
@Override
public List<PsiType[]> inferExpectedSignatures(@NotNull PsiMethod method,
@NotNull PsiSubstitutor substitutor,
@NotNull String[] options) {
List<PsiType[]> signatures = new SecondParamHintProcessor().inferExpectedSignatures(method, substitutor, options);
if (signatures.size() == 1) {
PsiType[] signature = signatures.get(0);
if (signature.length == 1) {
PsiType type = signature[0];
if (type instanceof PsiArrayType) {
return produceResult(((PsiArrayType)type).getComponentType());
}
}
}
return Collections.emptyList();
}
示例9: inferExpectedSignatures
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
@NotNull
@Override
public List<PsiType[]> inferExpectedSignatures(@NotNull PsiMethod method,
@NotNull PsiSubstitutor substitutor,
@NotNull String[] options) {
List<PsiType[]> signatures = new ThirdParamHintProcessor().inferExpectedSignatures(method, substitutor, options);
if (signatures.size() == 1) {
PsiType[] signature = signatures.get(0);
if (signature.length == 1) {
PsiType type = signature[0];
if (type instanceof PsiArrayType) {
return produceResult(((PsiArrayType)type).getComponentType());
}
}
}
return Collections.emptyList();
}
示例10: inferExpectedSignatures
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
@NotNull
@Override
public List<PsiType[]> inferExpectedSignatures(@NotNull PsiMethod method,
@NotNull PsiSubstitutor substitutor,
@NotNull String[] options) {
List<PsiType[]> signatures = new FirstParamHintProcessor().inferExpectedSignatures(method, substitutor, options);
if (signatures.size() == 1) {
PsiType[] signature = signatures.get(0);
if (signature.length == 1) {
PsiType type = signature[0];
if (type instanceof PsiArrayType) {
return produceResult(((PsiArrayType)type).getComponentType());
}
}
}
return Collections.emptyList();
}
示例11: GroovyResolveResultImpl
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
public GroovyResolveResultImpl(@NotNull PsiElement element,
@Nullable PsiElement resolveContext,
@Nullable SpreadState spreadState,
@NotNull PsiSubstitutor substitutor,
boolean isAccessible,
boolean staticsOK,
boolean isInvokedOnProperty,
boolean isApplicable) {
myCurrentFileResolveContext = resolveContext;
myElement = element;
myIsAccessible = isAccessible;
mySubstitutor = substitutor;
myIsStaticsOK = staticsOK;
myIsInvokedOnProperty = isInvokedOnProperty;
mySpreadState = spreadState;
myIsApplicable = isApplicable;
}
示例12: resolveThisExpression
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
@Nullable("null if ref is not actually 'this' reference")
public static GroovyResolveResult[] resolveThisExpression(@NotNull GrReferenceExpression ref) {
GrExpression qualifier = ref.getQualifier();
if (qualifier == null) {
final PsiElement parent = ref.getParent();
if (parent instanceof GrConstructorInvocation) {
return ((GrConstructorInvocation)parent).multiResolve(false);
}
else {
PsiClass aClass = PsiUtil.getContextClass(ref);
if (aClass != null) {
return new GroovyResolveResultImpl[]{new GroovyResolveResultImpl(aClass, null, null, PsiSubstitutor.EMPTY, true, true)};
}
}
}
else if (qualifier instanceof GrReferenceExpression) {
GroovyResolveResult result = ((GrReferenceExpression)qualifier).advancedResolve();
PsiElement resolved = result.getElement();
if (resolved instanceof PsiClass && PsiUtil.hasEnclosingInstanceInScope((PsiClass)resolved, ref, false)) {
return new GroovyResolveResult[]{result};
}
}
return null;
}
示例13: invokeMethodOn
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
public static boolean invokeMethodOn(@NotNull ExpressionGenerator generator,
@NotNull GrGdkMethod method,
@Nullable GrExpression caller,
@NotNull GrExpression[] exprs,
@NotNull GrNamedArgument[] namedArgs,
@NotNull GrClosableBlock[] closures,
@NotNull PsiSubstitutor substitutor,
@NotNull GroovyPsiElement context) {
final PsiMethod staticMethod = method.getStaticMethod();
for (CustomMethodInvocator invocator : EP_NAME.getExtensions()) {
if (invocator.invoke(generator, staticMethod, caller, exprs, namedArgs, closures, substitutor, context)) {
return true;
}
}
return false;
}
示例14: canImplementOverride
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
private static boolean canImplementOverride(final MethodHierarchyNodeDescriptor descriptor, final MethodHierarchyBrowser methodHierarchyBrowser, final boolean toImplement) {
final PsiClass psiClass = descriptor.getPsiClass();
if (psiClass == null || psiClass instanceof JspClass) return false;
final PsiMethod baseMethod = methodHierarchyBrowser.getBaseMethod();
if (baseMethod == null) return false;
final MethodSignature signature = baseMethod.getSignature(PsiSubstitutor.EMPTY);
Collection<MethodSignature> allOriginalSignatures = toImplement
? OverrideImplementUtil.getMethodSignaturesToImplement(psiClass)
: OverrideImplementUtil.getMethodSignaturesToOverride(psiClass);
for (final MethodSignature originalSignature : allOriginalSignatures) {
if (originalSignature.equals(signature)) {
return true;
}
}
return false;
}
示例15: OverridingMethodsDialog
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
public OverridingMethodsDialog(Project project, List<UsageInfo> overridingMethods) {
super(project, true);
myOverridingMethods = overridingMethods;
myChecked = new boolean[myOverridingMethods.size()];
for (int i = 0; i < myChecked.length; i++) {
myChecked[i] = true;
}
myMethodText = new String[myOverridingMethods.size()];
for (int i = 0; i < myMethodText.length; i++) {
myMethodText[i] = PsiFormatUtil.formatMethod(
((SafeDeleteOverridingMethodUsageInfo) myOverridingMethods.get(i)).getOverridingMethod(),
PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_CONTAINING_CLASS
| PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS | PsiFormatUtil.SHOW_TYPE,
PsiFormatUtil.SHOW_TYPE
);
}
myUsagePreviewPanel = new UsagePreviewPanel(project);
setTitle(RefactoringBundle.message("unused.overriding.methods.title"));
init();
}