本文整理汇总了Java中com.intellij.psi.PsiMember类的典型用法代码示例。如果您正苦于以下问题:Java PsiMember类的具体用法?Java PsiMember怎么用?Java PsiMember使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PsiMember类属于com.intellij.psi包,在下文中一共展示了PsiMember类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: JavaCallHierarchyData
import com.intellij.psi.PsiMember; //导入依赖的package包/类
public JavaCallHierarchyData(PsiClass originalClass,
PsiMethod methodToFind,
PsiClassType originalType,
PsiMethod method,
Set<PsiMethod> methodsToFind,
NodeDescriptor nodeDescriptor,
Map<PsiMember, NodeDescriptor> resultMap,
Project project) {
myOriginalClass = originalClass;
myMethodToFind = methodToFind;
myOriginalType = originalType;
myMethod = method;
myMethodsToFind = methodsToFind;
myNodeDescriptor = nodeDescriptor;
myResultMap = resultMap;
myProject = project;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JavaCallHierarchyData.java
示例2: calculateLookupItems
import com.intellij.psi.PsiMember; //导入依赖的package包/类
@Override
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
final Query<PsiMember> query = findAnnotated(context, params);
if (query != null) {
Set<LookupElement> set = new LinkedHashSet<LookupElement>();
final String secondParamValue = params.length > 1 ? params[1].calculateResult(context).toString() : null;
final boolean isShortName = secondParamValue != null && !Boolean.valueOf(secondParamValue);
final Project project = context.getProject();
final PsiClass findInClass = secondParamValue != null
? JavaPsiFacade.getInstance(project).findClass(secondParamValue, GlobalSearchScope.allScope(project))
: null;
for (PsiMember object : query.findAll()) {
if (findInClass != null && !object.getContainingClass().equals(findInClass)) continue;
boolean isClazz = object instanceof PsiClass;
final String name = isShortName || !isClazz ? object.getName() : ((PsiClass) object).getQualifiedName();
set.add(LookupElementBuilder.create(name));
}
return set.toArray(new LookupElement[set.size()]);
}
return LookupElement.EMPTY_ARRAY;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:AnnotatedMacro.java
示例3: weigh
import com.intellij.psi.PsiMember; //导入依赖的package包/类
@Override
public Comparable weigh(@NotNull final PsiElement element, @NotNull final ProximityLocation location) {
PsiElement position = location.getPosition();
if (position == null){
return null;
}
if (!INSIDE_PSI_MEMBER.getValue(location)) {
return 0;
}
if (element.isPhysical()) {
position = PHYSICAL_POSITION.getValue(location);
}
final PsiMember member = PsiTreeUtil.getContextOfType(PsiTreeUtil.findCommonContext(position, element), PsiMember.class, false);
if (member instanceof PsiClass) return 1;
if (member != null) return 2;
return 0;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SamePsiMemberWeigher.java
示例4: disableMethodsWithTests
import com.intellij.psi.PsiMember; //导入依赖的package包/类
private void disableMethodsWithTests(List<MemberInfo> info) {
final Set<String> existingNames = new HashSet<String>();
final String prefix = getTestPrefix(existingNames);
existingNames.addAll(ContainerUtil.map(myTestClass.getMethods(), new Function<PsiMethod, String>() {
@Override
public String fun(PsiMethod method) {
return StringUtil.decapitalize(StringUtil.trimStart(method.getName(), prefix));
}
}));
for (MemberInfo memberInfo : info) {
final PsiMember member = memberInfo.getMember();
memberInfo.setChecked(!(member instanceof PsiMethod && existingNames.contains(member.getName())));
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MissedTestsDialog.java
示例5: createCenterPanel
import com.intellij.psi.PsiMember; //导入依赖的package包/类
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new BorderLayout());
final MemberSelectionPanel memberSelectionPanel = new MemberSelectionPanel(RefactoringBundle.message("members.to.form.superclass"),
myMemberInfos, RefactoringBundle.message("make.abstract"));
panel.add(memberSelectionPanel, BorderLayout.CENTER);
final MemberInfoModel<PsiMember, MemberInfo> memberInfoModel =
new UsesAndInterfacesDependencyMemberInfoModel<PsiMember, MemberInfo>(mySourceClass, null, false, myContainmentVerifier) {
@Override
public Boolean isFixedAbstract(MemberInfo member) {
return Boolean.TRUE;
}
};
memberInfoModel.memberInfoChanged(new MemberInfoChange<PsiMember, MemberInfo>(myMemberInfos));
memberSelectionPanel.getTable().setMemberInfoModel(memberInfoModel);
memberSelectionPanel.getTable().addMemberInfoChangeListener(memberInfoModel);
panel.add(myDocCommentPanel, BorderLayout.EAST);
return panel;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExtractSuperclassDialog.java
示例6: createCenterPanel
import com.intellij.psi.PsiMember; //导入依赖的package包/类
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new BorderLayout());
final MemberSelectionPanel memberSelectionPanel = new MemberSelectionPanel(
RefactoringBundle.message("members.to.be.pushed.down.panel.title"),
myMemberInfos,
RefactoringBundle.message("keep.abstract.column.header"));
panel.add(memberSelectionPanel, BorderLayout.CENTER);
myMemberInfoModel = new MyMemberInfoModel();
myMemberInfoModel.memberInfoChanged(new MemberInfoChange<PsiMember, MemberInfo>(myMemberInfos));
memberSelectionPanel.getTable().setMemberInfoModel(myMemberInfoModel);
memberSelectionPanel.getTable().addMemberInfoChangeListener(myMemberInfoModel);
myJavaDocPanel = new DocCommentPanel(RefactoringBundle.message("push.down.javadoc.panel.title"));
myJavaDocPanel.setPolicy(JavaRefactoringSettings.getInstance().PULL_UP_MEMBERS_JAVADOC);
panel.add(myJavaDocPanel, BorderLayout.EAST);
return panel;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PushDownDialog.java
示例7: MoveMembersRefactoringImpl
import com.intellij.psi.PsiMember; //导入依赖的package包/类
MoveMembersRefactoringImpl(Project project, final PsiMember[] elements, final String targetClassQualifiedName, final String newVisibility, final boolean makeEnumConstants) {
super(new MoveMembersProcessor(project, new MoveMembersOptions() {
public PsiMember[] getSelectedMembers() {
return elements;
}
public String getTargetClassName() {
return targetClassQualifiedName;
}
public String getMemberVisibility() {
return newVisibility;
}
public boolean makeEnumConstant() {
return makeEnumConstants;
}
}));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MoveMembersRefactoringImpl.java
示例8: getOverrideIcon
import com.intellij.psi.PsiMember; //导入依赖的package包/类
@Override
protected Icon getOverrideIcon(MemberInfo memberInfo) {
PsiMember member = memberInfo.getMember();
Icon overrideIcon = MemberSelectionTable.EMPTY_OVERRIDE_ICON;
if (member instanceof PsiMethod) {
if (Boolean.TRUE.equals(memberInfo.getOverrides())) {
overrideIcon = AllIcons.General.OverridingMethod;
}
else if (Boolean.FALSE.equals(memberInfo.getOverrides())) {
overrideIcon = AllIcons.General.ImplementingMethod;
}
else {
overrideIcon = MemberSelectionTable.EMPTY_OVERRIDE_ICON;
}
}
return overrideIcon;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MemberSelectionTable.java
示例9: UsesAndInterfacesDependencyMemberInfoModel
import com.intellij.psi.PsiMember; //导入依赖的package包/类
public UsesAndInterfacesDependencyMemberInfoModel(PsiClass aClass, @Nullable PsiClass superClass, boolean recursive,
@NotNull final InterfaceContainmentVerifier interfaceContainmentVerifier) {
super(new ANDCombinedMemberInfoModel<T, M>(
new UsesDependencyMemberInfoModel<T, PsiClass, M>(aClass, superClass, recursive) {
public int checkForProblems(@NotNull M memberInfo) {
final int problem = super.checkForProblems(memberInfo);
if (problem == OK) return OK;
final PsiMember member = memberInfo.getMember();
if (member instanceof PsiMethod) {
if (interfaceContainmentVerifier.checkedInterfacesContain((PsiMethod)member)) return OK;
}
return problem;
}
},
new InterfaceDependencyMemberInfoModel<T, M>(aClass))
);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:UsesAndInterfacesDependencyMemberInfoModel.java
示例10: doTest
import com.intellij.psi.PsiMember; //导入依赖的package包/类
protected void doTest(final boolean shouldSucceed) throws Exception {
final String filePath = getTestFilePath();
configureByFile(filePath);
final PsiElement targetElement = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.ELEMENT_NAME_ACCEPTED);
assertTrue("<caret> is not on method name", targetElement instanceof PsiMember);
final PsiMember psiMethod = (PsiMember)targetElement;
try {
MethodDuplicatesHandler.invokeOnScope(getProject(), psiMethod, new AnalysisScope(getFile()));
}
catch (RuntimeException e) {
if (shouldSucceed) {
fail("duplicates were not found");
}
return;
}
UIUtil.dispatchAllInvocationEvents();
if (shouldSucceed) {
checkResultByFile(filePath + ".after");
}
else {
fail("duplicates found");
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:FindMethodDuplicatesBaseTest.java
示例11: performAction
import com.intellij.psi.PsiMember; //导入依赖的package包/类
private void performAction(String sourceClassName, String targetClassName, int[] memberIndices, final String visibility) throws Exception {
PsiClass sourceClass = myJavaFacade.findClass(sourceClassName, ProjectScope.getProjectScope(myProject));
assertNotNull("Class " + sourceClassName + " not found", sourceClass);
PsiClass targetClass = myJavaFacade.findClass(targetClassName, ProjectScope.getProjectScope(myProject));
assertNotNull("Class " + targetClassName + " not found", targetClass);
PsiElement[] children = sourceClass.getChildren();
ArrayList<PsiMember> members = new ArrayList<>();
for (PsiElement child : children) {
if (child instanceof PsiMember) {
members.add(((PsiMember) child));
}
}
LinkedHashSet<PsiMember> memberSet = new LinkedHashSet<>();
for (int index : memberIndices) {
PsiMember member = members.get(index);
assertTrue(member.hasModifierProperty(PsiModifier.STATIC));
memberSet.add(member);
}
MockMoveMembersOptions options = new MockMoveMembersOptions(targetClass.getQualifiedName(), memberSet);
options.setMemberVisibility(visibility);
new MoveMembersProcessor(myProject, null, options).run();
FileDocumentManager.getInstance().saveAllDocuments();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:MoveMembersTest.java
示例12: getOverrideIcon
import com.intellij.psi.PsiMember; //导入依赖的package包/类
@Override
protected Icon getOverrideIcon(GrMemberInfo memberInfo) {
PsiMember member = memberInfo.getMember();
Icon overrideIcon = EMPTY_OVERRIDE_ICON;
if (member instanceof PsiMethod) {
if (Boolean.TRUE.equals(memberInfo.getOverrides())) {
overrideIcon = AllIcons.General.OverridingMethod;
}
else if (Boolean.FALSE.equals(memberInfo.getOverrides())) {
overrideIcon = AllIcons.General.ImplementingMethod;
}
else {
overrideIcon = EMPTY_OVERRIDE_ICON;
}
}
return overrideIcon;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GrMemberSelectionTable.java
示例13: prepareInlineElement
import com.intellij.psi.PsiMember; //导入依赖的package包/类
@Override
@Nullable
public Settings prepareInlineElement(@NotNull final PsiElement element, @Nullable Editor editor, boolean invokedOnReference) {
if (element instanceof GrField) {
return GrInlineFieldUtil.inlineFieldSettings((GrField)element, editor, invokedOnReference);
}
else if (element instanceof GrMethod) {
return GroovyInlineMethodUtil.inlineMethodSettings((GrMethod)element, editor, invokedOnReference);
}
else {
if (element instanceof GrTypeDefinition || element instanceof GrClassSubstitution) {
return null; //todo inline to anonymous class, push members from super class
}
}
if (element instanceof PsiMember) {
String message = GroovyRefactoringBundle.message("cannot.inline.0.", getFullName(element));
CommonRefactoringUtil.showErrorHint(element.getProject(), editor, message, "", HelpID.INLINE_FIELD);
return InlineHandler.Settings.CANNOT_INLINE_SETTINGS;
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GroovyInlineHandler.java
示例14: getOnlyAsFieldElements
import com.intellij.psi.PsiMember; //导入依赖的package包/类
/**
* Gets the list of members to be put in the VelocityContext.
*
* @param members a list of {@link PsiMember} objects.
* @param selectedNotNullMembers
* @param useAccessors
* @return a filtered list of only the fields as {@link FieldElement} objects.
*/
public static List<FieldElement> getOnlyAsFieldElements(Collection<? extends PsiMember> members,
Collection<? extends PsiMember> selectedNotNullMembers,
boolean useAccessors) {
List<FieldElement> fieldElementList = new ArrayList<FieldElement>();
for (PsiMember member : members) {
if (member instanceof PsiField) {
PsiField field = (PsiField) member;
FieldElement fe = ElementFactory.newFieldElement(field, useAccessors);
if (selectedNotNullMembers.contains(member)) {
fe.setNotNull(true);
}
fieldElementList.add(fe);
}
}
return fieldElementList;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ElementUtils.java
示例15: getOnlyAsFieldAndMethodElements
import com.intellij.psi.PsiMember; //导入依赖的package包/类
/**
* Gets the list of members to be put in the VelocityContext.
*
* @param members a list of {@link PsiMember} objects.
* @param selectedNotNullMembers a list of @NotNull objects
* @param useAccessors
* @return a filtered list of only the methods as a {@link FieldElement} or {@link MethodElement} objects.
*/
public static List<Element> getOnlyAsFieldAndMethodElements(Collection<? extends PsiMember> members,
Collection<? extends PsiMember> selectedNotNullMembers,
boolean useAccessors) {
List<Element> elementList = new ArrayList<Element>();
for (PsiMember member : members) {
AbstractElement element = null;
if (member instanceof PsiField) {
element = ElementFactory.newFieldElement((PsiField) member, useAccessors);
} else if (member instanceof PsiMethod) {
element = ElementFactory.newMethodElement((PsiMethod) member);
}
if (element != null) {
if (selectedNotNullMembers.contains(member)) {
element.setNotNull(true);
}
elementList.add(element);
}
}
return elementList;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ElementUtils.java
示例16: createCenterPanel
import com.intellij.psi.PsiMember; //导入依赖的package包/类
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new BorderLayout());
final MemberSelectionPanel memberSelectionPanel = new MemberSelectionPanel(RefactoringBundle.message("members.to.form.superclass"),
myMemberInfos, RefactoringBundle.message("make.abstract"));
panel.add(memberSelectionPanel, BorderLayout.CENTER);
final MemberInfoModel<PsiMember, MemberInfo> memberInfoModel =
new UsesAndInterfacesDependencyMemberInfoModel(mySourceClass, null, false, myContainmentVerifier) {
public Boolean isFixedAbstract(MemberInfo member) {
return Boolean.TRUE;
}
};
memberInfoModel.memberInfoChanged(new MemberInfoChange<PsiMember, MemberInfo>(myMemberInfos));
memberSelectionPanel.getTable().setMemberInfoModel(memberInfoModel);
memberSelectionPanel.getTable().addMemberInfoChangeListener(memberInfoModel);
panel.add(myDocCommentPanel, BorderLayout.EAST);
return panel;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ExtractSuperclassDialog.java
示例17: UsesAndInterfacesDependencyMemberInfoModel
import com.intellij.psi.PsiMember; //导入依赖的package包/类
public UsesAndInterfacesDependencyMemberInfoModel(PsiClass aClass, @Nullable PsiClass superClass, boolean recursive,
@NotNull final InterfaceContainmentVerifier interfaceContainmentVerifier) {
super(new ANDCombinedMemberInfoModel<PsiMember, MemberInfo>(
new UsesDependencyMemberInfoModel<PsiMember, PsiClass, MemberInfo>(aClass, superClass, recursive) {
public int checkForProblems(@NotNull MemberInfo memberInfo) {
final int problem = super.checkForProblems(memberInfo);
if (problem == OK) return OK;
final PsiMember member = memberInfo.getMember();
if (member instanceof PsiMethod) {
if (interfaceContainmentVerifier.checkedInterfacesContain((PsiMethod)member)) return OK;
}
return problem;
}
},
new InterfaceDependencyMemberInfoModel(aClass))
);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:UsesAndInterfacesDependencyMemberInfoModel.java
示例18: doTest
import com.intellij.psi.PsiMember; //导入依赖的package包/类
protected void doTest(final boolean shouldSucceed) throws Exception {
final String filePath = getTestFilePath();
configureByFile(filePath);
final PsiElement targetElement = TargetElementUtilBase.findTargetElement(getEditor(), TargetElementUtilBase.ELEMENT_NAME_ACCEPTED);
assertTrue("<caret> is not on method name", targetElement instanceof PsiMember);
final PsiMember psiMethod = (PsiMember)targetElement;
try {
MethodDuplicatesHandler.invokeOnScope(getProject(), psiMethod, new AnalysisScope(getFile()));
}
catch (RuntimeException e) {
if (shouldSucceed) {
fail("duplicates were not found");
}
return;
}
UIUtil.dispatchAllInvocationEvents();
if (shouldSucceed) {
checkResultByFile(filePath + ".after");
}
else {
fail("duplicates found");
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:FindMethodDuplicatesBaseTest.java
示例19: performAction
import com.intellij.psi.PsiMember; //导入依赖的package包/类
private void performAction(String sourceClassName, String targetClassName, int[] memberIndices, final String visibility) throws Exception {
PsiClass sourceClass = myJavaFacade.findClass(sourceClassName, ProjectScope.getProjectScope(myProject));
assertNotNull("Class " + sourceClassName + " not found", sourceClass);
PsiClass targetClass = myJavaFacade.findClass(targetClassName, ProjectScope.getProjectScope(myProject));
assertNotNull("Class " + targetClassName + " not found", targetClass);
PsiElement[] children = sourceClass.getChildren();
ArrayList<PsiMember> members = new ArrayList<PsiMember>();
for (PsiElement child : children) {
if (child instanceof PsiMember) {
members.add(((PsiMember) child));
}
}
LinkedHashSet<PsiMember> memberSet = new LinkedHashSet<PsiMember>();
for (int index : memberIndices) {
PsiMember member = members.get(index);
assertTrue(member.hasModifierProperty(PsiModifier.STATIC));
memberSet.add(member);
}
MockMoveMembersOptions options = new MockMoveMembersOptions(targetClass.getQualifiedName(), memberSet);
options.setMemberVisibility(visibility);
new MoveMembersProcessor(myProject, null, options).run();
FileDocumentManager.getInstance().saveAllDocuments();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:MoveMembersTest.java
示例20: update
import com.intellij.psi.PsiMember; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
presentation.setVisible(false);
final DataContext dataContext = e.getDataContext();
final PsiElement[] psiElements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(dataContext);
if (psiElements != null) {
final Set<PsiMember> foundMembers = PatternConfigurationProducer.collectTestMembers(psiElements);
if (foundMembers.isEmpty()) return;
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project != null) {
final List<JUnitConfiguration> foundConfigurations = collectPatternConfigurations(foundMembers, project);
if (!foundConfigurations.isEmpty()) {
presentation.setVisible(true);
if (foundConfigurations.size() == 1) {
presentation.setText("Add to temp suite: " + foundConfigurations.get(0).getName());
}
}
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:AddToTestsPatternAction.java
注:本文中的com.intellij.psi.PsiMember类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论