Example usage for com.intellij.openapi.ui TextComponentAccessor STRING_COMBOBOX_WHOLE_TEXT

List of usage examples for com.intellij.openapi.ui TextComponentAccessor STRING_COMBOBOX_WHOLE_TEXT

Introduction

In this page you can find the example usage for com.intellij.openapi.ui TextComponentAccessor STRING_COMBOBOX_WHOLE_TEXT.

Prototype

TextComponentAccessor STRING_COMBOBOX_WHOLE_TEXT

To view the source code for com.intellij.openapi.ui TextComponentAccessor STRING_COMBOBOX_WHOLE_TEXT.

Click Source Link

Document

The accessor that gets and changes whole text

Usage

From source file:com.intellij.appengine.facet.AppEngineSdkEditor.java

License:Apache License

public AppEngineSdkEditor(final @Nullable Project project) {
    myPathEditor = new ComboboxWithBrowseButton(new ComboBox(100));
    myPathEditor.addBrowseFolderListener(project,
            new ComponentWithBrowseButton.BrowseFolderActionListener<JComboBox>("Google App Engine SDK",
                    "Specify Google App Engine Java SDK home", myPathEditor, project,
                    FileChooserDescriptorFactory.createSingleFolderDescriptor(),
                    TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT));
    final JComboBox comboBox = myPathEditor.getComboBox();
    comboBox.setEditable(true);/*from   w  w  w  .  j a  va  2 s . c o  m*/
    comboBox.removeAllItems();
    for (AppEngineSdk sdk : AppEngineSdkManager.getInstance().getValidSdks()) {
        comboBox.addItem(FileUtil.toSystemDependentName(sdk.getSdkHomePath()));
    }
}

From source file:com.intellij.ui.ComboboxWithBrowseButton.java

License:Apache License

public void addBrowseFolderListener(Project project, FileChooserDescriptor descriptor) {
    addBrowseFolderListener(null, null, project, descriptor, TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT);
}

From source file:io.flutter.module.FlutterGeneratorPeer.java

License:Open Source License

private void initSdkCombo() {
    mySdkPathComboWithBrowse.getComboBox().setEditable(true);
    FlutterSdkUtil.addKnownSDKPathsToCombo(mySdkPathComboWithBrowse.getComboBox());

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

    final JTextComponent editorComponent = (JTextComponent) mySdkPathComboWithBrowse.getComboBox().getEditor()
            .getEditorComponent();//w  w  w.ja va 2 s  .  c  o m
    editorComponent.getDocument().addDocumentListener(new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            validate();
        }
    });
}

From source file:io.flutter.module.FlutterSmallIDEGeneratorPeer.java

License:Open Source License

private void createUIComponents() {
    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);
}

From source file:io.flutter.project.FlutterProjectStep.java

License:Open Source License

public FlutterProjectStep(FlutterProjectModel model, String title, Icon icon, FlutterProjectType type) {
    super(model, title, icon);
    myProjectType = new OptionalValueProperty<>(type);

    myValidatorPanel = new ValidatorPanel(this, myPanel);

    String initialLocation = WizardUtils.getProjectLocationParent().getPath();
    // Directionality matters. Let the bindings set the model's value from the text field.
    myProjectLocation.getChildComponent().setText(initialLocation);
    TextProperty locationText = new TextProperty(myProjectLocation.getChildComponent());
    myBindings.bind(model.projectLocation(), locationText);
    myBindings.bindTwoWay(new TextProperty(myProjectName), model.projectName());

    myBindings.bind(model.description(), new TextProperty(myDescription));

    myFlutterSdkPath.getComboBox().setEditable(true);
    myFlutterSdkPath.getButton().addActionListener((e) -> myFlutterSdkPath.getComboBox()
            .setSelectedItem(myFlutterSdkPath.getComboBox().getEditor().getItem()));
    myBindings.bind(model.flutterSdk(), new TransformOptionalExpression<String, String>("",
            new SelectedItemProperty<>(myFlutterSdkPath.getComboBox())) {
        @NotNull/*from   w  w  w .jav  a 2  s  .com*/
        @Override
        protected String transform(@NotNull String value) {
            return value;
        }
    });
    FlutterSdkUtil.addKnownSDKPathsToCombo(myFlutterSdkPath.getComboBox());
    myFlutterSdkPath.addBrowseFolderListener(FlutterBundle.message("flutter.sdk.browse.path.label"), null, null,
            FileChooserDescriptorFactory.createSingleFolderDescriptor(),
            TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT);

    myProjectLocation.addBrowseFolderListener(
            FlutterBundle.message("flutter.module.create.settings.location.select"), null, null,
            FileChooserDescriptorFactory.createSingleFolderDescriptor(),
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);

    myValidatorPanel.registerValidator(model.flutterSdk(), FlutterProjectStep::validateFlutterSdk);
    myValidatorPanel.registerValidator(model.projectName(), this::validateFlutterModuleName);
    myValidatorPanel.registerMessageSource(myDownloadErrorMessage);

    if (isProject()) {
        Expression<File> locationFile = model.projectLocation().transform(File::new);
        myValidatorPanel.registerValidator(locationFile,
                new PathValidator.Builder().withCommonRules().build("project location"));
        final JTextComponent sdkEditor = (JTextComponent) myFlutterSdkPath.getComboBox().getEditor()
                .getEditorComponent();
        sdkBackgroundColor = sdkEditor.getBackground();
        sdkEditor.getDocument().addDocumentListener(new DocumentAdapter() {
            @Override
            protected void textChanged(final DocumentEvent e) {
                updateSdkField(sdkEditor);
            }
        });
    }

    // Initialization of the SDK install UI was copied from FlutterGeneratorPeer.

    // Hide pending real content.
    myProgressBar.setVisible(false);
    myProgressText.setVisible(false);
    myCancelProgressButton.setVisible(false);
    myInstallSdkAction = new InstallSdkAction(this);

    myInstallActionLink.setIcon(myInstallSdkAction.getLinkIcon());
    myInstallActionLink.setDisabledIcon(IconLoader.getDisabledIcon(myInstallSdkAction.getLinkIcon()));

    myInstallActionLink.setText(myInstallSdkAction.getLinkText());

    //noinspection unchecked
    myInstallActionLink.setListener((label, linkUrl) -> myInstallSdkAction.actionPerformed(null), null);

    myProgressText.setFont(UIUtil.getLabelFont(UIUtil.FontSize.NORMAL).deriveFont(Font.ITALIC));

    // Some feedback on hover.
    myCancelProgressButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    myCancelProgressButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            myListener.actionCanceled();
        }
    });

    myRootPanel = new StudioWizardStepPanel(myValidatorPanel);
    FormScalingUtil.scaleComponentTree(this.getClass(), myRootPanel);
}

From source file:io.flutter.sdk.FlutterSettingsConfigurable.java

License:Open Source License

private void init() {
    mySdkCombo.getComboBox().setEditable(true);

    final JTextComponent sdkEditor = (JTextComponent) mySdkCombo.getComboBox().getEditor().getEditorComponent();
    sdkEditor.getDocument().addDocumentListener(new DocumentAdapter() {
        protected void textChanged(final DocumentEvent e) {
            updateVersionText();/*from   w  w  w .  j a  va 2s . c  o m*/
        }
    });

    mySdkCombo.addBrowseFolderListener("Select Flutter SDK Path", null, null,
            FileChooserDescriptorFactory.createSingleFolderDescriptor(),
            TextComponentAccessor.STRING_COMBOBOX_WHOLE_TEXT);

    myPrivacyPolicy.setIcon(null);
    myPrivacyPolicy.setListener((label, linkUrl) -> {
        try {
            BrowserLauncher.getInstance().browse(new URI(linkUrl));
        } catch (URISyntaxException ignore) {
        }
    }, FlutterBundle.message("flutter.analytics.privacyUrl"));
}