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.codinjutsu.tools.mongo.view.MongoConfigurable.java

License:Apache License

private LabeledComponent<TextFieldWithBrowseButton> createShellPathField() {
    LabeledComponent<TextFieldWithBrowseButton> shellPathField = new LabeledComponent<TextFieldWithBrowseButton>();
    TextFieldWithBrowseButton component = new TextFieldWithBrowseButton();
    component.getChildComponent().setName("shellPathField");
    shellPathField.setComponent(component);
    shellPathField.getComponent().addBrowseFolderListener("Mongo shell configuration", "", null,
            new FileChooserDescriptor(true, false, false, false, false, false));

    shellPathField.getComponent().setText(configuration.getShellPath());

    return shellPathField;
}

From source file:org.codinjutsu.tools.mongo.view.ServerConfigurationPanel.java

License:Apache License

private void createUIComponents() {
    shellWorkingDirField = new TextFieldWithBrowseButton();
    FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false,
            false);/* ww  w  .  j a  v  a2s . co  m*/
    ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> browseFolderActionListener = new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
            "Mongo shell working directory", null, shellWorkingDirField, null, fileChooserDescriptor,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
    shellWorkingDirField.addBrowseFolderListener(null, browseFolderActionListener, false);
    shellWorkingDirField.setName("shellWorkingDirField");
}

From source file:org.codinjutsu.tools.nosql.commons.view.ServerConfigurationPanel.java

License:Apache License

private void createUIComponents() {
    shellWorkingDirField = new TextFieldWithBrowseButton();
    FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false,
            false);/*from   w w w . j  a  va 2  s.co  m*/
    ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> browseFolderActionListener = new ComponentWithBrowseButton.BrowseFolderActionListener<>(
            "Shell working directory", null, shellWorkingDirField, null, fileChooserDescriptor,
            TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
    shellWorkingDirField.addBrowseFolderListener(null, browseFolderActionListener, false);
    shellWorkingDirField.setName("shellWorkingDirField");
}

From source file:org.cordovastudio.editors.designer.propertyTable.editors.ResourceEditor.java

License:Apache License

public ResourceEditor(@Nullable ResourceType[] types, Set<AttributeFormat> formats, String propertyName) {
    myTypes = types;// w  w w .j ava  2 s .co m
    myIsDimension = formats.contains(AttributeFormat.Dimension);
    myPropertyName = propertyName;

    if (formats.contains(AttributeFormat.Boolean) || formats.contains(AttributeFormat.OnOff)
            || formats.contains(AttributeFormat.Empty)) {

        for (AttributeFormat format : formats) {
            if (formats.contains(AttributeFormat.Boolean) || formats.contains(AttributeFormat.OnOff)
                    || formats.contains(AttributeFormat.Empty)) {
                myBooleanFormat = format;
                break;
            }
        }
        myCheckBox = new JCheckBox();
        myEditor = new ComponentWithBrowseButton<JCheckBox>(myCheckBox, null) {
            @Override
            public Dimension getPreferredSize() {
                return getComponentPreferredSize();
            }
        };
        myCheckBox.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                if (!myIgnoreCheckBoxValue) {
                    myBooleanResourceValue = null;
                    fireValueCommitted(true, true);
                }
            }
        });
    } else {
        myEditor = new TextFieldWithBrowseButton() {
            @Override
            protected void installPathCompletion(FileChooserDescriptor fileChooserDescriptor,
                    @Nullable Disposable parent) {
            }

            @Override
            public Dimension getPreferredSize() {
                return getComponentPreferredSize();
            }
        };
        myEditor.registerKeyboardAction(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
            }
        }, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

        JTextField textField = getComboText();
        textField.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                fireValueCommitted(true, true);
            }
        });
        textField.getDocument().addDocumentListener(new DocumentAdapter() {
            @Override
            protected void textChanged(final DocumentEvent e) {
                preferredSizeChanged();
            }
        });
    }

    if (myCheckBox == null) {
        myEditor.registerKeyboardAction(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
            }
        }, KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    }

    myEditor.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            showDialog();
        }
    });
    myEditor.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            myEditor.getChildComponent().requestFocus();
        }
    });
}

From source file:org.dubik.tasks.ui.forms.ExportToFileForm.java

License:Apache License

private void createUIComponents() {
    browse = new TextFieldWithBrowseButton();
    FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, false);
    browse.addBrowseFolderListener(TasksBundle.message("form.export.title"),
            TasksBundle.message("form.export.browsefolder.description"), project, descriptor);

    browse.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        public void insertUpdate(DocumentEvent e) {
            validateForm();/*from  ww  w .j ava2s . co m*/
        }

        public void removeUpdate(DocumentEvent e) {
            validateForm();
        }

        public void changedUpdate(DocumentEvent e) {
            validateForm();
        }
    });
}

From source file:org.eclipse.xtext.idea.util.IdeaWidgetFactory.java

License:Open Source License

public TextFieldWithBrowseButton browseField(final Project project) {
    final TextFieldWithBrowseButton field = new TextFieldWithBrowseButton();
    FileChooserDescriptor _createSingleFolderDescriptor = FileChooserDescriptorFactory
            .createSingleFolderDescriptor();
    final MacroAwareTextBrowseFolderListener listener = new MacroAwareTextBrowseFolderListener(
            _createSingleFolderDescriptor, project);
    field.addBrowseFolderListener(listener);
    return field;
}

From source file:org.intellij.coq.toolWindow.CoqConfigurationSettingsEditor.java

License:Open Source License

private void createUIComponents() {
    myMainClass = new LabeledComponent<ComponentWithBrowseButton>();
    myMainClass.setComponent(new TextFieldWithBrowseButton());
}

From source file:org.intellij.xquery.runner.ui.run.ContextItemPanel.java

License:Apache License

public ContextItemPanel(Project project) {
    contextItemEnabled = new JBCheckBox("Pass context item");
    contextItemEnabled.setMnemonic(KeyEvent.VK_C);
    contextItemEnabled.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            contextItemEnabledChanged();
        }//from  w w w. j ava2  s  . co  m
    });
    contextItemOptionsPanel = new JPanel(new MigLayout("ins 0, gap 5, fill, flowx"));
    contextItemEditorField = new EditorTextField("", project, StdFileTypes.PLAIN_TEXT);
    contextItemEditorContent = new MyEditorTextFieldWithBrowseButton(project, contextItemEditorField);
    contextItemEditorContent.setButtonIcon(AllIcons.Actions.ShowViewer);
    contextItemPathField = new TextFieldWithBrowseButton();
    contextItemPathField.addBrowseFolderListener("Choose file", null, null,
            FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor());
    contextItemTypeField = new LabeledComponent<JComboBox>();
    contextItemTypeField.setText("&Type");
    contextItemTypeField.setLabelLocation("West");
    contextItemTypeField.setComponent(new JComboBox());
    editorRadioButton = new JRadioButton("Custom content");
    editorRadioButton.setMnemonic(KeyEvent.VK_E);
    editorRadioButton.setSelected(true);
    editorRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            contextItemSourceChanged();
        }
    });
    fileRadioButton = new JRadioButton("Content from file");
    fileRadioButton.setMnemonic(KeyEvent.VK_L);
    fileRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            contextItemSourceChanged();
        }
    });
    buttonGroup = new ButtonGroup();
    buttonGroup.add(editorRadioButton);
    buttonGroup.add(fileRadioButton);
    setLayout(new MigLayout("ins 0, gap 5, fill, flowx"));
    add(contextItemEnabled, "shrinkx, top");
    add(contextItemOptionsPanel, "growx, pushx");
    contextItemTypeField.getComponent().setModel(typesModel);
    contextItemOptionsPanel.add(contextItemTypeField, "growx, pushx, wrap, span 2");
    contextItemOptionsPanel.add(editorRadioButton);
    contextItemOptionsPanel.add(contextItemEditorContent, "growx, pushx, wrap");
    contextItemOptionsPanel.add(fileRadioButton);
    contextItemOptionsPanel.add(contextItemPathField, "growx, pushx");
    contextItemEnabledChanged();
    contextItemSourceChanged();
    populateTypesList();
    new ComboboxSpeedSearch(contextItemTypeField.getComponent());
}

From source file:org.intellij.xquery.runner.ui.run.main.variables.ContextItemPanel.java

License:Apache License

public ContextItemPanel(Project project) {
    setName(CONTEXT_ITEM_PANEL);/*from  w w w.j a va  2s . co  m*/
    contextItemEnabled = new JBCheckBox("Pass context item");
    contextItemEnabled.setMnemonic(KeyEvent.VK_C);
    contextItemEnabled.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            contextItemEnabledChanged();
        }
    });
    contextItemOptionsPanel = new JPanel(new MigLayout("ins 0, gap 5, fill, flowx"));
    contextItemOptionsPanel.setName(CONTEXT_ITEM_OPTIONS_PANEL);
    contextItemEditorField = new EditorTextField("", project, StdFileTypes.PLAIN_TEXT);
    contextItemEditorContent = new MyEditorTextFieldWithBrowseButton(project, contextItemEditorField);
    contextItemEditorContent.getChildComponent().setName(EDITOR_CONTENT);
    contextItemEditorContent.setButtonIcon(AllIcons.Actions.ShowViewer);
    contextItemPathField = new TextFieldWithBrowseButton();
    contextItemPathField.getTextField().setName(FILE_PATH);
    addPathFieldButtonListener();
    contextItemTypeField = new LabeledComponent<JComboBox>();
    contextItemTypeField.setText("&Type");
    contextItemTypeField.setLabelLocation("West");
    contextItemTypeField.setComponent(new JComboBox());
    editorRadioButton = new JRadioButton("Custom content");
    editorRadioButton.setName(EDITOR_RADIO_BUTTON);
    editorRadioButton.setMnemonic(KeyEvent.VK_E);
    editorRadioButton.setSelected(true);
    editorRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            contextItemSourceChanged();
        }
    });
    fileRadioButton = new JRadioButton("Content from file");
    fileRadioButton.setName(FILE_RADIO_BUTTON);
    fileRadioButton.setMnemonic(KeyEvent.VK_L);
    fileRadioButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            contextItemSourceChanged();
        }
    });
    buttonGroup = new ButtonGroup();
    buttonGroup.add(editorRadioButton);
    buttonGroup.add(fileRadioButton);
    setLayout(new MigLayout("ins 0, gap 5, fill, flowx"));
    add(contextItemEnabled, "shrinkx, top");
    add(contextItemOptionsPanel, "growx, pushx");
    contextItemTypeField.getComponent().setName(CONTEXT_ITEM_TYPE);
    contextItemTypeField.getComponent().setModel(typesModel);
    contextItemOptionsPanel.add(contextItemTypeField, "growx, pushx, wrap, span 2");
    contextItemOptionsPanel.add(editorRadioButton);
    contextItemOptionsPanel.add(contextItemEditorContent, "growx, pushx, wrap");
    contextItemOptionsPanel.add(fileRadioButton);
    contextItemOptionsPanel.add(contextItemPathField, "growx, pushx");
    contextItemEnabledChanged();
    contextItemSourceChanged();
    populateTypesList();
    new ComboboxSpeedSearch(contextItemTypeField.getComponent());
}

From source file:org.jboss.forge.plugin.idea.extensions.ForgePreferencePage.java

License:Open Source License

@Override
@Nullable//w  w  w .  ja v a2 s. c  o  m
public JComponent createComponent() {
    defaultText = new File(OperatingSystemUtils.getUserForgeDir(), "addons").getAbsolutePath();
    addonsDirField = new TextFieldWithBrowseButton();
    addonsDirField.setText(defaultText);
    addonsDirField.addBrowseFolderListener("Select your preferred addon location",
            "Specifies the directory that addons will be deployed", null,
            FileChooserDescriptorFactory.createSingleFolderDescriptor());

    JPanel panel = new JPanel(new MigLayout("fillx,wrap 2", "[left]rel[grow,fill]"));
    panel.setOpaque(false);

    panel.add(new JLabel("Addons Installation Location:"));
    panel.add(addonsDirField);
    JPanel result = new JPanel(new BorderLayout());
    result.add(panel, BorderLayout.NORTH);
    return result;
}