use of com.intellij.ui.StateRestoringCheckBox in project intellij-community by JetBrains.
the class DebuggerDataViewsConfigurable method createComponent.
@Override
public JComponent createComponent() {
if (myProject == null) {
myProject = JavaDebuggerSupport.getContextProjectForEditorFieldsInDebuggerConfigurables();
}
final JPanel panel = new JPanel(new GridBagLayout());
myCbAutoscroll = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.autoscroll"));
myCbShowSyntheticFields = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.synthetic.fields"));
myCbShowValFieldsAsLocalVariables = new StateRestoringCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.val.fields.as.locals"));
myCbHideNullArrayElements = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.hide.null.array.elements"));
myCbShowStatic = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.static.fields"));
myCbShowStaticFinalFields = new StateRestoringCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.static.final.fields"));
myCbEnableAlternateViews = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.alternate.view"));
myCbShowStatic.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (myCbShowStatic.isSelected()) {
myCbShowStaticFinalFields.makeSelectable();
} else {
myCbShowStaticFinalFields.makeUnselectable(false);
}
}
});
myCbShowSyntheticFields.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (myCbShowSyntheticFields.isSelected()) {
myCbShowValFieldsAsLocalVariables.makeSelectable();
} else {
myCbShowValFieldsAsLocalVariables.makeUnselectable(false);
}
}
});
myCbShowDeclaredType = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.declared.type"));
myCbShowFQNames = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.fq.names"));
myCbShowObjectId = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.object.id"));
myCbHexValue = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.hex.value"));
myCbShowStringsType = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.show.strings.type"));
myCbEnableToString = new JCheckBox(DebuggerBundle.message("label.base.renderer.configurable.enable.toString"));
myRbAllThatOverride = new JRadioButton(DebuggerBundle.message("label.base.renderer.configurable.all.overriding"));
myRbFromList = new JRadioButton(DebuggerBundle.message("label.base.renderer.configurable.classes.from.list"));
ButtonGroup group = new ButtonGroup();
group.add(myRbAllThatOverride);
group.add(myRbFromList);
myToStringFilterEditor = new ClassFilterEditor(myProject, null, "reference.viewBreakpoints.classFilters.newPattern");
myCbEnableToString.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
final boolean enabled = myCbEnableToString.isSelected();
myRbAllThatOverride.setEnabled(enabled);
myRbFromList.setEnabled(enabled);
myToStringFilterEditor.setEnabled(enabled && myRbFromList.isSelected());
}
});
myRbFromList.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
myToStringFilterEditor.setEnabled(myCbEnableToString.isSelected() && myRbFromList.isSelected());
}
});
panel.add(myCbAutoscroll, new GridBagConstraints(0, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insetsTop(4), 0, 0));
final JPanel showPanel = new JPanel(new GridBagLayout());
showPanel.setBorder(IdeBorderFactory.createTitledBorder("Show", true));
showPanel.add(myCbShowDeclaredType, new GridBagConstraints(0, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.emptyInsets(), 0, 0));
showPanel.add(myCbShowObjectId, new GridBagConstraints(0, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insetsTop(4), 0, 0));
showPanel.add(myCbShowSyntheticFields, new GridBagConstraints(1, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insetsLeft(10), 0, 0));
showPanel.add(myCbShowStatic, new GridBagConstraints(1, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insets(4, 10, 0, 0), 0, 0));
showPanel.add(myCbShowValFieldsAsLocalVariables, new GridBagConstraints(2, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insets(4, 10, 0, 0), 0, 0));
showPanel.add(myCbShowStaticFinalFields, new GridBagConstraints(2, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insets(4, 10, 0, 0), 0, 0));
showPanel.add(myCbShowFQNames, new GridBagConstraints(3, RELATIVE, 1, 1, 1.0, 0.0, WEST, NONE, JBUI.insetsLeft(10), 0, 0));
panel.add(showPanel, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, WEST, HORIZONTAL, JBUI.insetsTop(4), 0, 0));
//final JPanel arraysPanel = new JPanel(new BorderLayout(0, UIUtil.DEFAULT_VGAP));
//final JComponent arraysComponent = myArrayRendererConfigurable.createComponent();
//assert arraysComponent != null;
//arraysPanel.add(arraysComponent, BorderLayout.CENTER);
//arraysPanel.add(myCbHideNullArrayElements, BorderLayout.SOUTH);
//arraysPanel.setBorder(IdeBorderFactory.createTitledBorder("Arrays", true));
//panel.add(arraysPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
panel.add(myCbShowStringsType, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, NORTH, HORIZONTAL, JBUI.emptyInsets(), 0, 0));
panel.add(myCbHexValue, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, NORTH, HORIZONTAL, JBUI.insetsTop(4), 0, 0));
panel.add(myCbHideNullArrayElements, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, NORTH, HORIZONTAL, JBUI.insetsTop(4), 0, 0));
panel.add(myCbEnableAlternateViews, new GridBagConstraints(0, RELATIVE, 1, 1, 0.0, 0.0, WEST, NONE, JBUI.insets(4, 0, 0, 10), 0, 0));
// starting 4-th row
panel.add(myCbEnableToString, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, WEST, NONE, JBUI.insetsTop(4), 0, 0));
panel.add(myRbAllThatOverride, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, WEST, NONE, JBUI.insetsLeft(12), 0, 0));
panel.add(myRbFromList, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 0.0, WEST, NONE, JBUI.insetsLeft(12), 0, 0));
myToStringFilterEditor.setMinimumSize(JBUI.size(50, 100));
panel.add(myToStringFilterEditor, new GridBagConstraints(0, RELATIVE, 3, 1, 1.0, 1.0, CENTER, BOTH, JBUI.insetsLeft(12), 0, 0));
return panel;
}
use of com.intellij.ui.StateRestoringCheckBox in project intellij-community by JetBrains.
the class DebuggerLaunchingConfigurable method getComponent.
@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"));
myCbShowAlternativeSource = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.show.alternative.source"));
myRbSocket = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.socket"));
myRbShmem = new JRadioButton(DebuggerBundle.message("label.debugger.launching.configurable.shmem"));
myCbKillImmediately = new JCheckBox(DebuggerBundle.message("label.debugger.general.configurable.kill.immediately"));
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(myCbShowAlternativeSource);
panel.add(myCbKillImmediately);
JPanel result = new JPanel(new BorderLayout());
result.add(panel, BorderLayout.NORTH);
return result;
}
use of com.intellij.ui.StateRestoringCheckBox in project intellij-community by JetBrains.
the class SafeDeleteDialog method createNorthPanel.
@Override
protected JComponent createNorthPanel() {
final JPanel panel = new JPanel(new GridBagLayout());
final GridBagConstraints gbc = new GridBagConstraints();
final String promptKey = isDelete() ? "prompt.delete.elements" : "search.for.usages.and.delete.elements";
final String warningMessage = DeleteUtil.generateWarningMessage(IdeBundle.message(promptKey), myElements);
gbc.insets = JBUI.insets(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);
if (isDelete()) {
gbc.gridy++;
gbc.gridx = 0;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
gbc.insets = JBUI.insets(4, 8, 0, 8);
myCbSafeDelete = new JCheckBox(IdeBundle.message("checkbox.safe.delete.with.usage.search"));
panel.add(myCbSafeDelete, gbc);
myCbSafeDelete.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateControls(myCbSearchInComments);
updateControls(myCbSearchTextOccurrences);
}
});
}
gbc.gridy++;
gbc.gridx = 0;
gbc.weightx = 0.0;
gbc.gridwidth = 1;
myCbSearchInComments = new StateRestoringCheckBox();
myCbSearchInComments.setText(RefactoringBundle.getSearchInCommentsAndStringsText());
panel.add(myCbSearchInComments, gbc);
if (needSearchForTextOccurrences()) {
gbc.gridx++;
myCbSearchTextOccurrences = new StateRestoringCheckBox();
myCbSearchTextOccurrences.setText(RefactoringBundle.getSearchForTextOccurrencesText());
panel.add(myCbSearchTextOccurrences, gbc);
}
final RefactoringSettings refactoringSettings = RefactoringSettings.getInstance();
if (myCbSafeDelete != null) {
myCbSafeDelete.setSelected(refactoringSettings.SAFE_DELETE_WHEN_DELETE);
}
myCbSearchInComments.setSelected(myDelegate != null ? myDelegate.isToSearchInComments(myElements[0]) : refactoringSettings.SAFE_DELETE_SEARCH_IN_COMMENTS);
if (myCbSearchTextOccurrences != null) {
myCbSearchTextOccurrences.setSelected(myDelegate != null ? myDelegate.isToSearchForTextOccurrences(myElements[0]) : refactoringSettings.SAFE_DELETE_SEARCH_IN_NON_JAVA);
}
updateControls(myCbSearchTextOccurrences);
updateControls(myCbSearchInComments);
return panel;
}
use of com.intellij.ui.StateRestoringCheckBox in project intellij-community by JetBrains.
the class IntroduceFieldCentralPanel method appendCheckboxes.
protected JPanel appendCheckboxes(ItemListener itemListener) {
GridBagConstraints gbConstraints = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.emptyInsets(), 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 = JBUI.insetsLeft(8);
}
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;
}
use of com.intellij.ui.StateRestoringCheckBox in project intellij-community by JetBrains.
the class IntroduceVariableDialog method createCenterPanel.
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 = JBUI.emptyInsets();
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 = JBUI.insetsLeft(8);
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 = JBUI.emptyInsets();
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;
}
Aggregations