Search in sources :

Example 1 with JBCheckBox

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

the class HgBookmarkDialog method createCenterPanel.

@Override
@NotNull
protected JComponent createCenterPanel() {
    JPanel contentPanel = new JPanel(new GridBagLayout());
    GridBag g = new GridBag().setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP)).setDefaultAnchor(GridBagConstraints.LINE_START).setDefaultFill(GridBagConstraints.HORIZONTAL);
    JLabel icon = new JLabel(UIUtil.getQuestionIcon(), SwingConstants.LEFT);
    myBookmarkName = new JBTextField(13);
    myBookmarkName.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        public void textChanged(DocumentEvent e) {
            validateFields();
        }
    });
    JBLabel bookmarkLabel = new JBLabel("Bookmark name:");
    bookmarkLabel.setLabelFor(myBookmarkName);
    myActiveCheckbox = new JBCheckBox("Inactive", false);
    contentPanel.add(icon, g.nextLine().next().coverColumn(3).pady(DEFAULT_HGAP));
    contentPanel.add(bookmarkLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
    contentPanel.add(myBookmarkName, g.next().coverLine().setDefaultWeightX(1));
    contentPanel.add(myActiveCheckbox, g.nextLine().next().next().coverLine(2));
    return contentPanel;
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) DocumentAdapter(com.intellij.ui.DocumentAdapter) JBTextField(com.intellij.ui.components.JBTextField) GridBag(com.intellij.util.ui.GridBag) DocumentEvent(javax.swing.event.DocumentEvent) JBCheckBox(com.intellij.ui.components.JBCheckBox) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with JBCheckBox

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

the class TrelloRepositoryEditor method createCustomPanel.

@Nullable
@Override
protected JComponent createCustomPanel() {
    myBoardComboBox = new ComboBox(300);
    myBoardLabel = new JBLabel("Board:", SwingConstants.RIGHT);
    myBoardLabel.setLabelFor(myBoardComboBox);
    myListComboBox = new ComboBox(300);
    myListLabel = new JBLabel("List:", SwingConstants.RIGHT);
    myListLabel.setLabelFor(myListComboBox);
    myAllCardsCheckBox = new JBCheckBox("Include cards not assigned to me");
    return FormBuilder.createFormBuilder().addLabeledComponent(myBoardLabel, myBoardComboBox).addLabeledComponent(myListLabel, myListComboBox).addComponentToRightColumn(myAllCardsCheckBox).getPanel();
}
Also used : JBLabel(com.intellij.ui.components.JBLabel) ComboBox(com.intellij.openapi.ui.ComboBox) JBCheckBox(com.intellij.ui.components.JBCheckBox) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with JBCheckBox

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

the class CreateVirtualEnvDialog method layoutPanel.

protected void layoutPanel(final List<Sdk> allSdks) {
    final GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(2, 2, 2, 2);
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.0;
    myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.name")), c);
    c.gridx = 1;
    c.gridy = 0;
    c.gridwidth = 2;
    c.weightx = 1.0;
    myMainPanel.add(myName, c);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 1;
    c.weightx = 0.0;
    myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.location")), c);
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 2;
    c.weightx = 1.0;
    myMainPanel.add(myDestination, c);
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = 1;
    c.weightx = 0.0;
    myMainPanel.add(new JBLabel(PyBundle.message("sdk.create.venv.dialog.label.base.interpreter")), c);
    c.gridx = 1;
    c.gridy = 2;
    mySdkCombo = new ComboBox();
    c.insets = new Insets(2, 2, 2, 2);
    c.weightx = 1.0;
    myMainPanel.add(mySdkCombo, c);
    c.gridx = 2;
    c.gridy = 2;
    c.insets = new Insets(0, 0, 2, 2);
    c.weightx = 0.0;
    FixedSizeButton button = new FixedSizeButton();
    button.setPreferredSize(myDestination.getButton().getPreferredSize());
    myMainPanel.add(button, c);
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = 3;
    c.insets = new Insets(2, 2, 2, 2);
    mySitePackagesCheckBox = new JBCheckBox(PyBundle.message("sdk.create.venv.dialog.label.inherit.global.site.packages"));
    myMainPanel.add(mySitePackagesCheckBox, c);
    c.gridx = 0;
    c.gridy = 4;
    myMainPanel.add(myMakeAvailableToAllProjectsCheckbox, c);
    button.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            final PythonSdkType sdkType = PythonSdkType.getInstance();
            final FileChooserDescriptor descriptor = sdkType.getHomeChooserDescriptor();
            String suggestedPath = sdkType.suggestHomePath();
            VirtualFile suggestedDir = suggestedPath == null ? null : LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(suggestedPath));
            final NullableConsumer<Sdk> consumer = sdk -> {
                if (sdk == null)
                    return;
                if (!allSdks.contains(sdk)) {
                    allSdks.add(sdk);
                }
                updateSdkList(allSdks, sdk);
            };
            FileChooser.chooseFiles(descriptor, myProject, suggestedDir, new FileChooser.FileChooserConsumer() {

                @Override
                public void consume(List<VirtualFile> selectedFiles) {
                    String path = selectedFiles.get(0).getPath();
                    if (sdkType.isValidSdkHome(path)) {
                        path = FileUtil.toSystemDependentName(path);
                        Sdk newSdk = null;
                        for (Sdk sdk : allSdks) {
                            if (path.equals(sdk.getHomePath())) {
                                newSdk = sdk;
                            }
                        }
                        if (newSdk == null) {
                            newSdk = new PyDetectedSdk(path);
                        }
                        consumer.consume(newSdk);
                    }
                }

                @Override
                public void cancelled() {
                }
            });
        }
    });
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ComboBox(com.intellij.openapi.ui.ComboBox) ActionEvent(java.awt.event.ActionEvent) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) JBCheckBox(com.intellij.ui.components.JBCheckBox) ActionListener(java.awt.event.ActionListener) JBLabel(com.intellij.ui.components.JBLabel) ArrayList(java.util.ArrayList) List(java.util.List) Sdk(com.intellij.openapi.projectRoots.Sdk) NullableConsumer(com.intellij.util.NullableConsumer) FixedSizeButton(com.intellij.openapi.ui.FixedSizeButton)

Example 4 with JBCheckBox

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

the class XmlEmmetConfigurable method createFiltersCheckboxes.

public void createFiltersCheckboxes() {
    final List<ZenCodingFilter> filters = ZenCodingFilter.getInstances();
    final GridBagLayout layoutManager = new GridBagLayout();
    final GridBagConstraints constraints = new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.emptyInsets(), 0, 0);
    myFiltersListPanel.setLayout(layoutManager);
    for (int i = 0; i < filters.size(); i++) {
        ZenCodingFilter filter = filters.get(i);
        final JBCheckBox checkBox = new JBCheckBox(filter.getDisplayName());
        myFilterCheckboxes.put(filter.getSuffix(), checkBox);
        constraints.gridy = i;
        myFiltersListPanel.add(checkBox, constraints);
    }
    myFiltersListPanel.revalidate();
}
Also used : ZenCodingFilter(com.intellij.codeInsight.template.emmet.filters.ZenCodingFilter) JBCheckBox(com.intellij.ui.components.JBCheckBox)

Example 5 with JBCheckBox

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

the class NlIdPropertyItem method setValue.

@Override
public void setValue(Object value) {
    String newId = value != null ? stripIdPrefix(value.toString()) : "";
    String oldId = getValue();
    XmlTag tag = getTag();
    if (ourRefactoringChoice != REFACTOR_NO && oldId != null && !oldId.isEmpty() && !newId.isEmpty() && !oldId.equals(newId) && tag != null && tag.isValid()) {
        // Offer rename refactoring?
        XmlAttribute attribute = tag.getAttribute(SdkConstants.ATTR_ID, SdkConstants.ANDROID_URI);
        if (attribute != null) {
            Module module = getModel().getModule();
            Project project = module.getProject();
            XmlAttributeValue valueElement = attribute.getValueElement();
            if (valueElement != null && valueElement.isValid()) {
                // Exact replace only, no comment/text occurrence changes since it is non-interactive
                ValueResourceElementWrapper wrapper = new ValueResourceElementWrapper(valueElement);
                RenameProcessor processor = new RenameProcessor(project, wrapper, NEW_ID_PREFIX + newId, false, /*comments*/
                false);
                processor.setPreviewUsages(false);
                // Do a quick usage search to see if we need to ask about renaming
                UsageInfo[] usages = processor.findUsages();
                if (usages.length > 0) {
                    int choice = ourRefactoringChoice;
                    if (choice == REFACTOR_ASK) {
                        DialogBuilder builder = createDialogBuilder(project);
                        builder.setTitle("Update Usages?");
                        // UGH!
                        JPanel panel = new JPanel(new BorderLayout());
                        JLabel label = new JLabel("<html>" + "Update usages as well?<br>" + "This will update all XML references and Java R field references.<br>" + "<br>" + "</html>");
                        panel.add(label, BorderLayout.CENTER);
                        JBCheckBox checkBox = new JBCheckBox("Don't ask again during this session");
                        panel.add(checkBox, BorderLayout.SOUTH);
                        builder.setCenterPanel(panel);
                        builder.setDimensionServiceKey("idPropertyDimension");
                        builder.removeAllActions();
                        DialogBuilder.CustomizableAction yesAction = builder.addOkAction();
                        yesAction.setText(Messages.YES_BUTTON);
                        builder.addActionDescriptor(dialogWrapper -> new AbstractAction(Messages.NO_BUTTON) {

                            @Override
                            public void actionPerformed(ActionEvent actionEvent) {
                                dialogWrapper.close(DialogWrapper.NEXT_USER_EXIT_CODE);
                            }
                        });
                        builder.addCancelAction();
                        int exitCode = builder.show();
                        choice = exitCode == DialogWrapper.OK_EXIT_CODE ? REFACTOR_YES : exitCode == DialogWrapper.NEXT_USER_EXIT_CODE ? REFACTOR_NO : ourRefactoringChoice;
                        //noinspection AssignmentToStaticFieldFromInstanceMethod
                        ourRefactoringChoice = checkBox.isSelected() ? choice : REFACTOR_ASK;
                        if (exitCode == DialogWrapper.CANCEL_EXIT_CODE) {
                            return;
                        }
                    }
                    if (choice == REFACTOR_YES) {
                        processor.run();
                        return;
                    }
                }
            }
        }
    }
    super.setValue(!StringUtil.isEmpty(newId) ? NEW_ID_PREFIX + newId : null);
}
Also used : XmlAttribute(com.intellij.psi.xml.XmlAttribute) RenameProcessor(com.intellij.refactoring.rename.RenameProcessor) ActionEvent(java.awt.event.ActionEvent) XmlAttributeValue(com.intellij.psi.xml.XmlAttributeValue) JBCheckBox(com.intellij.ui.components.JBCheckBox) Project(com.intellij.openapi.project.Project) Module(com.intellij.openapi.module.Module) DialogBuilder(com.intellij.openapi.ui.DialogBuilder) UsageInfo(com.intellij.usageView.UsageInfo) XmlTag(com.intellij.psi.xml.XmlTag) ValueResourceElementWrapper(org.jetbrains.android.dom.wrappers.ValueResourceElementWrapper)

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