Search in sources :

Example 1 with DocCommentPanel

use of com.intellij.refactoring.ui.DocCommentPanel in project intellij-community by JetBrains.

the class AbstractPushDownDialog method createCenterPanel.

protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new BorderLayout());
    final AbstractMemberSelectionPanel<Member, MemberInfo> memberSelectionPanel = createMemberInfoPanel();
    panel.add(memberSelectionPanel, BorderLayout.CENTER);
    myMemberInfoModel = createMemberInfoModel();
    myMemberInfoModel.memberInfoChanged(new MemberInfoChange<>(myMemberInfos));
    memberSelectionPanel.getTable().setMemberInfoModel(myMemberInfoModel);
    memberSelectionPanel.getTable().addMemberInfoChangeListener(myMemberInfoModel);
    myJavaDocPanel = new DocCommentPanel(RefactoringBundle.message("push.down.javadoc.panel.title"));
    myJavaDocPanel.setPolicy(getDocCommentPolicy());
    panel.add(myJavaDocPanel, BorderLayout.EAST);
    return panel;
}
Also used : DocCommentPanel(com.intellij.refactoring.ui.DocCommentPanel)

Example 2 with DocCommentPanel

use of com.intellij.refactoring.ui.DocCommentPanel in project intellij-community by JetBrains.

the class EncapsulateFieldsDialog method createCenterPanel.

protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(createTable(), BorderLayout.CENTER);
    myCbEncapsulateGet.setText(RefactoringBundle.message("encapsulate.fields.get.access.checkbox"));
    myCbEncapsulateSet.setText(RefactoringBundle.message("encapsulate.fields.set.access.checkbox"));
    myCbUseAccessorsWhenAccessible.setText(RefactoringBundle.message("encapsulate.fields.use.accessors.even.when.field.is.accessible.checkbox"));
    myRbFieldPrivate.setText(RefactoringBundle.message("encapsulate.fields.private.radio"));
    myRbFieldProtected.setText(RefactoringBundle.message("encapsulate.fields.protected.radio"));
    myRbFieldPackageLocal.setText(RefactoringBundle.message("encapsulate.fields..package.local.radio"));
    myRbFieldAsIs.setText(RefactoringBundle.getVisibilityAsIs());
    myRbAccessorPublic.setText(RefactoringBundle.getVisibilityPublic());
    myRbAccessorProtected.setText(RefactoringBundle.getVisibilityProtected());
    myRbAccessorPrivate.setText(RefactoringBundle.getVisibilityPrivate());
    myRbAccessorPackageLocal.setText(RefactoringBundle.getVisibilityPackageLocal());
    ButtonGroup fieldGroup = new ButtonGroup();
    fieldGroup.add(myRbFieldAsIs);
    fieldGroup.add(myRbFieldPackageLocal);
    fieldGroup.add(myRbFieldPrivate);
    fieldGroup.add(myRbFieldProtected);
    ButtonGroup methodGroup = new ButtonGroup();
    methodGroup.add(myRbAccessorPackageLocal);
    methodGroup.add(myRbAccessorPrivate);
    methodGroup.add(myRbAccessorProtected);
    methodGroup.add(myRbAccessorPublic);
    myCbEncapsulateGet.setSelected(true);
    myCbEncapsulateSet.setSelected(true);
    ActionListener checkboxListener = new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (myCbEncapsulateGet.equals(e.getSource())) {
                if (!myCbEncapsulateGet.isSelected()) {
                    myCbEncapsulateSet.setSelected(true);
                }
            } else {
                // myCbEncapsulateSet is the source
                if (!myCbEncapsulateSet.isSelected()) {
                    myCbEncapsulateGet.setSelected(true);
                }
            }
            int[] rows = myTable.getSelectedRows();
            myTableModel.fireTableDataChanged();
            TableUtil.selectRows(myTable, rows);
        }
    };
    myCbEncapsulateGet.addActionListener(checkboxListener);
    myCbEncapsulateSet.addActionListener(checkboxListener);
    myRbFieldAsIs.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (myRbFieldAsIs.isSelected()) {
                myCbUseAccessorWhenAccessibleValue = myCbUseAccessorsWhenAccessible.isSelected();
                myCbUseAccessorsWhenAccessible.setSelected(true);
                myCbUseAccessorsWhenAccessible.setEnabled(false);
            } else {
                myCbUseAccessorsWhenAccessible.setEnabled(true);
                myCbUseAccessorsWhenAccessible.setSelected(myCbUseAccessorWhenAccessibleValue);
            }
        }
    });
    myCbUseAccessorsWhenAccessible.setSelected(JavaRefactoringSettings.getInstance().ENCAPSULATE_FIELDS_USE_ACCESSORS_WHEN_ACCESSIBLE);
    myCbUseAccessorWhenAccessibleValue = myCbUseAccessorsWhenAccessible.isSelected();
    myRbFieldPrivate.setSelected(true);
    myRbAccessorPublic.setSelected(true);
    Box leftBox = Box.createVerticalBox();
    myCbEncapsulateGet.setPreferredSize(myCbUseAccessorsWhenAccessible.getPreferredSize());
    leftBox.add(myCbEncapsulateGet);
    leftBox.add(myCbEncapsulateSet);
    leftBox.add(Box.createVerticalStrut(10));
    leftBox.add(myCbUseAccessorsWhenAccessible);
    JPanel leftPanel = new JPanel(new BorderLayout());
    leftPanel.setBorder(IdeBorderFactory.createTitledBorder(RefactoringBundle.message("encapsulate.fields.encapsulate.border.title"), true));
    leftPanel.add(leftBox, BorderLayout.CENTER);
    leftPanel.add(Box.createHorizontalStrut(5), BorderLayout.WEST);
    JPanel encapsulateBox = new JPanel(new BorderLayout());
    encapsulateBox.add(leftPanel, BorderLayout.CENTER);
    myJavadocPolicy = new DocCommentPanel("JavaDoc");
    encapsulateBox.add(myJavadocPolicy, BorderLayout.EAST);
    boolean hasJavadoc = false;
    for (PsiField field : myFields) {
        if (field.getDocComment() != null) {
            hasJavadoc = true;
            break;
        }
    }
    myJavadocPolicy.setVisible(hasJavadoc);
    Box fieldsBox = Box.createVerticalBox();
    fieldsBox.add(myRbFieldPrivate);
    fieldsBox.add(myRbFieldPackageLocal);
    fieldsBox.add(myRbFieldProtected);
    fieldsBox.add(myRbFieldAsIs);
    JPanel fieldsVisibilityPanel = new JPanel(new BorderLayout());
    fieldsVisibilityPanel.setBorder(IdeBorderFactory.createTitledBorder(RefactoringBundle.message("encapsulate.fields..encapsulated.fields.visibility.border.title"), true));
    fieldsVisibilityPanel.add(fieldsBox, BorderLayout.CENTER);
    fieldsVisibilityPanel.add(Box.createHorizontalStrut(5), BorderLayout.WEST);
    Box methodsBox = Box.createVerticalBox();
    methodsBox.add(myRbAccessorPublic);
    methodsBox.add(myRbAccessorProtected);
    methodsBox.add(myRbAccessorPackageLocal);
    methodsBox.add(myRbAccessorPrivate);
    JPanel methodsVisibilityPanel = new JPanel(new BorderLayout());
    methodsVisibilityPanel.setBorder(IdeBorderFactory.createTitledBorder(RefactoringBundle.message("encapsulate.fields.accessors.visibility.border.title"), true));
    methodsVisibilityPanel.add(methodsBox, BorderLayout.CENTER);
    methodsVisibilityPanel.add(Box.createHorizontalStrut(5), BorderLayout.WEST);
    Box visibilityBox = Box.createHorizontalBox();
    visibilityBox.add(fieldsVisibilityPanel);
    visibilityBox.add(Box.createHorizontalStrut(5));
    visibilityBox.add(methodsVisibilityPanel);
    Box box = Box.createVerticalBox();
    box.add(encapsulateBox);
    box.add(Box.createVerticalStrut(5));
    box.add(visibilityBox);
    JPanel boxPanel = new JPanel(new BorderLayout());
    boxPanel.add(box, BorderLayout.CENTER);
    boxPanel.add(Box.createVerticalStrut(5), BorderLayout.NORTH);
    panel.add(boxPanel, BorderLayout.SOUTH);
    return panel;
}
Also used : DocCommentPanel(com.intellij.refactoring.ui.DocCommentPanel)

Example 3 with DocCommentPanel

use of com.intellij.refactoring.ui.DocCommentPanel in project intellij-community by JetBrains.

the class PullUpDialog method addCustomElementsToCentralPanel.

@Override
protected void addCustomElementsToCentralPanel(JPanel panel) {
    myJavaDocPanel = new DocCommentPanel(RefactoringBundle.message("javadoc.for.abstracts"));
    myJavaDocPanel.setPolicy(JavaRefactoringSettings.getInstance().PULL_UP_MEMBERS_JAVADOC);
    panel.add(myJavaDocPanel, BorderLayout.EAST);
    updateAbstractState();
}
Also used : DocCommentPanel(com.intellij.refactoring.ui.DocCommentPanel)

Example 4 with DocCommentPanel

use of com.intellij.refactoring.ui.DocCommentPanel in project intellij-community by JetBrains.

the class ExtractSuperBaseDialog method init.

@Override
protected void init() {
    setTitle(myRefactoringName);
    myPackageNameField = createPackageNameField();
    myDestinationRootPanel = createDestinationRootPanel();
    mySourceClassField = createSourceClassField();
    myExtractedSuperNameField = createExtractedSuperNameField();
    myDocCommentPanel = new DocCommentPanel(getDocCommentPanelName());
    myDocCommentPanel.setPolicy(getDocCommentPolicySetting());
    super.init();
    updateDialog();
}
Also used : DocCommentPanel(com.intellij.refactoring.ui.DocCommentPanel)

Example 5 with DocCommentPanel

use of com.intellij.refactoring.ui.DocCommentPanel in project intellij-community by JetBrains.

the class GrPullUpDialog method addCustomElementsToCentralPanel.

@Override
protected void addCustomElementsToCentralPanel(JPanel panel) {
    myJavaDocPanel = new DocCommentPanel(RefactoringBundle.message("javadoc.for.abstracts"));
    myJavaDocPanel.setPolicy(JavaRefactoringSettings.getInstance().PULL_UP_MEMBERS_JAVADOC);
    boolean hasJavadoc = false;
    for (GrMemberInfo info : myMemberInfos) {
        final PsiMember member = info.getMember();
        if (myMemberInfoModel.isAbstractEnabled(info) && member instanceof PsiDocCommentOwner && ((PsiDocCommentOwner) member).getDocComment() != null) {
            hasJavadoc = true;
            break;
        }
    }
    UIUtil.setEnabled(myJavaDocPanel, hasJavadoc, true);
    panel.add(myJavaDocPanel, BorderLayout.EAST);
}
Also used : DocCommentPanel(com.intellij.refactoring.ui.DocCommentPanel) GrMemberInfo(org.jetbrains.plugins.groovy.refactoring.classMembers.GrMemberInfo)

Aggregations

DocCommentPanel (com.intellij.refactoring.ui.DocCommentPanel)5 GrMemberInfo (org.jetbrains.plugins.groovy.refactoring.classMembers.GrMemberInfo)1