protected void createLocalVariablePanel(GridBagConstraints gbConstraints, JPanel panel, JavaRefactoringSettings settings) { if(myIsLocalVariable && !myIsInvokedOnDeclaration) { myCbDeleteLocalVariable = new StateRestoringCheckBox(); myCbDeleteLocalVariable.setText(RefactoringBundle.message("delete.variable.declaration")); myCbDeleteLocalVariable.setFocusable(false); gbConstraints.gridy++; panel.add(myCbDeleteLocalVariable, gbConstraints); myCbDeleteLocalVariable.setSelected(settings.INTRODUCE_PARAMETER_DELETE_LOCAL_VARIABLE); gbConstraints.insets = new Insets(0, 0, 4, 8); if(myHasInitializer) { myCbUseInitializer = new StateRestoringCheckBox(); myCbUseInitializer.setText(RefactoringBundle.message("use.variable.initializer.to.initialize.parameter")); myCbUseInitializer.setSelected(settings.INTRODUCE_PARAMETER_USE_INITIALIZER); myCbUseInitializer.setFocusable(false); gbConstraints.gridy++; panel.add(myCbUseInitializer, gbConstraints); } } }
@NotNull @Override public JComponent getComponent() { myCbForceClassicVM = new StateRestoringCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.force.classic.vm")); myCbDisableJIT = new JCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.disable.jit")); myRbSocket = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.socket")); myRbShmem = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.shmem")); final ButtonGroup gr = new ButtonGroup(); gr.add(myRbSocket); gr.add(myRbShmem); final Box box = Box.createHorizontalBox(); box.add(myRbSocket); box.add(myRbShmem); final JPanel transportPanel = new JPanel(new BorderLayout()); transportPanel.add(new JLabel(DebuggerBundle.message("label.debugger.launching.configurable.debugger.transport")), BorderLayout.WEST); transportPanel.add(box, BorderLayout.CENTER); VerticalBox panel = new VerticalBox(); panel.setOpaque(false); panel.add(transportPanel); panel.add(myCbForceClassicVM); panel.add(myCbDisableJIT); JPanel result = new JPanel(new BorderLayout()); result.add(panel, BorderLayout.NORTH); return result; }
protected JPanel appendCheckboxes(ItemListener itemListener) { GridBagConstraints gbConstraints = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1,1,0,0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0); JPanel panel = new JPanel(new GridBagLayout()); myCbFinal = new StateRestoringCheckBox(); myCbFinal.setFocusable(false); myCbFinal.setText(RefactoringBundle.message("declare.final")); myCbFinal.addItemListener(itemListener); gbConstraints.gridy++; panel.add(myCbFinal, gbConstraints); appendOccurrences(itemListener, gbConstraints, panel); if (myLocalVariable != null) { gbConstraints.gridy++; if (myCbReplaceAll != null) { gbConstraints.insets = new Insets(0, 8, 0, 0); } myCbDeleteVariable = new StateRestoringCheckBox(); myCbDeleteVariable.setText(RefactoringBundle.message("delete.variable.declaration")); panel.add(myCbDeleteVariable, gbConstraints); if (myIsInvokedOnDeclaration) { myCbDeleteVariable.setEnabled(false); myCbDeleteVariable.setSelected(true); } else if (myCbReplaceAll != null) { updateCbDeleteVariable(); myCbReplaceAll.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { updateCbDeleteVariable(); } } ); } } return panel; }
protected StateRestoringCheckBox addCheckboxToPanel(String name, boolean toSelect, JPanel panel, boolean toUpdate) { StateRestoringCheckBox cb = new StateRestoringCheckBox(name); cb.setSelected(toSelect); panel.add(cb); if (toUpdate) { cb.addActionListener(myUpdateAction); } return cb; }
private void updateControls(@Nullable StateRestoringCheckBox checkBox) { if (checkBox == null) return; if (myCbSafeDelete == null || myCbSafeDelete.isSelected()) { checkBox.makeSelectable(); } else { checkBox.makeUnselectable(false); } }
private void createUIComponents() { enabledCompilationCheckBox = new StateRestoringCheckBox(JFLEX_ENABLED_COMPILATION_KEY, true); TextFieldWithStoredHistory jflexHomeHistory = createHistoryTextField(JFLEX_HOME_KEY, JFlexSettings.getDefaultJFlexHome()); jFlexHomeTextField = new ComponentWithBrowseButton<TextFieldWithStoredHistory>(jflexHomeHistory, null); fixButton(jflexHomeHistory, jFlexHomeTextField); TextFieldWithStoredHistory skeletonPathHistory = createHistoryTextField(JFLEX_SKELETON_KEY, JFlexSettings.getDefaultSkeletonPath(JFlexSettings.getDefaultJFlexHome())); skeletonPathTextField = new ComponentWithBrowseButton<TextFieldWithStoredHistory>(skeletonPathHistory, null); fixButton(skeletonPathHistory, skeletonPathTextField); commandLineOptionsTextField = createHistoryTextField(JFLEX_OPTIONS_KEY, JFlexSettings.DEFAULT_OPTIONS_CHARAT_NOBAK); enabledEmbedJavaCheckBox = new StateRestoringCheckBox(JFLEX_ENABLED_EMBED_JAVA_KEY, true); }
public JComponent createComponent() { myCbForceClassicVM = new StateRestoringCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.force.classic.vm")); myCbDisableJIT = new JCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.disable.jit")); myHideDebuggerCheckBox = new JCheckBox(DebuggerBundle.message("label.debugger.launching.configurable.hide.window")); myRbSocket = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.socket")); myRbShmem = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.shmem")); myFocusAppCheckBox = new JCheckBox(DebuggerBundle.message("label.debugger.focusAppOnBreakpoint")); int cbLeftOffset = 0; final Border border = myCbForceClassicVM.getBorder(); if (border != null) { final Insets insets = border.getBorderInsets(myCbForceClassicVM); if (insets != null) { cbLeftOffset = insets.left; } } final ButtonGroup gr = new ButtonGroup(); gr.add(myRbSocket); gr.add(myRbShmem); final Box box = Box.createHorizontalBox(); box.add(myRbSocket); box.add(myRbShmem); final JPanel transportPanel = new JPanel(new BorderLayout()); transportPanel.add(new JLabel(DebuggerBundle.message("label.debugger.launching.configurable.debugger.transport")), BorderLayout.WEST); transportPanel.add(box, BorderLayout.CENTER); VerticalBox panel = new VerticalBox(); panel.setOpaque(false); panel.add(transportPanel); panel.add(myCbForceClassicVM); panel.add(myCbDisableJIT); panel.add(myHideDebuggerCheckBox); panel.add(myFocusAppCheckBox); JPanel result = new JPanel(new BorderLayout()); result.add(panel, BorderLayout.NORTH); return result; }
private void createUIComponents() { enabledJavaInjection = new StateRestoringCheckBox(CUP_ENABLE_JAVA_INJECTION,true); }
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.fill = GridBagConstraints.HORIZONTAL; gbConstraints.weightx = 1; gbConstraints.weighty = 0; gbConstraints.gridwidth = 1; gbConstraints.gridx = 0; gbConstraints.gridy = 0; gbConstraints.insets = new Insets(0, 0, 0, 0); if (myOccurrencesCount > 1) { myCbReplaceAll = new NonFocusableCheckBox(); myCbReplaceAll.setText(RefactoringBundle.message("replace.all.occurences", myOccurrencesCount)); panel.add(myCbReplaceAll, gbConstraints); myReplaceAllListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { updateControls(); } }; myCbReplaceAll.addItemListener(myReplaceAllListener); if (myAnyLValueOccurences) { myCbReplaceWrite = new StateRestoringCheckBox(); myCbReplaceWrite.setText(RefactoringBundle.message("replace.write.access.occurrences")); gbConstraints.insets = new Insets(0, 8, 0, 0); gbConstraints.gridy++; panel.add(myCbReplaceWrite, gbConstraints); myCbReplaceWrite.addItemListener(myReplaceAllListener); } } myCbFinal = new NonFocusableCheckBox(); myCbFinal.setText(RefactoringBundle.message("declare.final")); final Boolean createFinals = JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_FINALS; myCbFinalState = createFinals == null ? CodeStyleSettingsManager.getSettings(myProject).GENERATE_FINAL_LOCALS : createFinals.booleanValue(); gbConstraints.insets = new Insets(0, 0, 0, 0); gbConstraints.gridy++; panel.add(myCbFinal, gbConstraints); myFinalListener = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (myCbFinal.isEnabled()) { myCbFinalState = myCbFinal.isSelected(); } } }; myCbFinal.addItemListener(myFinalListener); updateControls(); return panel; }
@NotNull private static StateRestoringCheckBox createCheckbox(@NotNull String message) { final StateRestoringCheckBox cb = new StateRestoringCheckBox(message); cb.setFocusable(false); return cb; }
@NotNull private static StateRestoringCheckBox createCheckbox(boolean selected, @NotNull String message) { final StateRestoringCheckBox cb = new StateRestoringCheckBox(message, selected); cb.setFocusable(false); return cb; }
@Override protected JComponent createNorthPanel() { final JPanel panel = new JPanel(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); @SuppressWarnings({"UnresolvedPropertyKey"}) final String warningMessage = DeleteUtil.generateWarningMessage(IdeBundle.message("prompt.delete.elements"), myElements); gbc.insets = new Insets(4, 8, 4, 8); gbc.weighty = 1; gbc.weightx = 1; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.WEST; panel.add(new JLabel(warningMessage), gbc); gbc.gridy++; gbc.gridx = 0; gbc.weightx = 0.0; gbc.gridwidth = 1; gbc.insets = new Insets(4, 8, 0, 8); myCbSafeDelete = new JCheckBox(IdeBundle.message("checkbox.safe.delete.with.usage.search")); panel.add(myCbSafeDelete, gbc); gbc.gridy++; gbc.gridx = 0; gbc.weightx = 0.0; gbc.gridwidth = 1; gbc.insets = new Insets(0, 8, 4, 8); myCbSearchInComments = new StateRestoringCheckBox(IdeBundle.message("checkbox.search.in.comments.and.strings")); panel.add(myCbSearchInComments, gbc); gbc.gridx++; myCbSearchInNonJava = new StateRestoringCheckBox(IdeBundle.message("checkbox.search.in.non.java.files")); panel.add(myCbSearchInNonJava, gbc); final RefactoringSettings refactoringSettings = RefactoringSettings.getInstance(); myCbSafeDelete.setSelected(refactoringSettings.SAFE_DELETE_WHEN_DELETE); myCbSearchInComments.setSelected(refactoringSettings.SAFE_DELETE_SEARCH_IN_COMMENTS); myCbSearchInNonJava.setSelected(refactoringSettings.SAFE_DELETE_SEARCH_IN_NON_JAVA); myCbSafeDelete.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { updateControls(); } }); updateControls(); return panel; }