com.intellij.openapi.ui.ComponentWithBrowseButton Java Examples

The following examples show how to use com.intellij.openapi.ui.ComponentWithBrowseButton. 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: XDebuggerEditorBase.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected JPanel addMultilineButton(JComponent component) {
  ComponentWithBrowseButton<JComponent> componentWithButton =
          new ComponentWithBrowseButton<>(component, e -> showCodeFragmentEditor(component, this));
  componentWithButton.setButtonIcon(AllIcons.Actions.ShowViewer);
  componentWithButton.getButton().setDisabledIcon(TargetAWT.to(ImageEffects.grayed(AllIcons.Actions.ShowViewer)));
  return componentWithButton;
}
 
Example #2
Source File: QuarkusCodeEndpointChooserStep.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
QuarkusCodeEndpointChooserStep(WizardContext wizardContext) {
    this.customUrlWithBrowseButton = new ComponentWithBrowseButton(this.endpointURL, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                QuarkusCodeEndpointChooserStep.this.validate();
                BrowserUtil.browse(QuarkusCodeEndpointChooserStep.this.endpointURL.getText());
            } catch (ConfigurationException var3) {
                Messages.showErrorDialog(var3.getMessage(), "Cannot Open URL");
            }

        }
    });
    this.wizardContext = wizardContext;
    String lastServiceUrl = PropertiesComponent.getInstance().getValue(LAST_ENDPOINT_URL, QUARKUS_CODE_URL);
    if (!lastServiceUrl.equals(QUARKUS_CODE_URL)) {
        this.endpointURL.setSelectedItem(lastServiceUrl);
        this.defaultRadioButton.setSelected(false);
        this.customRadioButton.setSelected(true);
    } else {
        this.defaultRadioButton.setSelected(true);
    }

    List<String> history = this.endpointURL.getHistory();
    history.remove(QUARKUS_CODE_URL);
    this.endpointURL.setHistory(history);
    this.updateCustomUrl();
}
 
Example #3
Source File: AemdcConfigurationDialog.java    From aem-ide-tooling-4-intellij with Apache License 2.0 5 votes vote down vote up
private void propagateToolTip(JComponent source, JComponent ... targets) {
    String toolTip = source.getToolTipText();
    for(JComponent target: targets) {
        if(target instanceof ComponentWithBrowseButton) {
            ((ComponentWithBrowseButton) target).getChildComponent().setToolTipText(toolTip);
        } else {
            target.setToolTipText(toolTip);
        }
    }
}
 
Example #4
Source File: JavaExtractSuperBaseDialog.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
protected ComponentWithBrowseButton<EditorComboBox> createPackageNameField() {
  String name = "";
  PsiFile file = mySourceClass.getContainingFile();
  if (file instanceof PsiJavaFile) {
    name = ((PsiJavaFile)file).getPackageName();
  }
  return new PackageNameReferenceEditorCombo(name, myProject, DESTINATION_PACKAGE_RECENT_KEY,
                                                           RefactoringBundle.message("choose.destination.package"));
}
 
Example #5
Source File: DesktopTextBoxWithExpandAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
private FallbackTextBoxWithExpandAction(Image editButtonImage, String dialogTitle, Function<String, List<String>> parser, Function<List<String>, String> joiner) {
  myTextBox = new DesktopTextBoxImpl("");
  myDialogTitle = StringUtil.notNullize(dialogTitle);

  JTextField awtTextField = myTextBox.toAWTComponent();

  initialize(new ComponentWithBrowseButton<>(awtTextField, e -> Messages.showTextAreaDialog(awtTextField, myDialogTitle, myDialogTitle, parser::apply, joiner::apply)));

  addDocumentListenerForValidator(awtTextField.getDocument());

  if (editButtonImage != null) {
    toAWTComponent().setButtonIcon(TargetAWT.to(editButtonImage));
  }
}
 
Example #6
Source File: AlternativeJREPanel.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public AlternativeJREPanel() {
    myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

    myFieldWithHistory = new TextFieldWithHistory();
    myFieldWithHistory.setHistorySize(-1);
    final List<String> foundJDKs = new ArrayList<>();
    final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();

    String javaHomeOfCurrentProcess = System.getProperty("java.home");
    if (javaHomeOfCurrentProcess != null && !javaHomeOfCurrentProcess.isEmpty()) {
        foundJDKs.add(javaHomeOfCurrentProcess);
    }

    for (Sdk sdk : allJDKs) {
        String name = sdk.getName();
        if (!foundJDKs.contains(name)) {
            foundJDKs.add(name);
        }
    }

    for (Sdk jdk : allJDKs) {
        String homePath = jdk.getHomePath();

        if (!SystemInfo.isMac) {
            final File jre = new File(jdk.getHomePath(), "jre");
            if (jre.isDirectory()) {
                homePath = jre.getPath();
            }
        }

        if (!foundJDKs.contains(homePath)) {
            foundJDKs.add(homePath);
        }
    }

    myFieldWithHistory.setHistory(foundJDKs);
    myPathField = new ComponentWithBrowseButton<>(myFieldWithHistory, null);
    myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
            ExecutionBundle.message("run.configuration.select.jre.dir.label"),
            null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
            TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

    setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
    add(myCbEnabled, "shrinkx");
    add(myPathField, "growx, pushx");

    InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

    myCbEnabled.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            enabledChanged();
        }
    });
    enabledChanged();

    setAnchor(myCbEnabled);

    updateUI();
}
 
Example #7
Source File: CellEditorComponentWithBrowseButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ComponentWithBrowseButton<Comp> getComponentWithButton() {
  return myComponent;
}
 
Example #8
Source File: BrowseModuleValueActionListener.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setField(final ComponentWithBrowseButton<T> field) {
  myField = field;
  myField.addActionListener(this);
  myField.setButtonEnabled(!myProject.isDefault());
}
 
Example #9
Source File: ExtractSuperBaseDialog.java    From consulo with Apache License 2.0 votes vote down vote up
protected abstract ComponentWithBrowseButton createPackageNameField();