Search in sources :

Example 41 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.

the class CommonProgramParametersPanel method initComponents.

protected void initComponents() {
    myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), ExecutionBundle.message("run.configuration.program.parameters"));
    FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    //noinspection DialogTitleCapitalization
    fileChooserDescriptor.setTitle(ExecutionBundle.message("select.working.directory.message"));
    myWorkingDirectoryField = new TextFieldWithBrowseButton();
    myWorkingDirectoryField.addBrowseFolderListener(new MacroAwareTextBrowseFolderListener(fileChooserDescriptor, getProject()) {

        @Override
        public void actionPerformed(ActionEvent e) {
            myFileChooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, myModuleContext);
            setProject(getProject());
            super.actionPerformed(e);
        }
    });
    myWorkingDirectoryComponent = LabeledComponent.create(createComponentWithMacroBrowse(myWorkingDirectoryField), ExecutionBundle.message("run.configuration.working.directory.label"));
    myEnvVariablesComponent = new EnvironmentVariablesComponent();
    myEnvVariablesComponent.setLabelLocation(BorderLayout.WEST);
    myProgramParametersComponent.setLabelLocation(BorderLayout.WEST);
    myWorkingDirectoryComponent.setLabelLocation(BorderLayout.WEST);
    addComponents();
    setPreferredSize(new Dimension(10, 10));
    copyDialogCaption(myProgramParametersComponent);
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) MacroAwareTextBrowseFolderListener(com.intellij.ui.MacroAwareTextBrowseFolderListener) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) ActionEvent(java.awt.event.ActionEvent) RawCommandLineEditor(com.intellij.ui.RawCommandLineEditor) EnvironmentVariablesComponent(com.intellij.execution.configuration.EnvironmentVariablesComponent)

Example 42 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.

the class ExportToHTMLDialog method createNorthPanel.

@Override
protected JComponent createNorthPanel() {
    OptionGroup optionGroup = new OptionGroup();
    myRbCurrentFile = new JRadioButton(CodeEditorBundle.message("export.to.html.file.name.radio", (myFileName != null ? myFileName : "")));
    optionGroup.add(myRbCurrentFile);
    myRbSelectedText = new JRadioButton(CodeEditorBundle.message("export.to.html.selected.text.radio"));
    optionGroup.add(myRbSelectedText);
    myRbCurrentPackage = new JRadioButton(CodeEditorBundle.message("export.to.html.all.files.in.directory.radio", (myDirectoryName != null ? myDirectoryName : "")));
    optionGroup.add(myRbCurrentPackage);
    myCbIncludeSubpackages = new JCheckBox(CodeEditorBundle.message("export.to.html.include.subdirectories.checkbox"));
    optionGroup.add(myCbIncludeSubpackages, true);
    FileTextField field = FileChooserFactory.getInstance().createFileTextField(FileChooserDescriptorFactory.createSingleFolderDescriptor(), myDisposable);
    myTargetDirectoryField = new TextFieldWithBrowseButton(field.getField());
    LabeledComponent<TextFieldWithBrowseButton> labeledComponent = assignLabel(myTargetDirectoryField, myProject);
    optionGroup.add(labeledComponent);
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(myRbCurrentFile);
    buttonGroup.add(myRbSelectedText);
    buttonGroup.add(myRbCurrentPackage);
    ActionListener actionListener = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            myCbIncludeSubpackages.setEnabled(myRbCurrentPackage.isSelected());
        }
    };
    myRbCurrentFile.addActionListener(actionListener);
    myRbSelectedText.addActionListener(actionListener);
    myRbCurrentPackage.addActionListener(actionListener);
    return optionGroup.createPanel();
}
Also used : OptionGroup(com.intellij.ui.OptionGroup) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) FileTextField(com.intellij.openapi.fileChooser.FileTextField)

Example 43 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.

the class ExtractIncludeDialog method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new VerticalFlowLayout());
    JLabel nameLabel = new JLabel();
    panel.add(nameLabel);
    myNameField = new JTextField();
    nameLabel.setLabelFor(myNameField);
    myNameField.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(DocumentEvent e) {
            validateOKButton();
        }
    });
    panel.add(myNameField);
    nameLabel.setText(getNameLabel());
    myTargetDirLabel = new JLabel();
    panel.add(myTargetDirLabel);
    myTargetDirectoryField = new TextFieldWithBrowseButton();
    myTargetDirectoryField.setText(myCurrentDirectory.getVirtualFile().getPresentableUrl());
    myTargetDirectoryField.addBrowseFolderListener(RefactoringBundle.message("select.target.directory"), RefactoringBundle.message("select.target.directory.description"), null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
    myTargetDirLabel.setText(RefactoringBundle.message("extract.to.directory"));
    panel.add(myTargetDirectoryField);
    myTargetDirectoryField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        public void textChanged(DocumentEvent event) {
            validateOKButton();
        }
    });
    validateOKButton();
    return panel;
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 44 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.

the class ExportOptionsDialog method createCenterPanel.

@Nullable
protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints gc = new GridBagConstraints();
    gc.insets = JBUI.insets(2);
    gc.gridwidth = 1;
    gc.gridheight = 1;
    gc.gridx = 0;
    gc.gridy = 0;
    gc.anchor = GridBagConstraints.WEST;
    gc.fill = GridBagConstraints.NONE;
    gc.weightx = 0;
    gc.weighty = 0;
    panel.add(new JLabel("Export:"), gc);
    gc.gridx += 1;
    gc.gridwidth = 2;
    gc.weightx = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    JLabel urlLabel = new JLabel(myURL.toString());
    urlLabel.setFont(urlLabel.getFont().deriveFont(Font.BOLD));
    panel.add(urlLabel, gc);
    gc.gridy += 1;
    gc.gridwidth = 1;
    gc.gridx = 0;
    gc.weightx = 0;
    gc.fill = GridBagConstraints.NONE;
    panel.add(new JLabel("Destination:"), gc);
    gc.gridx += 1;
    gc.gridwidth = 2;
    gc.weightx = 1;
    gc.fill = GridBagConstraints.HORIZONTAL;
    myPathField = new TextFieldWithBrowseButton(this);
    myPathField.setText(myFile.getAbsolutePath());
    myPathField.setEditable(false);
    panel.add(myPathField, gc);
    gc.gridy += 1;
    gc.gridx = 0;
    gc.weightx = 0;
    gc.gridwidth = 3;
    gc.fill = GridBagConstraints.NONE;
    // other options.
    final JLabel depthLabel = new JLabel(SvnBundle.message("label.depth.text"));
    depthLabel.setToolTipText(SvnBundle.message("label.depth.description"));
    panel.add(depthLabel, gc);
    ++gc.gridx;
    myDepth = new DepthCombo(false);
    panel.add(myDepth, gc);
    depthLabel.setLabelFor(myDepth);
    gc.gridx = 0;
    gc.gridy += 1;
    myForceCheckbox = new JCheckBox("Replace existing files");
    myForceCheckbox.setSelected(true);
    panel.add(myForceCheckbox, gc);
    gc.gridy += 1;
    myExternalsCheckbox = new JCheckBox("Include externals locations");
    myExternalsCheckbox.setSelected(true);
    panel.add(myExternalsCheckbox, gc);
    gc.gridy += 1;
    gc.gridwidth = 2;
    panel.add(new JLabel("Override 'native' EOLs with:"), gc);
    gc.gridx += 2;
    gc.gridwidth = 1;
    myEOLStyleBox = new JComboBox(new Object[] { "None", "LF", "CRLF", "CR" });
    panel.add(myEOLStyleBox, gc);
    gc.gridy += 1;
    gc.gridwidth = 3;
    gc.gridx = 0;
    gc.weightx = 1;
    gc.weighty = 1;
    gc.anchor = GridBagConstraints.SOUTH;
    gc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(new JSeparator(), gc);
    return panel;
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) DepthCombo(org.jetbrains.idea.svn.DepthCombo) Nullable(org.jetbrains.annotations.Nullable)

Example 45 with TextFieldWithBrowseButton

use of com.intellij.openapi.ui.TextFieldWithBrowseButton in project intellij-community by JetBrains.

the class SvnMergeInfoRootPanelManual method init.

private void init() {
    myContentPanel = new JPanel(new GridBagLayout()) {

        @Override
        public void setBounds(final Rectangle r) {
            super.setBounds(r);
        }
    };
    myContentPanel.setMinimumSize(new Dimension(200, 100));
    final GridBagConstraints gb = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBUI.insets(1), 0, 0);
    myInclude = new JCheckBox();
    gb.fill = GridBagConstraints.NONE;
    gb.weightx = 0;
    myContentPanel.add(myInclude, gb);
    // newline
    JLabel hereLabel = new JLabel("From:");
    ++gb.gridy;
    gb.gridx = 0;
    myContentPanel.add(hereLabel, gb);
    myUrlText = new JTextArea();
    myUrlText.setLineWrap(true);
    myUrlText.setBackground(UIUtil.getLabelBackground());
    myUrlText.setWrapStyleWord(true);
    gb.weightx = 1;
    ++gb.gridx;
    gb.gridwidth = 2;
    gb.fill = GridBagConstraints.HORIZONTAL;
    myContentPanel.add(myUrlText, gb);
    // newline
    gb.fill = GridBagConstraints.NONE;
    JLabel thereLabel = new JLabel("To:");
    gb.weightx = 0;
    gb.gridwidth = 1;
    ++gb.gridy;
    gb.gridx = 0;
    myContentPanel.add(thereLabel, gb);
    myBranchField = new TextFieldWithBrowseButton();
    gb.weightx = 1;
    ++gb.gridx;
    gb.gridwidth = 2;
    gb.fill = GridBagConstraints.HORIZONTAL;
    myContentPanel.add(myBranchField, gb);
    // newline
    gb.gridx = 1;
    ++gb.gridy;
    gb.gridwidth = 1;
    myLocalArea = new JTextArea();
    myLocalArea.setBackground(UIUtil.getLabelBackground());
    myLocalArea.setLineWrap(true);
    myLocalArea.setWrapStyleWord(true);
    myContentPanel.add(myLocalArea, gb);
    ++gb.gridx;
    gb.weightx = 0;
    gb.fill = GridBagConstraints.NONE;
    myFixedSelectLocal = new FixedSizeButton(20);
    myContentPanel.add(myFixedSelectLocal, gb);
    ++gb.gridy;
    gb.gridx = 0;
    gb.gridwidth = 2;
    myMixedRevisions = new JTextArea("Mixed Revision Working Copy");
    myMixedRevisions.setForeground(JBColor.RED);
    myMixedRevisions.setBackground(myContentPanel.getBackground());
    myContentPanel.add(myMixedRevisions, gb);
    myMixedRevisions.setVisible(false);
}
Also used : TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) FixedSizeButton(com.intellij.openapi.ui.FixedSizeButton)

Aggregations

TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)59 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)22 NotNull (org.jetbrains.annotations.NotNull)12 VirtualFile (com.intellij.openapi.vfs.VirtualFile)9 ActionEvent (java.awt.event.ActionEvent)9 ActionListener (java.awt.event.ActionListener)8 JBLabel (com.intellij.ui.components.JBLabel)6 JBTextField (com.intellij.ui.components.JBTextField)6 DocumentEvent (javax.swing.event.DocumentEvent)6 File (java.io.File)5 Nullable (org.jetbrains.annotations.Nullable)5 FileTextField (com.intellij.openapi.fileChooser.FileTextField)4 ComboBox (com.intellij.openapi.ui.ComboBox)4 TextBrowseFolderListener (com.intellij.openapi.ui.TextBrowseFolderListener)4 DocumentListener (javax.swing.event.DocumentListener)4 AndroidTargetHash.getAddonHashString (com.android.sdklib.AndroidTargetHash.getAddonHashString)3 BuildFileKey (com.android.tools.idea.gradle.parser.BuildFileKey)3 ComponentWithBrowseButton (com.intellij.openapi.ui.ComponentWithBrowseButton)3 RawCommandLineEditor (com.intellij.ui.RawCommandLineEditor)3 JBCheckBox (com.intellij.ui.components.JBCheckBox)3