com.intellij.ui.ComboboxWithBrowseButton Java Examples

The following examples show how to use com.intellij.ui.ComboboxWithBrowseButton. 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: BaseCppRunSettingsEditor.java    From CppTools with Apache License 2.0 6 votes vote down vote up
protected void setupCommonUI(Project project) {
  ComboboxWithBrowseButton myExecutableName = getExecutableName();
  myExecutableName.getComboBox().setEditable(true);
  myExecutableName.addBrowseFolderListener(
    CHOOSE_EXECUTABLE_TITLE,
    CHOOSE_EXECUTABLE_TITLE,
    project,
    new FileChooserDescriptor(true, false, false, false, false, false) {
      @Override
      public boolean isFileSelectable(VirtualFile file) {
        return super.isFileSelectable(file);
      }
    },
    TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT
  );
}
 
Example #2
Source File: BrowserSelector.java    From consulo with Apache License 2.0 5 votes vote down vote up
public BrowserSelector(@Nonnull final Condition<WebBrowser> browserCondition) {
  myModel = createBrowsersComboModel(browserCondition);
  myBrowserComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox(myModel));
  myBrowserComboWithBrowse.addActionListener(e -> {
    WebBrowserManager browserManager = WebBrowserManager.getInstance();
    long modificationCount = browserManager.getModificationCount();
    ShowSettingsUtil.getInstance().editConfigurable(myBrowserComboWithBrowse, new BrowserSettings());

    WebBrowser selectedItem = getSelected();
    if (modificationCount != browserManager.getModificationCount()) {
      myModel = createBrowsersComboModel(browserCondition);
      //noinspection unchecked
      myBrowserComboWithBrowse.getComboBox().setModel(myModel);
    }
    if (selectedItem != null) {
      setSelected(selectedItem);
    }
  });

  //noinspection unchecked
  myBrowserComboWithBrowse.getComboBox().setRenderer(SimpleListCellRenderer.<WebBrowser>create((label, value, index) -> {
    Image baseIcon;
    if (value == null) {
      WebBrowser firstBrowser = WebBrowserManager.getInstance().getFirstActiveBrowser();
      baseIcon = firstBrowser == null ? AllIcons.Nodes.PpWeb : firstBrowser.getIcon();
    }
    else {
      baseIcon = value.getIcon();
    }
    label.setIcon(TargetAWT.to(myBrowserComboWithBrowse.isEnabled() ? baseIcon : ImageEffects.grayed(baseIcon)));
    label.setText(value != null ? value.getName() : "Default");
  }));
}
 
Example #3
Source File: FlutterSmallIDEGeneratorPeer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public FlutterSmallIDEGeneratorPeer() {
  sdkPathComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox<>());
  sdkPathComboWithBrowse.getComboBox().setEditable(true);
  FlutterSdkUtil.addKnownSDKPathsToCombo(sdkPathComboWithBrowse.getComboBox());

  sdkPathComboWithBrowse.addBrowseFolderListener(
    FlutterBundle.message("flutter.sdk.browse.path.label"), null, null,
    FileChooserDescriptorFactory.createSingleFolderDescriptor(),
    TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT);

  settingsFields = new FlutterCreateAdditionalSettingsFields();
}
 
Example #4
Source File: FlutterSmallIDEGeneratorPeer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public FlutterSmallIDEGeneratorPeer() {
  sdkPathComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox<>());
  sdkPathComboWithBrowse.getComboBox().setEditable(true);
  FlutterSdkUtil.addKnownSDKPathsToCombo(sdkPathComboWithBrowse.getComboBox());

  sdkPathComboWithBrowse.addBrowseFolderListener(
    FlutterBundle.message("flutter.sdk.browse.path.label"), null, null,
    FileChooserDescriptorFactory.createSingleFolderDescriptor(),
    TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT);

  settingsFields = new FlutterCreateAdditionalSettingsFields();
}
 
Example #5
Source File: FlutterGeneratorPeer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void createUIComponents() {
  mySdkPathComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox<>());
}
 
Example #6
Source File: CppRunSettingsEditor.java    From CppTools with Apache License 2.0 4 votes vote down vote up
protected ComboboxWithBrowseButton getExecutableName() {
  return myExecutableName;
}
 
Example #7
Source File: CppRemoteDebugSettingEditor.java    From CppTools with Apache License 2.0 4 votes vote down vote up
protected ComboboxWithBrowseButton getExecutableName() {
  return myExecutableName;
}
 
Example #8
Source File: FlutterSettingsConfigurable.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void createUIComponents() {
  mySdkCombo = new ComboboxWithBrowseButton(new ComboBox<>());
}
 
Example #9
Source File: FlutterGeneratorPeer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
@NotNull
public ComboboxWithBrowseButton getSdkComboBox() {
  return mySdkPathComboWithBrowse;
}
 
Example #10
Source File: RunnerSetting.java    From SmartTomcat with Apache License 2.0 4 votes vote down vote up
public ComboboxWithBrowseButton getTomcatField() {
    return tomcatField;
}
 
Example #11
Source File: FlutterSettingsConfigurable.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void createUIComponents() {
  mySdkCombo = new ComboboxWithBrowseButton(new ComboBox<>());
}
 
Example #12
Source File: FlutterGeneratorPeer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
@NotNull
public ComboboxWithBrowseButton getSdkComboBox() {
  return mySdkPathComboWithBrowse;
}
 
Example #13
Source File: FlutterGeneratorPeer.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void createUIComponents() {
  mySdkPathComboWithBrowse = new ComboboxWithBrowseButton(new ComboBox<>());
}
 
Example #14
Source File: FlutterProjectStep.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public ComboboxWithBrowseButton getSdkComboBox() {
  return myFlutterSdkPath;
}
 
Example #15
Source File: FlutterProjectStep.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public ComboboxWithBrowseButton getSdkComboBox() {
  return myFlutterSdkPath;
}
 
Example #16
Source File: TomcatSettingsEditor.java    From SmartTomcat with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
protected JComponent createEditor() {

    ComboboxWithBrowseButton tomcatField = runnerSetting.getTomcatField();
    TextFieldWithBrowseButton docBaseField = runnerSetting.getDocBaseField();

    JTextField contextPathField = runnerSetting.getContextPathField();
    JFormattedTextField portField = runnerSetting.getPortField();
    JFormattedTextField adminPort = runnerSetting.getAdminPort();

    JXButton configrationButton = runnerSetting.getConfigrationButton();
    configrationButton.addActionListener(e -> ShowSettingsUtil.getInstance().showSettingsDialog(project, TomcatSettingConfigurable.class));


    VirtualFile baseDir = VirtualFileManager.getInstance().getFileSystem("file").findFileByPath(project.getBasePath());

    FileChooserDescriptor chooserDescriptor = new IgnoreOutputFileChooserDescriptor(project).withRoots(baseDir);
    docBaseField.addBrowseFolderListener("webapp", "Choose Web Folder", project, chooserDescriptor);
    docBaseField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent documentEvent) {

            if (!documentEvent.getType().equals(DocumentEvent.EventType.REMOVE)) {
                String text = docBaseField.getText();
                if (text != null && !text.trim().equals("")) {
                    VirtualFile fileByIoFile = LocalFileSystem.getInstance().findFileByIoFile(new File(text));

                    Module module = ModuleUtilCore.findModuleForFile(fileByIoFile, project);
                    String contextPath = module == null ? "/" : "/" + module.getName();
                    contextPathField.setText(contextPath);
                }
            }

        }
    });

    portField.setValue(8080);
    adminPort.setValue(8005);
    DefaultFormatterFactory tf = new DefaultFormatterFactory();
    NumberFormat format = NumberFormat.getInstance();
    format.setGroupingUsed(false);
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setValueClass(Integer.class);
    formatter.setMinimum(0);
    formatter.setMaximum(65535);
    tf.setDefaultFormatter(formatter);
    portField.setFormatterFactory(tf);
    adminPort.setFormatterFactory(tf);

    return runnerSetting.getMainPanel();
}
 
Example #17
Source File: InstallSdkAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License votes vote down vote up
ComboboxWithBrowseButton getSdkComboBox(); 
Example #18
Source File: InstallSdkAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License votes vote down vote up
ComboboxWithBrowseButton getSdkComboBox(); 
Example #19
Source File: BaseCppRunSettingsEditor.java    From CppTools with Apache License 2.0 votes vote down vote up
protected abstract @NotNull ComboboxWithBrowseButton getExecutableName();