use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.
the class GroovyLanguageCodeStyleSettingsProvider method getIndentOptionsEditor.
@Override
public IndentOptionsEditor getIndentOptionsEditor() {
return new SmartIndentOptionsEditor() {
private JTextField myLabelIndent;
private JLabel myLabelIndentLabel;
private JComboBox myLabelIndentStyle;
private JBLabel myStyleLabel;
@Override
protected void addComponents() {
super.addComponents();
myLabelIndent = new JTextField(4);
add(myLabelIndentLabel = new JLabel(ApplicationBundle.message("editbox.indent.label.indent")), myLabelIndent);
myStyleLabel = new JBLabel("Label indent style:");
myLabelIndentStyle = new JComboBox(new Object[] { ABSOLUTE, RELATIVE, RELATIVE_REVERSED });
add(myStyleLabel, myLabelIndentStyle);
}
@Override
public boolean isModified(final CodeStyleSettings settings, final CommonCodeStyleSettings.IndentOptions options) {
boolean isModified = super.isModified(settings, options);
isModified |= isFieldModified(myLabelIndent, options.LABEL_INDENT_SIZE);
isModified |= isLabelStyleModified(options.LABEL_INDENT_ABSOLUTE, settings.getCustomSettings(GroovyCodeStyleSettings.class).INDENT_LABEL_BLOCKS);
return isModified;
}
private boolean isLabelStyleModified(boolean absolute, boolean relative) {
if (absolute) {
return !ABSOLUTE.equals(myLabelIndentStyle.getSelectedItem());
} else if (relative) {
return !RELATIVE.equals(myLabelIndentStyle.getSelectedItem());
} else {
return !RELATIVE_REVERSED.equals(myLabelIndentStyle.getSelectedItem());
}
}
@Override
public void apply(final CodeStyleSettings settings, final CommonCodeStyleSettings.IndentOptions options) {
super.apply(settings, options);
options.LABEL_INDENT_SIZE = getFieldValue(myLabelIndent, Integer.MIN_VALUE, options.LABEL_INDENT_SIZE);
options.LABEL_INDENT_ABSOLUTE = ABSOLUTE.equals(myLabelIndentStyle.getSelectedItem());
settings.getCustomSettings(GroovyCodeStyleSettings.class).INDENT_LABEL_BLOCKS = RELATIVE.equals(myLabelIndentStyle.getSelectedItem());
}
@Override
public void reset(@NotNull final CodeStyleSettings settings, @NotNull final CommonCodeStyleSettings.IndentOptions options) {
super.reset(settings, options);
myLabelIndent.setText(Integer.toString(options.LABEL_INDENT_SIZE));
if (options.LABEL_INDENT_ABSOLUTE) {
myLabelIndentStyle.setSelectedItem(ABSOLUTE);
} else if (settings.getCustomSettings(GroovyCodeStyleSettings.class).INDENT_LABEL_BLOCKS) {
myLabelIndentStyle.setSelectedItem(RELATIVE);
} else {
myLabelIndentStyle.setSelectedItem(RELATIVE_REVERSED);
}
}
@Override
public void setEnabled(final boolean enabled) {
super.setEnabled(enabled);
myLabelIndent.setEnabled(enabled);
myLabelIndentLabel.setEnabled(enabled);
myStyleLabel.setEnabled(enabled);
myLabelIndentStyle.setEnabled(enabled);
}
};
}
use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.
the class GitUserNameNotDefinedDialog method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT);
JLabel description = new JLabel(getMessageText());
myNameTextField = new JTextField(20);
JBLabel nameLabel = new JBLabel("Name: ");
nameLabel.setDisplayedMnemonic('n');
nameLabel.setLabelFor(myNameTextField);
myEmailTextField = new JTextField(20);
JBLabel emailLabel = new JBLabel("E-mail: ");
emailLabel.setDisplayedMnemonic('e');
emailLabel.setLabelFor(myEmailTextField);
if (myProposedValues != null) {
myNameTextField.setText(myProposedValues.getFirst());
myEmailTextField.setText(myProposedValues.getSecond());
} else {
myNameTextField.setText(SystemProperties.getUserName());
}
myGlobalCheckbox = new JBCheckBox("Set properties globally", mySettings.shouldSetUserNameGlobally());
myGlobalCheckbox.setMnemonic('g');
JPanel rootPanel = new JPanel(new GridBagLayout());
GridBag g = new GridBag().setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP)).setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultFill(GridBagConstraints.HORIZONTAL);
rootPanel.add(description, g.nextLine().next().coverLine(3).pady(DEFAULT_HGAP));
rootPanel.add(icon, g.nextLine().next().coverColumn(3));
rootPanel.add(nameLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
rootPanel.add(myNameTextField, g.next());
rootPanel.add(emailLabel, g.nextLine().next().next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
rootPanel.add(myEmailTextField, g.next());
rootPanel.add(myGlobalCheckbox, g.nextLine().next().next().coverLine(2));
return rootPanel;
}
use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.
the class GitDefineRemoteDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel defineRemoteComponent = new JPanel(new GridBagLayout());
GridBag gb = new GridBag().setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultInsets(UIUtil.DEFAULT_VGAP, UIUtil.DEFAULT_HGAP, 0, 0);
defineRemoteComponent.add(new JBLabel("Name:"), gb.nextLine().next().anchor(GridBagConstraints.EAST));
defineRemoteComponent.add(myRemoteName, gb.next());
defineRemoteComponent.add(new JBLabel("URL: "), gb.nextLine().next().anchor(GridBagConstraints.EAST).insets(0, UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP, 0));
defineRemoteComponent.add(myRemoteUrl, gb.next());
return defineRemoteComponent;
}
use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.
the class GitNewResetDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new GridBagLayout());
GridBag gb = new GridBag().setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultInsets(0, UIUtil.DEFAULT_HGAP, UIUtil.LARGE_VGAP, 0);
String description = prepareDescription(myProject, myCommits);
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(description)), gb.nextLine().next().coverLine());
String explanation = "This will reset the current branch head to the selected commit, <br/>" + "and update the working tree and the index according to the selected mode:";
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(explanation), UIUtil.ComponentStyle.SMALL), gb.nextLine().next().coverLine());
for (GitResetMode mode : GitResetMode.values()) {
JBRadioButton button = new JBRadioButton(mode.getName());
button.setMnemonic(mode.getName().charAt(0));
myButtonGroup.add(button);
panel.add(button, gb.nextLine().next());
panel.add(new JBLabel(XmlStringUtil.wrapInHtml(mode.getDescription()), UIUtil.ComponentStyle.SMALL), gb.next());
}
myEnumModel = RadioButtonEnumModel.bindEnum(GitResetMode.class, myButtonGroup);
myEnumModel.setSelected(myDefaultMode);
return panel;
}
use of com.intellij.ui.components.JBLabel in project intellij-community by JetBrains.
the class GitRejectedPushUpdateDialog method createCenterPanel.
@Override
protected JComponent createCenterPanel() {
JBLabel desc = new JBLabel(wrapInHtml(makeDescription()));
JPanel options = new JPanel(new BorderLayout());
if (!myRebaseOverMergeProblemDetected) {
options.add(myAutoUpdateInFuture, BorderLayout.SOUTH);
}
if (!GitUtil.justOneGitRepository(myProject)) {
options.add(myUpdateAllRoots);
}
final int GAP = 15;
JPanel rootPanel = new JPanel(new BorderLayout(GAP, GAP));
rootPanel.add(desc);
rootPanel.add(options, BorderLayout.SOUTH);
JLabel iconLabel = new JLabel(myRebaseOverMergeProblemDetected ? UIUtil.getWarningIcon() : UIUtil.getQuestionIcon());
rootPanel.add(iconLabel, BorderLayout.WEST);
return rootPanel;
}
Aggregations