Search in sources :

Example 1 with GrParameterTablePanel

use of org.jetbrains.plugins.groovy.refactoring.extract.GrParameterTablePanel in project intellij-community by JetBrains.

the class GroovyExtractMethodDialog method createUIComponents.

private void createUIComponents() {
    mySignature = new GrMethodSignatureComponent("", myProject);
    mySignature.setPreferredSize(JBUI.size(500, 100));
    mySignature.setMinimumSize(JBUI.size(500, 100));
    mySignature.setBorder(IdeBorderFactory.createTitledBorder(GroovyRefactoringBundle.message("signature.preview.border.title"), false));
    mySignature.setFocusable(false);
    myNameField = new EditorTextField("", myProject, GroovyFileType.GROOVY_FILE_TYPE);
    myVisibilityPanel = new GroovyComboboxVisibilityPanel();
    String visibility = GroovyApplicationSettings.getInstance().EXTRACT_METHOD_VISIBILITY;
    if (visibility == null) {
        visibility = PsiModifier.PRIVATE;
    }
    myVisibilityPanel.setVisibility(visibility);
    myVisibilityPanel.addListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            myHelper.setVisibility(myVisibilityPanel.getVisibility());
            updateSignature();
        }
    });
    myParameterTablePanel = new GrParameterTablePanel() {

        @Override
        protected void updateSignature() {
            GroovyExtractMethodDialog.this.updateSignature();
        }

        @Override
        protected void doEnterAction() {
            GroovyExtractMethodDialog.this.clickDefaultButton();
        }

        @Override
        protected void doCancelAction() {
            GroovyExtractMethodDialog.this.doCancelAction();
        }
    };
}
Also used : GrMethodSignatureComponent(org.jetbrains.plugins.groovy.refactoring.ui.GrMethodSignatureComponent) ChangeEvent(javax.swing.event.ChangeEvent) GrParameterTablePanel(org.jetbrains.plugins.groovy.refactoring.extract.GrParameterTablePanel) EditorTextField(com.intellij.ui.EditorTextField) ChangeListener(javax.swing.event.ChangeListener) GroovyComboboxVisibilityPanel(org.jetbrains.plugins.groovy.refactoring.ui.GroovyComboboxVisibilityPanel)

Example 2 with GrParameterTablePanel

use of org.jetbrains.plugins.groovy.refactoring.extract.GrParameterTablePanel in project intellij-community by JetBrains.

the class GrIntroduceParameterDialog method createSignaturePanel.

private JPanel createSignaturePanel() {
    mySignature = new GrMethodSignatureComponent("", myProject);
    myTable = new GrParameterTablePanel() {

        @Override
        protected void updateSignature() {
            GrIntroduceParameterDialog.this.updateSignature();
        }

        @Override
        protected void doEnterAction() {
            clickDefaultButton();
        }

        @Override
        protected void doCancelAction() {
            GrIntroduceParameterDialog.this.doCancelAction();
        }
    };
    mySignature.setBorder(IdeBorderFactory.createTitledBorder(GroovyRefactoringBundle.message("signature.preview.border.title"), false));
    Splitter splitter = new Splitter(true);
    splitter.setFirstComponent(myTable);
    splitter.setSecondComponent(mySignature);
    mySignature.setPreferredSize(JBUI.size(500, 100));
    mySignature.setSize(JBUI.size(500, 100));
    splitter.setShowDividerIcon(false);
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(splitter, BorderLayout.CENTER);
    myForceReturnCheckBox = new JCheckBox(UIUtil.replaceMnemonicAmpersand("Use e&xplicit return statement"));
    panel.add(myForceReturnCheckBox, BorderLayout.NORTH);
    return panel;
}
Also used : GrMethodSignatureComponent(org.jetbrains.plugins.groovy.refactoring.ui.GrMethodSignatureComponent) Splitter(com.intellij.openapi.ui.Splitter) GrParameterTablePanel(org.jetbrains.plugins.groovy.refactoring.extract.GrParameterTablePanel)

Aggregations

GrParameterTablePanel (org.jetbrains.plugins.groovy.refactoring.extract.GrParameterTablePanel)2 GrMethodSignatureComponent (org.jetbrains.plugins.groovy.refactoring.ui.GrMethodSignatureComponent)2 Splitter (com.intellij.openapi.ui.Splitter)1 EditorTextField (com.intellij.ui.EditorTextField)1 ChangeEvent (javax.swing.event.ChangeEvent)1 ChangeListener (javax.swing.event.ChangeListener)1 GroovyComboboxVisibilityPanel (org.jetbrains.plugins.groovy.refactoring.ui.GroovyComboboxVisibilityPanel)1