Example usage for com.intellij.openapi.ui TextFieldWithBrowseButton TextFieldWithBrowseButton

List of usage examples for com.intellij.openapi.ui TextFieldWithBrowseButton TextFieldWithBrowseButton

Introduction

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

Prototype

public TextFieldWithBrowseButton() 

Source Link

Usage

From source file:org.jetbrains.plugins.ruby.ruby.run.confuguration.RubyRunConfigurationUIUtil.java

License:Apache License

public static LabeledComponent createTestFolderComponent(
        final Ref<TextFieldWithBrowseButton> testsFolderTextFieldWrapper) {
    final TextFieldWithBrowseButton testsFolderTextField = new TextFieldWithBrowseButton();
    testsFolderTextFieldWrapper.set(testsFolderTextField);

    LabeledComponent<TextFieldWithBrowseButton> myComponent = new LabeledComponent<TextFieldWithBrowseButton>();
    myComponent.setComponent(testsFolderTextField);
    myComponent.setText(RBundle.message("run.configuration.messages.folder.path"));

    return myComponent;
}

From source file:org.jetbrains.plugins.ruby.ruby.run.confuguration.tests.RTestsRunConfigurationForm.java

License:Apache License

private LabeledComponent createTestClassComponent() {
    myTestClassField = new TextFieldWithBrowseButton();

    LabeledComponent<TextFieldWithBrowseButton> myComponent = new LabeledComponent<TextFieldWithBrowseButton>();
    myComponent.setComponent(myTestClassField);
    myComponent.setText(RBundle.message("run.configuration.tests.dialog.components.class"));

    BrowseModuleValueActionListener classBrowser = new TestCaseClassBrowser(myProject, this);

    classBrowser.setField(myTestClassField);

    return myComponent;
}

From source file:org.jetbrains.plugins.ruby.ruby.run.confuguration.tests.RTestsRunConfigurationForm.java

License:Apache License

private LabeledComponent createTestMethodComponent() {
    myTestMethodTextField = new TextFieldWithBrowseButton();

    LabeledComponent<TextFieldWithBrowseButton> myComponent = new LabeledComponent<TextFieldWithBrowseButton>();

    myComponent.setComponent(myTestMethodTextField);
    myComponent.setText(RBundle.message("run.configuration.tests.messages.method.name"));

    BrowseModuleValueActionListener methodBrowser = new TestMethodBrowser(myProject, this);
    methodBrowser.setField(myTestMethodTextField);

    return myComponent;
}

From source file:org.jetbrains.plugins.ruby.ruby.run.confuguration.tests.RTestsRunConfigurationForm.java

License:Apache License

private LabeledComponent createWorkDirComponent() {
    myWorkDirTextField = new TextFieldWithBrowseButton();

    LabeledComponent<TextFieldWithBrowseButton> myComponent = new LabeledComponent<TextFieldWithBrowseButton>();
    myComponent.setComponent(myWorkDirTextField);
    myComponent.setText(RBundle.message("run.configuration.messages.working.dir"));

    return myComponent;
}

From source file:org.jetbrains.tfsIntegration.ui.FieldWithButtonCellEditor.java

License:Apache License

public FieldWithButtonCellEditor(boolean pathCompletion, final Helper<T> helper) {
    super(new JTextField());
    setClickCountToStart(1);//from w  w  w .j  a  va  2  s .  com

    final TextFieldWithBrowseButton field = pathCompletion ? new TextFieldWithBrowseButton()
            : new TextFieldWithBrowseButton.NoPathCompletion();
    field.setOpaque(false);
    field.getTextField().setBorder(BorderFactory.createEmptyBorder());

    field.getButton().addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            String result = helper.processButtonClick(field.getText());
            if (result != null) {
                field.setText(result);
            }
        }
    });

    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            //noinspection unchecked
            field.setText(helper.toStringRepresentation((T) value));
        }

        @Nullable
        public Object getCellEditorValue() {
            return helper.fromStringRepresentation(field.getText());
        }

        public boolean shouldSelectCell(EventObject anEvent) {
            if (anEvent instanceof MouseEvent) {
                MouseEvent e = (MouseEvent) anEvent;
                return e.getID() != MouseEvent.MOUSE_DRAGGED;
            }
            return true;
        }
    };
    editorComponent = field;
}

From source file:org.mustbe.consulo.ide.impl.NewProjectOrModuleDialogWithSetup.java

License:Apache License

public NewProjectOrModuleDialogWithSetup(@Nullable Project project, @Nullable VirtualFile virtualFile) {
    super(project, true);
    myModuleCreation = virtualFile != null;

    setTitle(myModuleCreation ? IdeBundle.message("title.add.module") : IdeBundle.message("title.new.project"));

    val context = new NewModuleContext();

    for (NewModuleBuilder newModuleBuilder : NewModuleBuilder.EP_NAME.getExtensions()) {
        newModuleBuilder.setupContext(context);
    }//ww  w.  j  ava  2  s.  c om

    DListItem.Builder root = DListItem.builder();

    Map<String, DListItem.Builder> map = new HashMap<String, DListItem.Builder>();

    for (Pair<String[], NewModuleBuilderProcessor> pair : context.getSetup()) {
        String[] path = pair.getFirst();
        NewModuleBuilderProcessor processor = pair.getSecond();

        DListItem.Builder prev = root;
        for (int i = 0; i < path.length; i++) {
            String item = path[i];

            DListItem.Builder builder = map.get(item);
            if (builder == null) {
                Pair<String, Icon> itemInfo = context.getItem(item);

                map.put(item, builder = DListItem.builder().withName(itemInfo.getFirst())
                        .withIcon(itemInfo.getSecond()).withAttach(processor));

                prev.withItems(builder);
            }

            prev = builder;
        }
    }

    mySplitter = new JBSplitter(0.3f);
    mySplitter.setSplitterProportionKey("#NewProjectOrModuleDialogWithSetup.Splitter");

    myListWithChildren = new DListWithChildren();
    myListWithChildren.select(root.create());

    mySplitter.setFirstComponent(new JBScrollPane(myListWithChildren));

    final JPanel panel = new JPanel(new VerticalFlowLayout());

    myNameField = new JTextField();
    myLocationField = new TextFieldWithBrowseButton();

    panel.add(LabeledComponent.create(myNameField, "Name").setLabelLocation(BorderLayout.WEST));

    if (virtualFile != null) {
        myNameField.setText(virtualFile.getName());
    } else {
        panel.add(LabeledComponent.create(myLocationField, "Path").setLabelLocation(BorderLayout.WEST));

        new LocationNameFieldsBinding(project, myLocationField, myNameField, ProjectUtil.getBaseDir(),
                "Select Directory");
    }

    panel.add(new SeparatorComponent());

    final JPanel etcPanel = new JPanel(new BorderLayout());

    panel.add(etcPanel);

    final JPanel nullPanel = new JPanel(new BorderLayout());

    mySplitter.setSecondComponent(nullPanel);

    myListWithChildren.setConsumer(new Consumer<DListItem>() {
        @Override
        public void consume(final DListItem dListItem) {
            myProcessor = dListItem == null ? null : (NewModuleBuilderProcessor) dListItem.getAttach();

            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    myConfigurationPanel = nullPanel;
                    etcPanel.removeAll();

                    mySplitter.setSecondComponent(nullPanel);

                    if (dListItem != null) {
                        if (myProcessor != null) {
                            myConfigurationPanel = myProcessor.createConfigurationPanel();
                            etcPanel.add(myConfigurationPanel, BorderLayout.NORTH);
                        }
                        mySplitter.setSecondComponent(panel);
                    }
                }
            });

            setOKActionEnabled(myProcessor != null);
        }
    });

    setOKActionEnabled(false);
    init();
}

From source file:org.perfcake.ide.intellij.exec.PerfCakeRunConfigPanel.java

License:Apache License

private void createUiComponents() {

    scenarioPathLabel = new JLabel("Scenario path:");
    javaHomeLabel = new JLabel("Java home:");
    perfcakeHomeLabel = new JLabel("PerfCake home:");
    messageDirLabel = new JLabel("Messages dir:");
    pluginDirLabel = new JLabel("Plugins dir:");
    systemPropertiesLabel = new JLabel("System properties:");

    debugLabel = new JLabel("Start debug agent:");
    debugNameLabel = new JLabel("Debug JMX agent name:");

    List<JComponent> leftColumnComponents = new ArrayList<>(
            Arrays.asList(scenarioPathLabel, javaHomeLabel, perfcakeHomeLabel, messageDirLabel, pluginDirLabel,
                    systemPropertiesLabel, debugLabel, debugNameLabel));

    FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false,
            false);// w ww  . j  ava 2 s . c o m
    FileChooserDescriptor dirChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false,
            false);

    scenarioPathField = new TextFieldWithBrowseButton();
    scenarioPathField.addBrowseFolderListener(new TextBrowseFolderListener(fileChooserDescriptor));

    Sdk sdk = ProjectRootManager.getInstance(project).getProjectSdk();
    javaHomeField = new TextFieldWithBrowseButton();
    if (sdk != null) {
        javaHomeField.setText(sdk.getHomePath());
    }
    javaHomeField.addBrowseFolderListener(new TextBrowseFolderListener(dirChooserDescriptor));

    perfcakeHomeField = new TextFieldWithBrowseButton();
    perfcakeHomeField.addBrowseFolderListener(new TextBrowseFolderListener(dirChooserDescriptor));

    messageDirField = new TextFieldWithBrowseButton();
    messageDirField.addBrowseFolderListener(new TextBrowseFolderListener(dirChooserDescriptor));

    pluginDirField = new TextFieldWithBrowseButton();
    pluginDirField.addBrowseFolderListener(new TextBrowseFolderListener(dirChooserDescriptor));

    JPanel propertiesPanel = createPropertiesPanel();

    debugCheckBox = new JCheckBox();
    debugNameField = new JTextField("perfcake-1");
    List<JComponent> rightColumnComponents = new ArrayList<>(
            Arrays.asList(scenarioPathField, javaHomeField, perfcakeHomeField, messageDirField, pluginDirField,
                    propertiesPanel, debugCheckBox, debugNameField));
    if (isDebugConfigByDefault) {
        debugCheckBox.setSelected(true);
    } else {
        debugCheckBox.setSelected(false);
        debugNameField.setEnabled(false);
    }

    debugCheckBox.addActionListener(e -> {
        debugNameField.setEnabled(debugCheckBox.isSelected());
    });

    this.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.2;
    c.gridwidth = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(2, 5, 2, 5);

    JLabel header = new JLabel("<isHtmlUsed><h3>PerfCake run configuration</h3></isHtmlUsed>");

    add(header, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridwidth = 1;
    c.gridy = 1;

    for (JComponent component : leftColumnComponents) {
        this.add(component, c);
        c.gridy++;
    }

    c.gridx = 1;
    c.gridy = 1;
    c.weightx = 0.8;

    c.fill = GridBagConstraints.HORIZONTAL;

    for (JComponent component : rightColumnComponents) {
        this.add(component, c);
        c.gridy++;
    }
}

From source file:org.perfcake.ide.intellij.settings.PerfCakeSettingsForm.java

License:Apache License

/**
 * Creates new PerfCake settings form.//  w w  w  . j av  a  2s  . co  m
 */
public PerfCakeSettingsForm() {
    installationLabel = new JLabel("PerfCake location:");
    installationField = new TextFieldWithBrowseButton();
    FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false,
            false);
    TextBrowseFolderListener browseFolderListener = new TextBrowseFolderListener(fileChooserDescriptor);
    installationField.addBrowseFolderListener(browseFolderListener);
    wrongLocationLabel = new JLabel();
    wrongLocationLabel.setForeground(Color.red);
    String storedInstallation = PropertiesComponent.getInstance().getValue(Pc4ideSettings.INSTALLATION_DIR_KEY,
            "");
    PerfCakeInstallationValidator validator = new SimpleInstallationValidator();

    if (storedInstallation != null && !validator.isValid(Paths.get(storedInstallation))) {
        wrongLocationLabel.setText(INVALID_PATH_MESSAGE);
    }

    this.setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(2, 10, 2, 10);
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.fill = GridBagConstraints.NONE;

    add(installationLabel, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridy = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 1;

    add(installationField, c);

    installationField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            changedUpdate(e);
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            if (validator.isValid(Paths.get(getInstallationFolder()))) {
                wrongLocationLabel.setText("");
            } else {
                wrongLocationLabel.setText(INVALID_PATH_MESSAGE);
            }
        }
    });

    c.gridy = 2;
    c.weightx = 0;
    c.weighty = 0;
    add(wrongLocationLabel, c);

    c.weighty = 1;
    c.gridy = 3;
    add(new JPanel(), c);
}

From source file:repl.simple.mathematica.Ui.ConfigCenterPanel.java

License:Open Source License

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL//  ww w.  ja  v a 2  s.  c o  m
 */
private void $$$setupUI$$$() {
    rootPanel = new JPanel();
    rootPanel.setLayout(new GridLayoutManager(13, 2, new Insets(0, 0, 0, 0), -1, -1));
    final JLabel label1 = new JLabel();
    label1.setText("MathLink Path");
    rootPanel.add(label1,
            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label2 = new JLabel();
    label2.setText("MathKernel Path");
    rootPanel.add(label2,
            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label3 = new JLabel();
    label3.setText("Native Library Path");
    rootPanel.add(label3,
            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    mathLinkPath = new TextFieldWithBrowseButton();
    mathLinkPath.setText("");
    rootPanel.add(mathLinkPath,
            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    mathKernelPath = new TextFieldWithBrowseButton();
    rootPanel.add(mathKernelPath,
            new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    nativeLibPath = new TextFieldWithBrowseButton();
    rootPanel.add(nativeLibPath,
            new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final Spacer spacer1 = new Spacer();
    rootPanel.add(spacer1,
            new GridConstraints(12, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1,
                    GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    final JLabel label4 = new JLabel();
    label4.setText("Math Link Arguments");
    rootPanel.add(label4,
            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(135, 31), null, 0, false));
    mathLinkArgs = new JTextField();
    rootPanel.add(mathLinkArgs,
            new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, 31), null, 0, false));
    final JLabel label5 = new JLabel();
    label5.setText("Text Color");
    rootPanel.add(label5,
            new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label6 = new JLabel();
    label6.setText("Background");
    rootPanel.add(label6,
            new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label7 = new JLabel();
    label7.setText("String Color");
    rootPanel.add(label7,
            new GridConstraints(6, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label8 = new JLabel();
    label8.setText("System Color");
    rootPanel.add(label8,
            new GridConstraints(7, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label9 = new JLabel();
    label9.setText("Comment Color");
    rootPanel.add(label9,
            new GridConstraints(8, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    final JLabel label10 = new JLabel();
    label10.setText("Prompt Color");
    rootPanel.add(label10,
            new GridConstraints(9, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    textColor = new ColorPanel();
    rootPanel.add(textColor,
            new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    background = new ColorPanel();
    rootPanel.add(background,
            new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    stringColor = new ColorPanel();
    rootPanel.add(stringColor,
            new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    systemColor = new ColorPanel();
    rootPanel.add(systemColor,
            new GridConstraints(7, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    commentColor = new ColorPanel();
    rootPanel.add(commentColor,
            new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JLabel label11 = new JLabel();
    label11.setText("Message Color");
    rootPanel.add(label11,
            new GridConstraints(10, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    promptColor = new ColorPanel();
    rootPanel.add(promptColor,
            new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    messageColor = new ColorPanel();
    rootPanel.add(messageColor,
            new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL,
                    GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null,
                    new Dimension(150, -1), null, 0, false));
    final JLabel label12 = new JLabel();
    label12.setText("Syntax Highlight");
    rootPanel.add(label12,
            new GridConstraints(11, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0,
                    false));
    syntaxHighlight = new JCheckBox();
    syntaxHighlight.setText("");
    rootPanel.add(syntaxHighlight,
            new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                    GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}