Search in sources :

Example 1 with JavaVisibilityPanel

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

the class IntroduceFieldDialogPanel method createInitializerPlacePanel.

protected JComponent createInitializerPlacePanel(ItemListener itemListener, ItemListener finalUpdater) {
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    JPanel initializationPanel = new JPanel();
    initializationPanel.setBorder(IdeBorderFactory.createTitledBorder(RefactoringBundle.message("initialize.in.border.title"), true));
    initializationPanel.setLayout(new BoxLayout(initializationPanel, BoxLayout.Y_AXIS));
    myRbInCurrentMethod = new JRadioButton();
    myRbInCurrentMethod.setFocusable(false);
    myRbInCurrentMethod.setText(RefactoringBundle.message("current.method.radio"));
    myRbInCurrentMethod.setEnabled(myAllowInitInMethod);
    myRbInFieldDeclaration = new JRadioButton();
    myRbInFieldDeclaration.setFocusable(false);
    myRbInFieldDeclaration.setText(RefactoringBundle.message("field.declaration.radio"));
    myRbInConstructor = new JRadioButton();
    myRbInConstructor.setFocusable(false);
    myRbInConstructor.setText(RefactoringBundle.message("class.constructors.radio"));
    initializationPanel.add(myRbInCurrentMethod);
    initializationPanel.add(myRbInFieldDeclaration);
    initializationPanel.add(myRbInConstructor);
    if (TestFrameworks.getInstance().isTestClass(myParentClass)) {
        myRbInSetUp = new JRadioButton();
        myRbInSetUp.setFocusable(false);
        myRbInSetUp.setText(RefactoringBundle.message("setup.method.radio"));
        initializationPanel.add(myRbInSetUp);
    }
    ButtonGroup bg = new ButtonGroup();
    bg.add(myRbInCurrentMethod);
    bg.add(myRbInFieldDeclaration);
    bg.add(myRbInConstructor);
    if (myRbInSetUp != null)
        bg.add(myRbInSetUp);
    myRbInConstructor.addItemListener(itemListener);
    myRbInCurrentMethod.addItemListener(itemListener);
    myRbInFieldDeclaration.addItemListener(itemListener);
    myRbInConstructor.addItemListener(finalUpdater);
    myRbInCurrentMethod.addItemListener(finalUpdater);
    myRbInFieldDeclaration.addItemListener(finalUpdater);
    if (myRbInSetUp != null)
        myRbInSetUp.addItemListener(finalUpdater);
    //    modifiersPanel.add(myCbFinal);
    //    modifiersPanel.add(myCbStatic);
    JPanel groupPanel = new JPanel(new GridLayout(1, 2));
    groupPanel.add(initializationPanel);
    myVisibilityPanel = new JavaVisibilityPanel(false, false);
    groupPanel.add(myVisibilityPanel);
    mainPanel.add(groupPanel, BorderLayout.CENTER);
    return mainPanel;
}
Also used : JavaVisibilityPanel(com.intellij.refactoring.ui.JavaVisibilityPanel)

Example 2 with JavaVisibilityPanel

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

the class MoveInstanceMethodDialogBase method createVisibilityPanel.

protected static JavaVisibilityPanel createVisibilityPanel() {
    final JavaVisibilityPanel visibilityPanel = new JavaVisibilityPanel(false, true);
    visibilityPanel.setVisibility(null);
    return visibilityPanel;
}
Also used : JavaVisibilityPanel(com.intellij.refactoring.ui.JavaVisibilityPanel)

Example 3 with JavaVisibilityPanel

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

the class MoveMembersDialog method createCenterPanel.

protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new BorderLayout());
    final String title = RefactoringBundle.message("move.members.members.to.be.moved.border.title");
    final MemberSelectionPanel selectionPanel = new MemberSelectionPanel(title, myMemberInfos, null);
    myTable = selectionPanel.getTable();
    myMemberInfoModel = new MyMemberInfoModel();
    myMemberInfoModel.memberInfoChanged(new MemberInfoChange<>(myMemberInfos));
    selectionPanel.getTable().setMemberInfoModel(myMemberInfoModel);
    selectionPanel.getTable().addMemberInfoChangeListener(myMemberInfoModel);
    panel.add(selectionPanel, BorderLayout.CENTER);
    myVisibilityPanel = new JavaVisibilityPanel(true, true);
    myVisibilityPanel.setVisibility(null);
    panel.add(myVisibilityPanel, BorderLayout.EAST);
    panel.add(initOpenInEditorCb(), BorderLayout.SOUTH);
    return panel;
}
Also used : MemberSelectionPanel(com.intellij.refactoring.ui.MemberSelectionPanel) JavaVisibilityPanel(com.intellij.refactoring.ui.JavaVisibilityPanel)

Example 4 with JavaVisibilityPanel

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

the class GrIntroduceConstantDialog method createUIComponents.

private void createUIComponents() {
    myJavaVisibilityPanel = new JavaVisibilityPanel(false, true);
    final GrVariable var = myContext.getVar();
    final GrExpression expression = myContext.getExpression();
    final StringPartInfo stringPart = myContext.getStringPart();
    if (expression != null) {
        myTypeCombo = GrTypeComboBox.createTypeComboBoxFromExpression(expression);
    } else if (stringPart != null) {
        myTypeCombo = GrTypeComboBox.createTypeComboBoxFromExpression(stringPart.getLiteral());
    } else {
        assert var != null;
        myTypeCombo = GrTypeComboBox.createTypeComboBoxWithDefType(var.getDeclaredType(), var);
    }
    List<String> names = new ArrayList<>();
    if (var != null) {
        names.add(var.getName());
    }
    if (expression != null) {
        ContainerUtil.addAll(names, suggestNames());
    }
    myNameField = new NameSuggestionsField(ArrayUtil.toStringArray(names), myContext.getProject(), GroovyFileType.GROOVY_FILE_TYPE);
    GrTypeComboBox.registerUpDownHint(myNameField, myTypeCombo);
}
Also used : GrVariable(org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable) JavaVisibilityPanel(com.intellij.refactoring.ui.JavaVisibilityPanel) GrExpression(org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression) NameSuggestionsField(com.intellij.refactoring.ui.NameSuggestionsField) StringPartInfo(org.jetbrains.plugins.groovy.refactoring.introduce.StringPartInfo)

Aggregations

JavaVisibilityPanel (com.intellij.refactoring.ui.JavaVisibilityPanel)4 MemberSelectionPanel (com.intellij.refactoring.ui.MemberSelectionPanel)1 NameSuggestionsField (com.intellij.refactoring.ui.NameSuggestionsField)1 GrVariable (org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable)1 GrExpression (org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression)1 StringPartInfo (org.jetbrains.plugins.groovy.refactoring.introduce.StringPartInfo)1