Java Code Examples for com.intellij.ui.components.JBCheckBox#setToolTipText()

The following examples show how to use com.intellij.ui.components.JBCheckBox#setToolTipText() . 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: BinaryFileWrapper.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
@NotNull
private JPanel getOptionsPanel() {
    JPanel optionsPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("2pt", "0")));

    cbEnabled = new JBCheckBox();
    cbEnabled.setSelected(binaryFile.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<BinaryFile>(Localizer.get("tooltip.WriteRules"), binaryFile) {
        @Override
        public void onUpdateIcon(BinaryFile item) {
            setIcon(item.getWriteRules().toIcon());
        }
    };

    updateOptionIcons();

    optionsPanel.add(cbEnabled, new CC());
    optionsPanel.add(jlScript, new CC());
    optionsPanel.add(jlCustomPath, new CC());
    optionsPanel.add(jlWriteRules, new CC());
    return optionsPanel;
}
 
Example 2
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 3
Source File: FileWrapper.java    From PackageTemplates with Apache License 2.0 5 votes vote down vote up
@NotNull
private JPanel getOptionsPanel() {
    JPanel optionsPanel = new JPanel(new MigLayout(new LC().insets("0").gridGap("2pt","0")));

    cbEnabled = new JBCheckBox();
    cbEnabled.setSelected(file.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<File>(Localizer.get("tooltip.WriteRules"), file) {
        @Override
        public void onUpdateIcon(File item) {
            setIcon(item.getWriteRules().toIcon());
        }
    };

    updateOptionIcons();

    optionsPanel.add(cbEnabled, new CC());
    optionsPanel.add(jlScript, new CC());
    optionsPanel.add(jlCustomPath, new CC());
    optionsPanel.add(jlWriteRules, new CC());
    return optionsPanel;
}
 
Example 4
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 5
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 6
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);
}