@Nullable private OptionGroup createBlankLinesOptionsGroup() { OptionGroup optionGroup = new OptionGroup(BLANK_LINES); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.before.package.statement"), "BLANK_LINES_BEFORE_PACKAGE"); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.after.package.statement"), "BLANK_LINES_AFTER_PACKAGE"); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.before.imports"), "BLANK_LINES_BEFORE_IMPORTS"); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.after.imports"), "BLANK_LINES_AFTER_IMPORTS"); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.around.class"), "BLANK_LINES_AROUND_CLASS"); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.after.class.header"), "BLANK_LINES_AFTER_CLASS_HEADER"); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.after.anonymous.class.header"), "BLANK_LINES_AFTER_ANONYMOUS_CLASS_HEADER"); createOption(optionGroup, "Around field in interface:", "BLANK_LINES_AROUND_FIELD_IN_INTERFACE"); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.around.field"), "BLANK_LINES_AROUND_FIELD"); createOption(optionGroup, "Around method in interface:", "BLANK_LINES_AROUND_METHOD_IN_INTERFACE"); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.around.method"), "BLANK_LINES_AROUND_METHOD"); createOption(optionGroup, ApplicationBundle.message("editbox.blanklines.before.method.body"), "BLANK_LINES_BEFORE_METHOD_BODY"); initCustomOptions(optionGroup, BLANK_LINES); if (optionGroup.getComponents().length == 0) return null; return optionGroup; }
@Override protected JComponent createCenterPanel() { OptionGroup optionGroup = new OptionGroup(CodeEditorBundle.message("export.to.html.options.group")); myCbLineNumbers = new JCheckBox(CodeEditorBundle.message("export.to.html.options.show.line.numbers.checkbox")); optionGroup.add(myCbLineNumbers); for (UnnamedConfigurable printOption : myExtensions) { optionGroup.add(printOption.createComponent()); } myCbOpenInBrowser = new JCheckBox(CodeEditorBundle.message("export.to.html.open.generated.html.checkbox")); optionGroup.add(myCbOpenInBrowser); return optionGroup.createPanel(); }
@Override protected JComponent createNorthPanel() { OptionGroup optionGroup = new OptionGroup(); myTargetDirectoryField = new TextFieldWithBrowseButton(); optionGroup.add(com.intellij.codeEditor.printing.ExportToHTMLDialog.assignLabel(myTargetDirectoryField, myProject)); return optionGroup.createPanel(); }
@Override protected JComponent createCenterPanel() { if (!myCanBeOpenInBrowser) return null; OptionGroup optionGroup = new OptionGroup(); addOptions(optionGroup); return optionGroup.createPanel(); }
@Nullable private OptionGroup createKeepBlankLinesOptionsGroup() { OptionGroup optionGroup = new OptionGroup(BLANK_LINES_KEEP); createOption(optionGroup, ApplicationBundle.message("editbox.keep.blanklines.in.declarations"), "KEEP_BLANK_LINES_IN_DECLARATIONS"); createOption(optionGroup, ApplicationBundle.message("editbox.keep.blanklines.in.code"), "KEEP_BLANK_LINES_IN_CODE"); createOption(optionGroup, ApplicationBundle.message("editbox.keep.blanklines.before.rbrace"), "KEEP_BLANK_LINES_BEFORE_RBRACE"); initCustomOptions(optionGroup, BLANK_LINES_KEEP); if (optionGroup.getComponents().length == 0) return null; return optionGroup; }
private void doCreateOption(OptionGroup optionGroup, String title, IntOption option, String fieldName) { String renamed = myRenamedFields.get(fieldName); if (renamed != null) title = renamed; JBLabel l = new JBLabel(title); optionGroup.add(l, option.myTextField); myOptions.add(option); }
@NotNull private JPanel createPanel() { OptionGroup group = new OptionGroup(ApplicationBundle.message("arrangement.settings.additional.title")); JPanel textWithComboPanel = new JPanel(); textWithComboPanel.setLayout(new BoxLayout(textWithComboPanel, BoxLayout.LINE_AXIS)); textWithComboPanel.add(new JLabel(ApplicationBundle.message("arrangement.settings.additional.force.combobox.name"))); textWithComboPanel.add(Box.createRigidArea(JBUI.size(5, 0))); textWithComboPanel.add(myForceRearrangeComboBox); group.add(textWithComboPanel); return group.createPanel(); }
@Nonnull private JPanel createPanel() { OptionGroup group = new OptionGroup(ApplicationBundle.message("arrangement.settings.additional.title")); JPanel textWithComboPanel = new JPanel(); textWithComboPanel.setLayout(new BoxLayout(textWithComboPanel, BoxLayout.LINE_AXIS)); textWithComboPanel.add(new JLabel(ApplicationBundle.message("arrangement.settings.additional.force.combobox.name"))); textWithComboPanel.add(Box.createRigidArea(new Dimension(5, 0))); textWithComboPanel.add(myForceRearrangeComboBox); group.add(textWithComboPanel); return group.createPanel(); }
protected void addOptions(OptionGroup optionGroup) { myCbOpenInBrowser = new JCheckBox(); myCbOpenInBrowser.setText(InspectionsBundle.message("inspection.export.open.option")); optionGroup.add(myCbOpenInBrowser); }
@Override protected void init() { super.init(); JPanel optionsPanel = new JPanel(new GridBagLayout()); OptionGroup keepBlankLinesOptionsGroup = createKeepBlankLinesOptionsGroup(); OptionGroup blankLinesOptionsGroup = createBlankLinesOptionsGroup(); if (keepBlankLinesOptionsGroup != null) { keepBlankLinesOptionsGroup.setAnchor(keepBlankLinesOptionsGroup.findAnchor()); optionsPanel.add(keepBlankLinesOptionsGroup.createPanel(), new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); } if (blankLinesOptionsGroup != null) { blankLinesOptionsGroup.setAnchor(blankLinesOptionsGroup.findAnchor()); optionsPanel.add(blankLinesOptionsGroup.createPanel(), new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); } UIUtil.mergeComponentsWithAnchor(keepBlankLinesOptionsGroup, blankLinesOptionsGroup); optionsPanel.add(new JPanel(), new GridBagConstraints(0, 2, 1, 1, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); optionsPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10)); JScrollPane scroll = ScrollPaneFactory.createScrollPane(optionsPanel, true); scroll.getVerticalScrollBar().setUnitIncrement(10); scroll.setMinimumSize(new Dimension(optionsPanel.getPreferredSize().width + scroll.getVerticalScrollBar().getPreferredSize().width + 5, -1)); scroll.setPreferredSize(scroll.getMinimumSize()); myPanel .add(scroll, new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); final JPanel previewPanel = createPreviewPanel(); myPanel .add(previewPanel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); installPreviewPanel(previewPanel); addPanelToWatch(myPanel); myIsFirstUpdate = false; }
private void initCustomOptions(OptionGroup optionGroup, String groupName) { for (Trinity<Class<? extends CustomCodeStyleSettings>, String, String> each : myCustomOptions.get(groupName)) { doCreateOption(optionGroup, each.third, new IntOption(each.first, each.second), each.second); } }
private void createOption(OptionGroup optionGroup, String title, String fieldName) { if (myAllOptionsAllowed || myAllowedOptions.contains(fieldName)) { doCreateOption(optionGroup, title, new IntOption(fieldName), fieldName); } }
@Override protected JComponent createNorthPanel() { OptionGroup optionGroup = new OptionGroup(); myRbCurrentFile = new JRadioButton(CodeEditorBundle.message("export.to.html.file.name.radio", (myFileName != null ? myFileName : ""))); optionGroup.add(myRbCurrentFile); myRbSelectedText = new JRadioButton(CodeEditorBundle.message("export.to.html.selected.text.radio")); optionGroup.add(myRbSelectedText); myRbCurrentPackage = new JRadioButton( CodeEditorBundle.message("export.to.html.all.files.in.directory.radio", (myDirectoryName != null ? myDirectoryName : ""))); optionGroup.add(myRbCurrentPackage); myCbIncludeSubpackages = new JCheckBox(CodeEditorBundle.message("export.to.html.include.subdirectories.checkbox")); optionGroup.add(myCbIncludeSubpackages, true); FileTextField field = FileChooserFactory.getInstance().createFileTextField(FileChooserDescriptorFactory.createSingleFolderDescriptor(), myDisposable); myTargetDirectoryField = new TextFieldWithBrowseButton(field.getField()); LabeledComponent<TextFieldWithBrowseButton> labeledComponent = assignLabel(myTargetDirectoryField, myProject); optionGroup.add(labeledComponent); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(myRbCurrentFile); buttonGroup.add(myRbSelectedText); buttonGroup.add(myRbCurrentPackage); ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myCbIncludeSubpackages.setEnabled(myRbCurrentPackage.isSelected()); } }; myRbCurrentFile.addActionListener(actionListener); myRbSelectedText.addActionListener(actionListener); myRbCurrentPackage.addActionListener(actionListener); return optionGroup.createPanel(); }
@Override protected void init() { super.init(); JPanel optionsPanel = new JPanel(new GridBagLayout()); OptionGroup keepBlankLinesOptionsGroup = createKeepBlankLinesOptionsGroup(); OptionGroup blankLinesOptionsGroup = createBlankLinesOptionsGroup(); if (keepBlankLinesOptionsGroup != null) { keepBlankLinesOptionsGroup.setAnchor(keepBlankLinesOptionsGroup.findAnchor()); optionsPanel.add(keepBlankLinesOptionsGroup.createPanel(), new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); } if (blankLinesOptionsGroup != null) { blankLinesOptionsGroup.setAnchor(blankLinesOptionsGroup.findAnchor()); optionsPanel.add(blankLinesOptionsGroup.createPanel(), new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); } UIUtil.mergeComponentsWithAnchor(keepBlankLinesOptionsGroup, blankLinesOptionsGroup); optionsPanel.add(new JPanel(), new GridBagConstraints(0, 2, 1, 1, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); JScrollPane scroll = ScrollPaneFactory.createScrollPane(optionsPanel); scroll.setBorder(null); scroll.setMinimumSize(new Dimension(optionsPanel.getPreferredSize().width + scroll.getVerticalScrollBar().getPreferredSize().width + 5, -1)); scroll.setPreferredSize(scroll.getMinimumSize()); myPanel .add(scroll, new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); final JPanel previewPanel = createPreviewPanel(); myPanel .add(previewPanel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); installPreviewPanel(previewPanel); addPanelToWatch(myPanel); myIsFirstUpdate = false; }
@Override protected void init() { super.init(); JPanel optionsPanel = new JPanel(new GridBagLayout()); OptionGroup keepBlankLinesOptionsGroup = createKeepBlankLinesOptionsGroup(); OptionGroup blankLinesOptionsGroup = createBlankLinesOptionsGroup(); if (keepBlankLinesOptionsGroup != null) { keepBlankLinesOptionsGroup.setAnchor(keepBlankLinesOptionsGroup.findAnchor()); optionsPanel.add(keepBlankLinesOptionsGroup.createPanel(), new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); } if (blankLinesOptionsGroup != null) { blankLinesOptionsGroup.setAnchor(blankLinesOptionsGroup.findAnchor()); optionsPanel.add(blankLinesOptionsGroup.createPanel(), new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); } UIUtil.mergeComponentsWithAnchor(keepBlankLinesOptionsGroup, blankLinesOptionsGroup); optionsPanel.add(new JPanel(), new GridBagConstraints(0, 2, 1, 1, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); JScrollPane scroll = ScrollPaneFactory.createScrollPane(optionsPanel, true); scroll.getVerticalScrollBar().setUnitIncrement(10); scroll.setMinimumSize(new Dimension(optionsPanel.getPreferredSize().width + scroll.getVerticalScrollBar().getPreferredSize().width + 5, -1)); scroll.setPreferredSize(scroll.getMinimumSize()); myPanel .add(scroll, new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); final JPanel previewPanel = createPreviewPanel(); myPanel .add(previewPanel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); installPreviewPanel(previewPanel); addPanelToWatch(myPanel); myIsFirstUpdate = false; }