com.intellij.ui.components.JBCheckBox Java Examples

The following examples show how to use com.intellij.ui.components.JBCheckBox. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenerateDialog.java    From android-parcelable-intellij-plugin with Apache License 2.0 6 votes vote down vote up
protected GenerateDialog(final PsiClass psiClass) {
    super(psiClass.getProject());
    setTitle("Select Fields for Parcelable Generation");

    fieldsCollection = new CollectionListModel<PsiField>();
    final JBList fieldList = new JBList(fieldsCollection);
    fieldList.setCellRenderer(new DefaultPsiElementCellRenderer());
    final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(fieldList).disableAddAction();
    final JPanel panel = decorator.createPanel();

    fieldsComponent = LabeledComponent.create(panel, "Fields to include in Parcelable");

    includeSubclasses = new JBCheckBox("Include fields from base classes");
    setupCheckboxClickAction(psiClass);
    showCheckbox = psiClass.getFields().length != psiClass.getAllFields().length;

    updateFieldsDisplay(psiClass);
    init();
}
 
Example #2
Source File: GraphDatabaseSupportConfiguration.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
    isModified = false;

    analytics = AnalyticsApplicationComponent.getInstance();
    analyticsCheckBox = new JBCheckBox("Send anonymous usage statistics",
            SettingsComponent.getInstance().isAnalyticEnabled());
    analyticsCheckBox.addActionListener(e -> isModified = true);

    invertZoomCheckBox = new JBCheckBox("Invert mouse wheel zoom controls in Graph View",
            SettingsComponent.getInstance().isGraphViewZoomInverted());
    invertZoomCheckBox.addActionListener(e -> isModified = true);

    JPanel rootPane = new JPanel();
    rootPane.setLayout(new BoxLayout(rootPane, BoxLayout.Y_AXIS));
    rootPane.add(analyticsCheckBox);
    rootPane.add(invertZoomCheckBox);

    return rootPane;
}
 
Example #3
Source File: ParameterNameHintsConfigurable.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void createUIComponents() {
  List<Language> languages = getBaseLanguagesWithProviders();

  Language selected = myInitiallySelectedLanguage;
  if (selected == null) {
    selected = languages.get(0);
  }

  String text = getLanguageBlackList(selected);
  myEditorTextField = createEditor(text, myNewPreselectedItem);
  myEditorTextField.addDocumentListener(new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      updateOkEnabled();
    }
  });

  myDoNotShowIfParameterNameContainedInMethodName = new JBCheckBox();
  myShowWhenMultipleParamsWithSameType = new JBCheckBox();

  ParameterNameHintsSettings settings = ParameterNameHintsSettings.getInstance();
  myDoNotShowIfParameterNameContainedInMethodName.setSelected(settings.isDoNotShowIfMethodNameContainsParameterName());
  myShowWhenMultipleParamsWithSameType.setSelected(settings.isShowForParamsWithSameType());

  initLanguageCombo(languages, selected);
}
 
Example #4
Source File: SelectFileTemplateDialog.java    From PackageTemplates with Apache License 2.0 6 votes vote down vote up
@NotNull
private JPanel getOptionsPanel(final JPanel root) {
    JPanel options = new JPanel(new GridBagLayout());
    GridBag bag = new GridBag()
            .setDefaultInsets(new JBInsets(0, 4, 0, 4))
            .setDefaultFill(GridBagConstraints.HORIZONTAL);

    cbAddInternal = new JBCheckBox("Internal");
    cbAddJ2EE = new JBCheckBox("J2EE");

    ItemListener itemListener = e -> {
        root.remove(comboBox);
        comboBox = getSelector();
        root.add(comboBox);
        root.revalidate();
    };

    cbAddInternal.addItemListener(itemListener);
    cbAddJ2EE.addItemListener(itemListener);

    options.add(cbAddInternal, bag.nextLine().next());
    options.add(cbAddJ2EE, bag.next());
    return options;
}
 
Example #5
Source File: RecentLocationsAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void initSearchActions(@Nonnull Project project,
                                      @Nonnull RecentLocationsDataModel data,
                                      @Nonnull ListWithFilter<RecentLocationItem> listWithFilter,
                                      @Nonnull JBList<RecentLocationItem> list,
                                      @Nonnull JBCheckBox checkBox,
                                      @Nonnull JBPopup popup,
                                      @Nonnull Ref<? super Boolean> navigationRef) {
  listWithFilter.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent event) {
      int clickCount = event.getClickCount();
      if (clickCount > 1 && clickCount % 2 == 0) {
        event.consume();
        navigateToSelected(project, list, popup, navigationRef);
      }
    }
  });

  DumbAwareAction.create(e -> navigateToSelected(project, list, popup, navigationRef)).registerCustomShortcutSet(CustomShortcutSet.fromString("ENTER"), listWithFilter, popup);

  DumbAwareAction.create(e -> removePlaces(project, listWithFilter, list, data, checkBox.isSelected()))
          .registerCustomShortcutSet(CustomShortcutSet.fromString("DELETE", "BACK_SPACE"), listWithFilter, popup);
}
 
Example #6
Source File: RecentLocationsAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static JBCheckBox createCheckbox(@Nonnull ShortcutSet checkboxShortcutSet, boolean showChanged) {
  String text = "<html>" +
                IdeBundle.message("recent.locations.title.text") +
                " <font color=\"" +
                SHORTCUT_HEX_COLOR +
                "\">" +
                KeymapUtil.getShortcutsText(checkboxShortcutSet.getShortcuts()) +
                "</font>" +
                "</html>";
  JBCheckBox checkBox = new JBCheckBox(text);
  checkBox.setBorder(JBUI.Borders.empty());
  checkBox.setOpaque(false);
  checkBox.setSelected(showChanged);

  return checkBox;
}
 
Example #7
Source File: Settings.java    From GitLink with MIT License 6 votes vote down vote up
boolean isModified()
{
    for (Map.Entry<UrlModifier, JBCheckBox> entry : this.urlModifierCheckBoxes.entrySet()) {
        if (entry.getValue().isSelected() != this.preferences.isModifierEnabled(entry.getKey())) {
            return true;
        }
    }

    return
        this.preferences.isEnabled() != this.enabledCheckBox.isSelected() ||
        this.preferences.shouldCheckCommitExistsOnRemote() != this.checkCommitExistsOnRemote.isSelected() ||
        !this.preferences.getRemoteHost().equals(this.hostSelect.getSelectedItem()) ||
        !this.preferences.remoteName.equals(this.remoteNameTextField.getText()) ||
        !this.preferences.defaultBranchName.equals(this.defaultBranchTextField.getText()) ||
        !this.preferences.customFileUrlAtCommitTemplate.equals(this.customFileUrlAtCommitTemplateTextField.getText()) ||
        !this.preferences.customFileUrlOnBranchTemplate.equals(this.customFileUrlOnBranchTemplateTextField.getText()) ||
        !this.preferences.customCommitUrlTemplate.equals(this.customCommitUrlTemplateTextField.getText());
}
 
Example #8
Source File: CamelAnnotatorPage.java    From camel-idea-plugin with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
    realTimeEndpointValidationCatalogCheckBox = new JBCheckBox("Real time validation of Camel endpoints in editor");
    highlightCustomOptionsCheckBox = new JBCheckBox("Highlight custom endpoint options as warnings in editor");
    realTimeSimpleValidationCatalogCheckBox = new JBCheckBox("Real time validation of Camel simple language in editor");
    realTimeJSonPathValidationCatalogCheckBox = new JBCheckBox("Real time validation of Camel JSonPath language in editor");
    realTimeIdReferenceTypeValidationCheckBox = new JBCheckBox("Real time type validation when referencing beans");
    realTimeBeanMethodValidationCheckBox = new JBCheckBox("Real time validation of call bean method in editor");

    // use mig layout which is like a spread-sheet with 2 columns, which we can span if we only have one element
    jPanel = new JPanel(new MigLayout("fillx,wrap 2", "[left]rel[grow,fill]"));
    jPanel.setOpaque(false);

    jPanel.add(realTimeEndpointValidationCatalogCheckBox, "span 2");
    jPanel.add(highlightCustomOptionsCheckBox, "span 2");
    jPanel.add(realTimeSimpleValidationCatalogCheckBox, "span 2");
    jPanel.add(realTimeJSonPathValidationCatalogCheckBox, "span 2");
    jPanel.add(realTimeIdReferenceTypeValidationCheckBox, "span 2");
    jPanel.add(realTimeBeanMethodValidationCheckBox, "span 2");

    result = new JPanel(new BorderLayout());
    result.add(jPanel, BorderLayout.NORTH);
    reset();
    return result;
}
 
Example #9
Source File: Settings.java    From GitLink with MIT License 6 votes vote down vote up
void reset()
{
    this.enabledCheckBox.setSelected(this.preferences.isEnabled());
    this.checkCommitExistsOnRemote.setSelected(this.preferences.shouldCheckCommitExistsOnRemote());
    this.remoteNameTextField.setText(this.preferences.remoteName);
    this.defaultBranchTextField.setText(this.preferences.defaultBranchName);
    this.hostSelect.setSelectedItem(this.preferences.getRemoteHost());
    this.customFileUrlAtCommitTemplateTextField.setText(this.preferences.customFileUrlAtCommitTemplate);
    this.customFileUrlOnBranchTemplateTextField.setText(this.preferences.customFileUrlOnBranchTemplate);
    this.customCommitUrlTemplateTextField.setText(this.preferences.customCommitUrlTemplate);

    this.clearErrorStyling(this.customFileUrlOnBranchTemplateTextField);
    this.clearErrorStyling(this.customFileUrlAtCommitTemplateTextField);
    this.clearErrorStyling(this.customCommitUrlTemplateTextField);

    for (Map.Entry<UrlModifier, JBCheckBox> entry : this.urlModifierCheckBoxes.entrySet()) {
        entry.getValue().setSelected(this.preferences.isModifierEnabled(entry.getKey()));
    }
}
 
Example #10
Source File: Switcher.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private static JPanel createTopPanel(@Nonnull JBCheckBox showOnlyEditedFilesCheckBox, @Nonnull String title, boolean isMovable) {
  JPanel topPanel = new CaptionPanel();
  JBLabel titleLabel = new JBLabel(title);
  titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD));
  topPanel.add(titleLabel, BorderLayout.WEST);
  topPanel.add(showOnlyEditedFilesCheckBox, BorderLayout.EAST);

  Dimension size = topPanel.getPreferredSize();
  size.height = JBUIScale.scale(29);
  size.width = titleLabel.getPreferredSize().width + showOnlyEditedFilesCheckBox.getPreferredSize().width + JBUIScale.scale(50);
  topPanel.setPreferredSize(size);
  topPanel.setMinimumSize(size);
  topPanel.setBorder(JBUI.Borders.empty(5, 8));

  if (isMovable) {
    WindowMoveListener moveListener = new WindowMoveListener(topPanel);
    topPanel.addMouseListener(moveListener);
    topPanel.addMouseMotionListener(moveListener);
  }

  return topPanel;
}
 
Example #11
Source File: BlazeIntellijPluginConfiguration.java    From intellij with Apache License 2.0 6 votes vote down vote up
public BlazeIntellijPluginConfigurationSettingsEditor(
    Iterable<Label> javaLabels,
    RunConfigurationStateEditor blazeFlagsEditor,
    RunConfigurationStateEditor exeFlagsEditor) {
  targetCombo =
      new ComboBox<>(
          new DefaultComboBoxModel<>(
              Ordering.usingToString().sortedCopy(javaLabels).toArray(new Label[0])));
  targetCombo.setRenderer(
      new ListCellRendererWrapper<Label>() {
        @Override
        public void customize(
            JList list, @Nullable Label value, int index, boolean selected, boolean hasFocus) {
          setText(value == null ? null : value.toString());
        }
      });
  this.blazeFlagsEditor = blazeFlagsEditor;
  this.exeFlagsEditor = exeFlagsEditor;
  ProjectSdksModel sdksModel = new ProjectSdksModel();
  sdksModel.reset(null);
  sdkCombo = new JdkComboBox(sdksModel, IdeaJdkHelper::isIdeaJdkType);

  keepInSyncCheckBox = new JBCheckBox("Keep in sync with source XML");
  keepInSyncCheckBox.addItemListener(e -> updateEnabledStatus());
}
 
Example #12
Source File: CamelAnnotatorPageTest.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
public void testShouldChangeStateOfRealTimeJSonPathValidationCatalogCheckBox() {
    JBCheckBox checkBox = annotatorPage.getRealTimeJSonPathValidationCatalogCheckBox();
    assertEquals(true, checkBox.isSelected());
    assertEquals(true, annotatorPage.getCamelPreferenceService().isRealTimeJSonPathValidation());
    checkBox.setSelected(false);
    annotatorPage.apply();
    assertEquals(false, checkBox.isSelected());
    assertEquals(false, annotatorPage.getCamelPreferenceService().isRealTimeJSonPathValidation());
}
 
Example #13
Source File: CamelEditorSettingsPage.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public JComponent createComponent() {
    downloadCatalogCheckBox = new JBCheckBox("Allow downloading camel-catalog over the internet");
    scanThirdPartyComponentsCatalogCheckBox = new JBCheckBox("Scan classpath for third party Camel components using modern component packaging");
    scanThirdPartyLegacyComponentsCatalogCheckBox = new JBCheckBox("Scan classpath for third party Camel components using legacy component packaging");
    camelIconInGutterCheckBox = new JBCheckBox("Show Camel icon in gutter");
    camelIconsComboBox = new ComboBox<>(new String[]{"Camel Icon", "Camel Animal Icon", "Camel Badge Icon"});

    camelIconsComboBox.setRenderer(new CamelChosenIconCellRender());

    // use mig layout which is like a spread-sheet with 2 columns, which we can span if we only have one element
    JPanel panel = new JPanel(new MigLayout("fillx,wrap 2", "[left]rel[grow,fill]"));
    panel.setOpaque(false);

    panel.add(downloadCatalogCheckBox, "span 2");
    panel.add(scanThirdPartyComponentsCatalogCheckBox, "span 2");
    panel.add(scanThirdPartyLegacyComponentsCatalogCheckBox, "span 2");
    panel.add(camelIconInGutterCheckBox, "span 2");

    panel.add(new JLabel("Camel icon"));
    panel.add(camelIconsComboBox);

    JPanel result = new JPanel(new BorderLayout());
    result.add(panel, BorderLayout.NORTH);
    reset();
    return result;
}
 
Example #14
Source File: CamelAnnotatorPageTest.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
public void testShouldResetHighlightCustomOptionsCheckBox() {
    JBCheckBox checkBox = annotatorPage.getHighlightCustomOptionsCheckBox();
    boolean status = checkBox.isSelected();
    checkBox.setSelected(!status);
    annotatorPage.reset();
    assertEquals(status, checkBox.isSelected());
}
 
Example #15
Source File: CamelAnnotatorPageTest.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
public void testShouldRestRealTimeSimpleValidationCatalogCheckBox() {
    JBCheckBox checkBox = annotatorPage.getRealTimeSimpleValidationCatalogCheckBox();
    boolean status = checkBox.isSelected();
    checkBox.setSelected(!status);
    annotatorPage.reset();
    assertEquals(status, checkBox.isSelected());
}
 
Example #16
Source File: CamelAnnotatorPageTest.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
public void testShouldChangeStateOfHighlightCustomOptionsCheckBox() throws ConfigurationException {
    JBCheckBox checkBox = annotatorPage.getHighlightCustomOptionsCheckBox();
    assertEquals(true, checkBox.isSelected());
    assertEquals(true, annotatorPage.getCamelPreferenceService().isHighlightCustomOptions());
    checkBox.setSelected(false);
    annotatorPage.apply();
    assertEquals(false, checkBox.isSelected());
    assertEquals(false, annotatorPage.getCamelPreferenceService().isHighlightCustomOptions());
}
 
Example #17
Source File: ListCheckboxPanel.java    From EasyCode with MIT License 5 votes vote down vote up
/**
 * 初始化操作
 */
private void init() {
    JTextPane textPane = new JTextPane();
    textPane.setText(title);
    add(textPane);
    if (CollectionUtil.isEmpty(items)) {
        return;
    }
    checkBoxList = new ArrayList<>(items.size());
    for (String item : items) {
        JBCheckBox checkBox = new JBCheckBox(item);
        checkBoxList.add(checkBox);
        add(checkBox);
    }
}
 
Example #18
Source File: CamelAnnotatorPageTest.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
public void testShouldChangeStateOfRealTimeEndpointValidationCatalogCheckBox() throws ConfigurationException {
    JBCheckBox checkBox = annotatorPage.getRealTimeEndpointValidationCatalogCheckBox();
    assertEquals(true, checkBox.isSelected());
    assertEquals(true, annotatorPage.getCamelPreferenceService().isRealTimeEndpointValidation());
    checkBox.setSelected(false);
    annotatorPage.apply();
    assertEquals(false, checkBox.isSelected());
    assertEquals(false, annotatorPage.getCamelPreferenceService().isRealTimeEndpointValidation());
}
 
Example #19
Source File: BoolServiceExtensionCheckbox.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
BoolServiceExtensionCheckbox(
  FlutterApp app,
  @NotNull ToggleableServiceExtensionDescription extensionDescription,
  String tooltip) {
  checkbox = new JBCheckBox(extensionDescription.getDisabledText());
  checkbox.setHorizontalAlignment(JLabel.LEFT);
  checkbox.setToolTipText(tooltip);
  assert (app.getVMServiceManager() != null);
  app.hasServiceExtension(extensionDescription.getExtension(), checkbox::setEnabled, app);

  checkbox.addActionListener((l) -> {
    final boolean newValue = checkbox.isSelected();
    app.getVMServiceManager().setServiceExtensionState(
      extensionDescription.getExtension(),
      newValue,
      newValue);
    if (app.isSessionActive()) {
      app.callBooleanExtension(extensionDescription.getExtension(), newValue);
    }
  });

  currentValueSubscription = app.getVMServiceManager().getServiceExtensionState(extensionDescription.getExtension()).listen(
    (state) -> {
      if (checkbox.isSelected() != state.isEnabled()) {
        checkbox.setSelected(state.isEnabled());
      }
    }, true);
}
 
Example #20
Source File: DirectoryWrapper.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
@NotNull
private JPanel getOptionsPanel() {
    //  isEnabled
    cbEnabled = new JBCheckBox();
    cbEnabled.setSelected(directory.isEnabled());
    cbEnabled.addItemListener(e -> setEnabled(cbEnabled.isSelected()));
    cbEnabled.setToolTipText(Localizer.get("tooltip.IfCheckedElementWillBeCreated"));

    // Script
    jlScript = new IconLabel(
            Localizer.get("tooltip.ColoredWhenItemHasScript"),
            PluginIcons.SCRIPT,
            PluginIcons.SCRIPT_DISABLED
    );

    // CustomPath
    jlCustomPath = new IconLabel(
            Localizer.get("tooltip.ColoredWhenItemHasCustomPath"),
            PluginIcons.CUSTOM_PATH,
            PluginIcons.CUSTOM_PATH_DISABLED
    );

    // WriteRules
    jlWriteRules = new IconLabelCustom<Directory>(Localizer.get("tooltip.WriteRules"), directory) {
        @Override
        public void onUpdateIcon(Directory item) {
            setIcon(item.getWriteRules().toIcon());
        }
    };

    updateOptionIcons();

    JPanel optionsPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("2pt","0")));
    optionsPanel.add(cbEnabled, new CC());
    optionsPanel.add(jlScript, new CC());
    optionsPanel.add(jlCustomPath, new CC());
    optionsPanel.add(jlWriteRules, new CC());
    return optionsPanel;
}
 
Example #21
Source File: CamelAnnotatorPageTest.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
public void testShouldChangeStateOfRealTimeSimpleValidationCatalogCheckBox() throws ConfigurationException {
    JBCheckBox checkBox = annotatorPage.getRealTimeSimpleValidationCatalogCheckBox();
    assertEquals(true, checkBox.isSelected());
    assertEquals(true, annotatorPage.getCamelPreferenceService().isRealTimeSimpleValidation());
    checkBox.setSelected(false);
    annotatorPage.apply();
    assertEquals(false, checkBox.isSelected());
    assertEquals(false, annotatorPage.getCamelPreferenceService().isRealTimeSimpleValidation());
}
 
Example #22
Source File: CamelAnnotatorPageTest.java    From camel-idea-plugin with Apache License 2.0 5 votes vote down vote up
public void testShouldChangeStateOfRealTimeBeanMethodValidationCheckBox() {
    JBCheckBox checkBox = annotatorPage.getRealTimeBeanMethodValidationCheckBox();
    assertEquals(true, checkBox.isSelected());
    assertEquals(true, annotatorPage.getCamelPreferenceService().isRealTimeBeanMethodValidationCheckBox());
    checkBox.setSelected(false);
    annotatorPage.apply();
    assertEquals(false, checkBox.isSelected());
    assertEquals(false, annotatorPage.getCamelPreferenceService().isRealTimeBeanMethodValidationCheckBox());
}
 
Example #23
Source File: BlazeCommandRunConfiguration.java    From intellij with Apache License 2.0 5 votes vote down vote up
BlazeCommandRunConfigurationSettingsEditor(BlazeCommandRunConfiguration config) {
  Project project = config.getProject();
  elementState = config.blazeElementState.clone();
  targetsUi = new TargetExpressionListUi(project);
  targetExpressionLabel = new JBLabel(UIUtil.ComponentStyle.LARGE);
  keepInSyncCheckBox = new JBCheckBox("Keep in sync with source XML");
  outputFileUi = new ConsoleOutputFileSettingsUi<>();
  editorWithoutSyncCheckBox = UiUtil.createBox(targetExpressionLabel, targetsUi);
  editor =
      UiUtil.createBox(
          editorWithoutSyncCheckBox, outputFileUi.getComponent(), keepInSyncCheckBox);
  updateEditor(config);
  updateHandlerEditor(config);
  keepInSyncCheckBox.addItemListener(e -> updateEnabledStatus());
}
 
Example #24
Source File: BashConfigForm.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
protected void initOwnComponents() {
    Project project = getProject();

    FileChooserDescriptor chooseInterpreterDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
    chooseInterpreterDescriptor.setTitle("Choose Interpreter...");

    interpreterPathField = new TextFieldWithBrowseButton();
    interpreterPathField.addBrowseFolderListener(new MacroAwareTextBrowseFolderListener(chooseInterpreterDescriptor, project));

    interpreterPathComponent = LabeledComponent.create(createComponentWithMacroBrowse(interpreterPathField), "Interpreter path:");
    interpreterPathComponent.setLabelLocation(BorderLayout.WEST);

    projectInterpreterCheckbox = new JBCheckBox();
    projectInterpreterCheckbox.setToolTipText("If enabled then the interpreter path configured in the project settings will be used instead of a custom location.");
    projectInterpreterCheckbox.addChangeListener(e -> {
        boolean selected = projectInterpreterCheckbox.isSelected();
        UIUtil.setEnabled(interpreterPathComponent, !selected, true);
    });
    projectInterpreterLabeled = LabeledComponent.create(projectInterpreterCheckbox, "Use project interpreter");
    projectInterpreterLabeled.setLabelLocation(BorderLayout.WEST);

    interpreterParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "Interpreter options");
    interpreterParametersComponent.setLabelLocation(BorderLayout.WEST);

    scriptNameField = new TextFieldWithBrowseButton();
    scriptNameField.addBrowseFolderListener(new MacroAwareTextBrowseFolderListener(FileChooserDescriptorFactory.createSingleLocalFileDescriptor(), project));

    scriptNameComponent = LabeledComponent.create(createComponentWithMacroBrowse(scriptNameField), "Script:");
    scriptNameComponent.setLabelLocation(BorderLayout.WEST);
}
 
Example #25
Source File: PantsProjectSettingsControl.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
private JBCheckBox newEnableIcrementalImportCheckbox(){
  JBCheckBox checkbox = new JBCheckBox(PantsBundle.message("pants.settings.text.with.incremental.import"));
  checkbox.addActionListener(evt -> {
    myImportDepthSpinner.setValue(((JBCheckBox) evt.getSource()).isSelected() ? getInitialSettings().incrementalImportDepth : 0);
    myImportDepthSpinner.setEnabled(((JBCheckBox) evt.getSource()).isSelected());
  });
  return checkbox;
}
 
Example #26
Source File: AbstractExternalProjectSettingsControl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void fillUi(@Nonnull PaintAwarePanel canvas, int indentLevel) {
  myUseAutoImportBox = new JBCheckBox(ExternalSystemBundle.message("settings.label.use.auto.import"));
  myUseAutoImportBox.setVisible(!myHideUseAutoImportBox);
  canvas.add(myUseAutoImportBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
  myCreateEmptyContentRootDirectoriesBox =
    new JBCheckBox(ExternalSystemBundle.message("settings.label.create.empty.content.root.directories"));
  canvas.add(myCreateEmptyContentRootDirectoriesBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
  fillExtraControls(canvas, indentLevel); 
}
 
Example #27
Source File: RecentLocationsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void updateItems(@Nonnull RecentLocationsDataModel data,
                                @Nonnull ListWithFilter<RecentLocationItem> listWithFilter,
                                @Nonnull JLabel title,
                                @Nonnull JBCheckBox checkBox,
                                @Nonnull JBPopup popup) {
  boolean state = checkBox.isSelected();
  updateModel(listWithFilter, data, state);
  updateTitleText(title, state);

  IdeFocusManager.getGlobalInstance().requestFocus(listWithFilter, false);

  popup.pack(false, false);
}
 
Example #28
Source File: RecentLocationsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static Function<RecentLocationItem, String> getNamer(@Nonnull RecentLocationsDataModel data, @Nonnull JBCheckBox checkBox) {
  return value -> {
    String breadcrumb = data.getBreadcrumbsMap(checkBox.isSelected()).get(value.getInfo());
    EditorEx editor = value.getEditor();

    return breadcrumb + " " + value.getInfo().getFile().getName() + " " + editor.getDocument().getText();
  };
}
 
Example #29
Source File: FileStructurePopup.java    From consulo with Apache License 2.0 5 votes vote down vote up
private boolean handleBackspace(String filter) {
  boolean clicked = false;
  Iterator<Pair<String, JBCheckBox>> iterator = myTriggeredCheckboxes.iterator();
  while (iterator.hasNext()) {
    Pair<String, JBCheckBox> next = iterator.next();
    if (next.getFirst().length() < filter.length()) break;

    iterator.remove();
    next.getSecond().doClick();
    clicked = true;
  }
  return clicked;
}
 
Example #30
Source File: FileStructurePopup.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void setTreeActionState(Class<? extends TreeAction> action, boolean state) {
  JBCheckBox checkBox = myCheckBoxes.get(action);
  if (checkBox != null) {
    checkBox.setSelected(state);
    for (ActionListener listener : checkBox.getActionListeners()) {
      listener.actionPerformed(new ActionEvent(this, 1, ""));
    }
  }
}