use of com.intellij.refactoring.ui.MemberSelectionTable 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.refactoring.ui.MemberSelectionTable in project intellij-community by JetBrains.
the class MissedTestsDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
final List<MemberInfo> info = TestIntegrationUtils.extractClassMethods(mySourceClass, false);
disableMethodsWithTests(info);
final JPanel panel = new JPanel(new BorderLayout());
myTable = new MemberSelectionTable(info, null);
panel.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
panel.add(myIncludeInheritedCb, BorderLayout.NORTH);
myIncludeInheritedCb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateMethodsTable();
}
});
return panel;
}
Aggregations