use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.
the class MemberSelectionTable method getOverrideIcon.
@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;
}
use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.
the class MissedTestsDialog method updateMethodsTable.
private void updateMethodsTable() {
List<MemberInfo> infos = TestIntegrationUtils.extractClassMethods(mySourceClass, myIncludeInheritedCb.isSelected());
Set<PsiMember> selectedMethods = new HashSet<>();
for (MemberInfo each : myTable.getSelectedMemberInfos()) {
selectedMethods.add(each.getMember());
}
for (MemberInfo each : infos) {
each.setChecked(selectedMethods.contains(each.getMember()));
}
myTable.setMemberInfos(infos);
}
use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.
the class AnnotatedMacro method calculateLookupItems.
@Override
public LookupElement[] calculateLookupItems(@NotNull Expression[] params, ExpressionContext context) {
final Query<PsiMember> query = findAnnotated(context, params);
if (query != null) {
Set<LookupElement> set = new LinkedHashSet<>();
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;
}
use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.
the class RemoveMiddlemanDialog method createCenterPanel.
protected JComponent createCenterPanel() {
final JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
final MemberSelectionPanel selectionPanel = new MemberSelectionPanel("&Methods to inline", delegateMethods, "Delete");
final MemberSelectionTable table = selectionPanel.getTable();
table.setMemberInfoModel(new DelegatingMemberInfoModel<PsiMember, MemberInfo>(table.getMemberInfoModel()) {
@Override
public int checkForProblems(@NotNull final MemberInfo member) {
return hasSuperMethods(member) ? ERROR : OK;
}
@Override
public String getTooltipText(final MemberInfo member) {
if (hasSuperMethods(member))
return "Deletion will break type hierarchy";
return super.getTooltipText(member);
}
private boolean hasSuperMethods(final MemberInfo member) {
if (member.isChecked() && member.isToAbstract()) {
final PsiMember psiMember = member.getMember();
if (psiMember instanceof PsiMethod && ((PsiMethod) psiMember).findDeepestSuperMethods().length > 0) {
return true;
}
}
return false;
}
});
panel.add(selectionPanel, BorderLayout.CENTER);
return panel;
}
use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.
the class MissedTestsDialog method disableMethodsWithTests.
private void disableMethodsWithTests(List<MemberInfo> info) {
final Set<String> existingNames = new HashSet<>();
final String prefix = getTestPrefix(existingNames);
existingNames.addAll(ContainerUtil.map(myTestClass.getMethods(), method -> 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())));
}
}
Aggregations