Search in sources :

Example 6 with JBCheckBox

use of com.intellij.ui.components.JBCheckBox in project intellij-community by JetBrains.

the class GithubRepositoryEditor method createCustomPanel.

@Nullable
@Override
protected JComponent createCustomPanel() {
    myHostLabel = new JBLabel("Host:", SwingConstants.RIGHT);
    JPanel myHostPanel = new JPanel(new BorderLayout(5, 0));
    myHostPanel.add(myURLText, BorderLayout.CENTER);
    myHostPanel.add(myShareUrlCheckBox, BorderLayout.EAST);
    myRepositoryLabel = new JBLabel("Repository:", SwingConstants.RIGHT);
    myRepoAuthor = new MyTextField("Repository Owner");
    myRepoName = new MyTextField("Repository Name");
    myRepoAuthor.setPreferredSize("SomelongNickname");
    myRepoName.setPreferredSize("SomelongReponame-with-suffixes");
    JPanel myRepoPanel = new JPanel(new GridBagLayout());
    GridBag bag = new GridBag().setDefaultWeightX(1).setDefaultFill(GridBagConstraints.HORIZONTAL);
    myRepoPanel.add(myRepoAuthor, bag.nextLine().next());
    myRepoPanel.add(new JLabel("/"), bag.next().fillCellNone().insets(0, 5, 0, 5).weightx(0));
    myRepoPanel.add(myRepoName, bag.next());
    myTokenLabel = new JBLabel("API Token:", SwingConstants.RIGHT);
    myToken = new MyTextField("OAuth2 token");
    myTokenButton = new JButton("Create API token");
    myTokenButton.addActionListener(e -> {
        generateToken();
        doApply();
    });
    JPanel myTokenPanel = new JPanel();
    myTokenPanel.setLayout(new BorderLayout(5, 5));
    myTokenPanel.add(myToken, BorderLayout.CENTER);
    myTokenPanel.add(myTokenButton, BorderLayout.EAST);
    myShowNotAssignedIssues = new JBCheckBox("Include issues not assigned to me");
    installListener(myRepoAuthor);
    installListener(myRepoName);
    installListener(myToken);
    installListener(myShowNotAssignedIssues);
    return FormBuilder.createFormBuilder().setAlignLabelOnRight(true).addLabeledComponent(myHostLabel, myHostPanel).addLabeledComponent(myRepositoryLabel, myRepoPanel).addLabeledComponent(myTokenLabel, myTokenPanel).addComponentToRightColumn(myShowNotAssignedIssues).getPanel();
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) GridBag(com.intellij.util.ui.GridBag) JBCheckBox(com.intellij.ui.components.JBCheckBox) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with JBCheckBox

use of com.intellij.ui.components.JBCheckBox in project intellij-community by JetBrains.

the class IdeaGradleSystemSettingsControlBuilder method fillUi.

@Override
public void fillUi(@NotNull PaintAwarePanel canvas, int indentLevel) {
    if (!dropOfflineModeBox) {
        myOfflineModeBox = new JBCheckBox(GradleBundle.message("gradle.settings.text.offline_work"));
        canvas.add(myOfflineModeBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
    }
    addServiceDirectoryControl(canvas, indentLevel);
    if (!dropVmOptions) {
        myGradleVmOptionsLabel = new JBLabel(GradleBundle.message("gradle.settings.text.vm.options"));
        canvas.add(myGradleVmOptionsLabel, ExternalSystemUiUtil.getLabelConstraints(indentLevel));
        myGradleVmOptionsField = new JBTextField();
        canvas.add(myGradleVmOptionsField, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
    }
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) JBTextField(com.intellij.ui.components.JBTextField) JBCheckBox(com.intellij.ui.components.JBCheckBox)

Example 8 with JBCheckBox

use of com.intellij.ui.components.JBCheckBox in project intellij-community by JetBrains.

the class ParameterNameHintsConfigurable method createOptionsPanel.

@Nullable
private JPanel createOptionsPanel(@NotNull Language language) {
    List<Option> options = getOptions(language);
    if (options.isEmpty()) {
        return null;
    }
    JPanel languageOptionsPanel = new JPanel();
    BoxLayout boxLayout = new BoxLayout(languageOptionsPanel, BoxLayout.Y_AXIS);
    languageOptionsPanel.setLayout(boxLayout);
    if (!options.isEmpty()) {
        languageOptionsPanel.setBorder(IdeBorderFactory.createTitledBorder("Options"));
    }
    for (Option option : options) {
        JBCheckBox box = new JBCheckBox(option.getName(), option.get());
        myOptions.put(option, box);
        languageOptionsPanel.add(box);
    }
    return languageOptionsPanel;
}
Also used : Option(com.intellij.codeInsight.hints.Option) JBCheckBox(com.intellij.ui.components.JBCheckBox) Nullable(org.jetbrains.annotations.Nullable)

Example 9 with JBCheckBox

use of com.intellij.ui.components.JBCheckBox in project intellij-community by JetBrains.

the class ProjectStartupConfigurable method installRenderers.

private void installRenderers() {
    final TableColumn checkboxColumn = myTable.getColumnModel().getColumn(ProjectStartupTasksTableModel.IS_SHARED_COLUMN);
    final String header = checkboxColumn.getHeaderValue().toString();
    final FontMetrics fm = myTable.getFontMetrics(myTable.getTableHeader().getFont());
    final int width = -new JBCheckBox().getPreferredSize().width + fm.stringWidth(header + "ww");
    TableUtil.setupCheckboxColumn(checkboxColumn, width);
    checkboxColumn.setCellRenderer(new BooleanTableCellRenderer());
    myTable.getTableHeader().setResizingAllowed(false);
    myTable.getTableHeader().setReorderingAllowed(false);
    final TableColumn nameColumn = myTable.getColumnModel().getColumn(ProjectStartupTasksTableModel.NAME_COLUMN);
    nameColumn.setCellRenderer(new ColoredTableCellRenderer() {

        @Override
        protected void customizeCellRenderer(JTable table, @Nullable Object value, boolean selected, boolean hasFocus, int row, int column) {
            final RunnerAndConfigurationSettings settings = myModel.getAllConfigurations().get(row);
            setIcon(settings.getConfiguration().getIcon());
            append(settings.getName());
        }
    });
}
Also used : TableColumn(javax.swing.table.TableColumn) RelativePoint(com.intellij.ui.awt.RelativePoint) JBCheckBox(com.intellij.ui.components.JBCheckBox)

Example 10 with JBCheckBox

use of com.intellij.ui.components.JBCheckBox in project intellij-plugins by JetBrains.

the class PhoneGapRunConfigurationEditor method createEditor.

@NotNull
@Override
protected JComponent createEditor() {
    myExecutablePathField = PhoneGapUtil.createPhoneGapExecutableTextField(myProject);
    myWorkDirField = PhoneGapUtil.createPhoneGapWorkingDirectoryField(myProject);
    myPlatformField = new ComboBoxWithMoreOption(getDefaultPlatforms(), getNonDefaultPlatforms());
    myCommand = new ComboBox();
    myEnvComponent = new EnvironmentVariablesTextFieldWithBrowseButton();
    myEnvComponent.setPassParentEnvs(true);
    myHasTarget = new JBCheckBox("Specify target");
    myTarget = new PhoneGapTargetsPanel();
    myExtraArgsTextField = new JBTextField(15);
    myCommand.setMinimumAndPreferredWidth(200);
    myPlatformField.setMinimumAndPreferredWidth(200);
    myTarget.getTargetsField().setMinimumAndPreferredWidth(myPlatformField.getPreferredSize().width);
    myTarget.setDataProvider(new ReloadableComboBoxPanel.DataProvider<String>() {

        @NotNull
        @Override
        public Set<String> getCachedValues() {
            return ContainerUtil.newHashOrEmptySet(null);
        }

        @Override
        public void updateValuesAsynchronously() {
            if (!myTarget.isEnabled()) {
                processEmpty();
                return;
            }
            final String platform = getPlatformAsCodeFromField();
            final String command = (String) myCommand.getSelectedItem();
            final PhoneGapTargets targetsProvider = PhoneGapTargets.createTargetsList(myProject, platform);
            if (targetsProvider == null) {
                processEmpty();
                return;
            }
            ApplicationManager.getApplication().executeOnPooledThread(() -> {
                final String currentText = myTarget.getTargetsField().getText();
                final Set<String> targets = ContainerUtil.newLinkedHashSet(PhoneGapTargets.listTargets(targetsProvider, command));
                if (!StringUtil.isEmpty(currentText) && !targets.contains(currentText)) {
                    targets.add(currentText);
                }
                UIUtil.invokeLaterIfNeeded(() -> myTarget.onUpdateValues(targets));
            });
        }

        private void processEmpty() {
            myTarget.onUpdateValues(ContainerUtil.newHashOrEmptySet(null));
        }
    });
    setListenerForPlatforms();
    setListenerForCommand();
    setListenerForHasTarget();
    setListenerForExecutablePath();
    setCommandList();
    return FormBuilder.createFormBuilder().addLabeledComponent(PhoneGapBundle.message("phonegap.conf.executable.name"), myExecutablePathField).addLabeledComponent(PhoneGapBundle.message("phonegap.conf.work.dir.name"), myWorkDirField).addLabeledComponent(ExecutionBundle.message("environment.variables.component.title"), myEnvComponent).addLabeledComponent("Command:", myCommand).addLabeledComponent("Platform:", myPlatformField).addLabeledComponent(PhoneGapBundle.message("phonegap.conf.extra.args.name"), myExtraArgsTextField).addLabeledComponent(myHasTarget, myTarget.getMainPanel()).getPanel();
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) ComboBox(com.intellij.openapi.ui.ComboBox) JBTextField(com.intellij.ui.components.JBTextField) NotNull(org.jetbrains.annotations.NotNull) JBCheckBox(com.intellij.ui.components.JBCheckBox) ReloadableComboBoxPanel(com.intellij.util.ui.ReloadableComboBoxPanel) EnvironmentVariablesTextFieldWithBrowseButton(com.intellij.execution.configuration.EnvironmentVariablesTextFieldWithBrowseButton) PhoneGapTargets(com.github.masahirosuzuka.PhoneGapIntelliJPlugin.commandLine.PhoneGapTargets) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

JBCheckBox (com.intellij.ui.components.JBCheckBox)28 JBLabel (com.intellij.ui.components.JBLabel)10 Nullable (org.jetbrains.annotations.Nullable)5 ComboBox (com.intellij.openapi.ui.ComboBox)4 JBTextField (com.intellij.ui.components.JBTextField)4 GridBag (com.intellij.util.ui.GridBag)4 NotNull (org.jetbrains.annotations.NotNull)4 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)3 ActionEvent (java.awt.event.ActionEvent)3 ProjectSelector (com.google.cloud.tools.intellij.project.ProjectSelector)2 ZenCodingFilter (com.intellij.codeInsight.template.emmet.filters.ZenCodingFilter)2 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)2 ActionListener (java.awt.event.ActionListener)2 ItemEvent (java.awt.event.ItemEvent)2 ItemListener (java.awt.event.ItemListener)2 PhoneGapTargets (com.github.masahirosuzuka.PhoneGapIntelliJPlugin.commandLine.PhoneGapTargets)1 Option (com.intellij.codeInsight.hints.Option)1 EnvironmentVariablesTextFieldWithBrowseButton (com.intellij.execution.configuration.EnvironmentVariablesTextFieldWithBrowseButton)1 FacetEditorValidator (com.intellij.facet.ui.FacetEditorValidator)1 FacetValidatorsManager (com.intellij.facet.ui.FacetValidatorsManager)1