本文整理汇总了Java中com.intellij.psi.PsiSubstitutor类的典型用法代码示例。如果您正苦于以下问题:Java PsiSubstitutor类的具体用法?Java PsiSubstitutor怎么用?Java PsiSubstitutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PsiSubstitutor类属于com.intellij.psi包,在下文中一共展示了PsiSubstitutor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MethodSmartPointerNode.java
示例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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PsiMethodNode.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MethodNode.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MethodCellRenderer.java
示例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();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:OverridingMethodsDialog.java
示例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);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AccessorMethodReferencesSearcher.java
示例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]));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SimpleTypeHintProcessor.java
示例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();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SecondParamHintProcessor.java
示例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();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ThirdParamHintProcessor.java
示例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();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FirstParamHintProcessor.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GroovyResolveResultImpl.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GrThisReferenceResolver.java
示例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;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CustomMethodInvocator.java
示例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;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:OverrideImplementMethodAction.java
示例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();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:OverridingMethodsDialog.java
示例16: MethodList
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
public MethodList(PsiClass psiClass)
{
super(new BorderLayout());
model = new SortedListModel<PsiMethod>(comparator);
list = new JBList(model);
this.psiClass = psiClass;
evaluate(psiClass.getAllMethods(), new TestMethodFilter());
add(ScrollPaneFactory.createScrollPane(list));
list.setCellRenderer(new ColoredListCellRenderer() {
@Override
protected void customizeCellRenderer(JList jlist, Object obj, int i, boolean flag, boolean flag1)
{
PsiMethod psimethod = (PsiMethod)obj;
append(PsiFormatUtil.formatMethod(psimethod, PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME, 0), StructureNodeRenderer.applyDeprecation(psimethod, SimpleTextAttributes.REGULAR_ATTRIBUTES));
PsiClass psiclass1 = psimethod.getContainingClass();
if(!MethodList.this.psiClass.equals(psiclass1)) {
append(" (" + psiclass1.getQualifiedName() + ')', StructureNodeRenderer.applyDeprecation(psiclass1, SimpleTextAttributes.GRAY_ATTRIBUTES));
}
}
});
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListScrollingUtil.ensureSelectionExists(list);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:MethodList.java
示例17: 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.getScope(), 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);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:AccessorMethodReferencesSearcher.java
示例18: addBuilderField
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
public void addBuilderField(@NotNull List<PsiField> fields, @NotNull PsiVariable psiVariable, @NotNull PsiClass innerClass, @NotNull AccessorsInfo accessorsInfo, @NotNull PsiSubstitutor substitutor) {
final String fieldName = accessorsInfo.removePrefix(psiVariable.getName());
final Project project = psiVariable.getProject();
final PsiManager psiManager = psiVariable.getManager();
final PsiType psiFieldType = psiVariable.getType();
final PsiType keyType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 0);
final PsiType valueType = PsiTypeUtil.extractOneElementType(psiFieldType, psiManager, CommonClassNames.JAVA_UTIL_MAP, 1);
final PsiType builderFieldKeyType = getBuilderFieldType(keyType, project);
fields.add(new LombokLightFieldBuilder(psiManager, fieldName + LOMBOK_KEY, builderFieldKeyType)
.withModifier(PsiModifier.PRIVATE)
.withNavigationElement(psiVariable)
.withContainingClass(innerClass));
final PsiType builderFieldValueType = getBuilderFieldType(valueType, project);
fields.add(new LombokLightFieldBuilder(psiManager, fieldName + LOMBOK_VALUE, builderFieldValueType)
.withModifier(PsiModifier.PRIVATE)
.withNavigationElement(psiVariable)
.withContainingClass(innerClass));
}
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:24,代码来源:SingularMapHandler.java
示例19: generateElements
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
public <T extends PsiMember & PsiNamedElement> void generateElements(@NotNull T psiElement, @NotNull PsiType psiElementType, @NotNull PsiAnnotation psiAnnotation, @NotNull List<? super PsiElement> target) {
final Project project = psiElement.getProject();
final PsiManager manager = psiElement.getContainingFile().getManager();
final Collection<Pair<PsiMethod, PsiSubstitutor>> includesMethods = new HashSet<Pair<PsiMethod, PsiSubstitutor>>();
final Collection<PsiType> types = collectDelegateTypes(psiAnnotation, psiElementType);
addMethodsOfTypes(types, includesMethods);
final Collection<Pair<PsiMethod, PsiSubstitutor>> excludeMethods = new HashSet<Pair<PsiMethod, PsiSubstitutor>>();
PsiClassType javaLangObjectType = PsiType.getJavaLangObject(manager, GlobalSearchScope.allScope(project));
addMethodsOfType(javaLangObjectType, excludeMethods);
final Collection<PsiType> excludes = collectExcludeTypes(psiAnnotation);
addMethodsOfTypes(excludes, excludeMethods);
final Collection<Pair<PsiMethod, PsiSubstitutor>> methodsToDelegate = findMethodsToDelegate(includesMethods, excludeMethods);
if (!methodsToDelegate.isEmpty()) {
final PsiClass psiClass = psiElement.getContainingClass();
if (null != psiClass) {
for (Pair<PsiMethod, PsiSubstitutor> pair : methodsToDelegate) {
target.add(generateDelegateMethod(psiClass, psiElement, psiAnnotation, pair.getFirst(), pair.getSecond()));
}
}
}
}
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:27,代码来源:DelegateHandler.java
示例20: findMethodsToDelegate
import com.intellij.psi.PsiSubstitutor; //导入依赖的package包/类
private Collection<Pair<PsiMethod, PsiSubstitutor>> findMethodsToDelegate(Collection<Pair<PsiMethod, PsiSubstitutor>> includesMethods, Collection<Pair<PsiMethod, PsiSubstitutor>> excludeMethods) {
final Collection<Pair<PsiMethod, PsiSubstitutor>> result = new ArrayList<Pair<PsiMethod, PsiSubstitutor>>();
for (Pair<PsiMethod, PsiSubstitutor> includesMethodPair : includesMethods) {
boolean acceptMethod = true;
for (Pair<PsiMethod, PsiSubstitutor> excludeMethodPair : excludeMethods) {
if (PsiElementUtil.methodMatches(includesMethodPair, excludeMethodPair)) {
acceptMethod = false;
break;
}
}
if (acceptMethod) {
result.add(includesMethodPair);
}
}
return result;
}
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:17,代码来源:DelegateHandler.java
注:本文中的com.intellij.psi.PsiSubstitutor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论