private JPanel createExeRow(final String ext, final String path, final String args) { final JLabel extLabel = new JLabel(EXT_LABEL); final JTextField extField = new JTextField(); extField.setToolTipText(EXT_TOOLTIP); extField.setText(ext); final JLabel pathLabel = new JLabel(FILE_PATH_LABEL); final TextFieldWithBrowseButton pathField = new TextFieldWithBrowseButton(); pathField.setToolTipText("e.g. C:\\rustLS\\rls.exe"); pathField.setText(path); pathField.addBrowseFolderListener(new TextBrowseFolderListener(new FileChooserDescriptor(true, false, true, true, true, false).withShowHiddenFiles(true))); final JLabel argsLabel = new JLabel("Args"); final JTextField argsField = new JTextField(); argsField.setToolTipText("e.g. -stdio"); argsField.setText(args); final List<JComponent> components = Arrays.asList(extLabel, extField, pathLabel, pathField, argsLabel, argsField); final JPanel panel = createRow(components, ExeLanguageServerDefinition$.MODULE$.getPresentableTyp()); final scala.collection.mutable.LinkedHashMap<String, JComponent> map = new scala.collection.mutable.LinkedHashMap<>(); map.put(EXT, extField); map.put(PATH, pathField); map.put(ARGS, argsField); rows.add(new ServersGUIRow(panel, ExeLanguageServerDefinition$.MODULE$.typ(), map)); return panel; }
private JPanel createCommandRow(final String ext, final String command) { final JLabel extLabel = new JLabel(EXT_LABEL); final JTextField extField = new JTextField(); extField.setToolTipText(EXT_TOOLTIP); extField.setText(ext); final JLabel commandLabel = new JLabel("Command"); final TextFieldWithBrowseButton commandField = new TextFieldWithBrowseButton(); commandField.setText(command); commandField.setToolTipText("e.g. python.exe -m C:\\python-ls\\pyls"); commandField.addBrowseFolderListener(new TextBrowseFolderListener(new FileChooserDescriptor(true, false, true, true, true, false).withShowHiddenFiles(true))); final List<JComponent> components = Arrays.asList(extLabel, extField, commandLabel, commandField); final JPanel panel = createRow(components, RawCommandServerDefinition$.MODULE$.getPresentableTyp()); final scala.collection.mutable.LinkedHashMap<String, JComponent> map = new scala.collection.mutable.LinkedHashMap<>(); map.put(EXT, extField); map.put(COMMAND, commandField); rows.add(new ServersGUIRow(panel, RawCommandServerDefinition$.MODULE$.typ(), map)); return panel; }
private void createUIComponents() { myFileField = new LabeledComponent<>(); myFileField.setComponent(new TextFieldWithBrowseButton()); myPackageField = new LabeledComponent<>(); myPackageField.setComponent(new BallerinaPackageFieldCompletionProvider( () -> myModulesComboBox.getComponent().getSelectedModule()).createEditor(myProject)); myWorkingDirectoryField = new LabeledComponent<>(); myWorkingDirectoryField.setComponent(new TextFieldWithBrowseButton()); myParamsField = new LabeledComponent<>(); myParamsField.setComponent(new RawCommandLineEditor()); myModulesComboBox = new LabeledComponent<>(); myModulesComboBox.setComponent(new ModulesComboBox()); } }
private void createUIComponents() { myRunKindComboBox = new LabeledComponent<>(); myRunKindComboBox.setComponent(new JComboBox<>()); myFileField = new LabeledComponent<>(); myFileField.setComponent(new TextFieldWithBrowseButton()); myPackageField = new LabeledComponent<>(); myPackageField.setComponent(new BallerinaPackageFieldCompletionProvider( () -> myModulesComboBox.getComponent().getSelectedModule()).createEditor(myProject)); myWorkingDirectoryField = new LabeledComponent<>(); myWorkingDirectoryField.setComponent(new TextFieldWithBrowseButton()); myParamsField = new LabeledComponent<>(); myParamsField.setComponent(new RawCommandLineEditor()); myBallerinaParamsField = new LabeledComponent<>(); myBallerinaParamsField.setComponent(new RawCommandLineEditor()); myModulesComboBox = new LabeledComponent<>(); myModulesComboBox.setComponent(new ModulesComboBox()); }
private void createUIComponents() { myWorkingDirectoryField = new LabeledComponent<>(); myWorkingDirectoryField.setComponent(new TextFieldWithBrowseButton()); myParamsField = new LabeledComponent<>(); myParamsField.setComponent(new RawCommandLineEditor()); myModulesComboBox = new LabeledComponent<>(); myModulesComboBox.setComponent(new ModulesComboBox()); myHost = new LabeledComponent<>(); myHostField = new EditorTextField(); myHostField.setPreferredWidth(300); myHost.setComponent(myHostField); myPort = new LabeledComponent<>(); myPortField = new EditorTextField(); myPortField.setPreferredWidth(100); myPort.setComponent(myPortField); } }
private void createUIComponents() { shellWorkingDirField = new TextFieldWithBrowseButton(); shellWorkingDirField.addBrowseFolderListener("Mongo Shell Working Directory", "", null, new FileChooserDescriptor(false, true, false, false, false, false)); shellWorkingDirField.setName("shellWorkingDirField"); } }
private void createUIComponents() { documentToImportTextField = new TextFieldWithBrowseButton(); FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false); ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> privateKeyBrowseFolderActionListener = new ComponentWithBrowseButton.BrowseFolderActionListener<>("Mongo Shell Working Directory", null, documentToImportTextField, null, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT); documentToImportTextField.addBrowseFolderListener(null, privateKeyBrowseFolderActionListener, false); } }
private TextFieldWithBrowseButton createShellWorkingDirField() { TextFieldWithBrowseButton shellWorkingDirField = new TextFieldWithBrowseButton(); FileChooserDescriptor dirChooserDescriptor = new FileChooserDescriptor(false, true, false, false, false, false); ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> browseFolderActionListener = new ComponentWithBrowseButton.BrowseFolderActionListener<>("Mongo Shell Working Directory", null, shellWorkingDirField, project, dirChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT); shellWorkingDirField.addBrowseFolderListener(null, browseFolderActionListener, false); shellWorkingDirField.setName("shellWorkingDirField"); return shellWorkingDirField; }
private TextFieldWithBrowseButton createPrivateKeyField() { TextFieldWithBrowseButton privateKeyPathField = new TextFieldWithBrowseButton(); FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) .withShowHiddenFiles(true); ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> privateKeyBrowseFolderActionListener = new ComponentWithBrowseButton.BrowseFolderActionListener<>("Private Key Path", null, privateKeyPathField, project, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT); privateKeyPathField.addBrowseFolderListener(null, privateKeyBrowseFolderActionListener, false); return privateKeyPathField; }
private LabeledComponent<TextFieldWithBrowseButton> createShellPathField() { LabeledComponent<TextFieldWithBrowseButton> shellPathField = new LabeledComponent<>(); 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; }
/** * Creates a label and path selector and adds them to the configuration * window. * * @param settings Panel to add components to. * @param tool Which tool to configure. * @return The TextFieldWithBrowseButton created. */ public static TextFieldWithBrowseButton createExecutableOption(final JPanel settings, final String tool, final Object constraints) { // Create UI elements. final TextFieldWithBrowseButton tf = new TextFieldWithBrowseButton(); tf.addBrowseFolderListener("Select " + tool + " path", "", null, FileChooserDescriptorFactory.createSingleLocalFileDescriptor()); // Add elements to Panel. final JPanel subPanel = new JPanel(new GridBagLayout()); subPanel.add(new JLabel(tool + " executable path:")); subPanel.add(tf, getFillLineConstraints()); settings.add(subPanel, constraints); return tf; }
public DubBinaryForModuleStep(final WizardContext wizardContext) { this.myWizardContext = wizardContext; this.myPanel = new JPanel(new GridBagLayout()); this.myPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // Title label final JLabel titletextLabel = new JLabel(DlangBundle.INSTANCE.message("d.ui.dub.config.label.choosedublocation")); this.myPanel.add(titletextLabel, new GridBagConstraints(0, -1, 1, 1, 1.0D, 0.0D, 18, 2, new Insets(8, 10, 8, 10), 0, 0)); this.dubBinary = new TextFieldWithBrowseButton(); if(StringUtil.isNotEmpty(ToolKey.DUB_KEY.getPath())) { this.dubBinary.setText(ToolKey.DUB_KEY.getPath()); } final JButton autoFindButton = new JButton(DlangBundle.INSTANCE.message("d.ui.dub.config.label.autofind"), DlangIcons.SDK); final JLabel dubFormatLabel = new JLabel(DlangBundle.INSTANCE.message("d.ui.dub.config.label.dubbinarylocation")); dubFormatLabel.setLabelFor(dubBinary); GuiUtil.addFolderListener(dubBinary, "dub"); GuiUtil.addApplyPathAction(autoFindButton, dubBinary, "dub"); this.myPanel.add(dubFormatLabel, new GridBagConstraints(0, -1, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 0, 5, 4), 0, 0)); this.myPanel.add(dubBinary, new GridBagConstraints(0, -1, 1, 1, 1.0D, 0.0D, 18, 2, new Insets(10, 0, 20, 0), 0, 0)); this.myPanel.add(autoFindButton, new GridBagConstraints(0, -1, 1, 1, 1.0D, 0.0D, 18, 2, new Insets(10, 0, 20, 0), 0, 0)); }
private void setupUI() { rootPanel = new JPanel(new BorderLayout()); fileLocation = new TextFieldWithBrowseButton(); // TODO make these keys conform to the standards. fileLocation.setText(P4Bundle.getString("config.file.location.tooltip")); fileLocation.setToolTipText(P4Bundle.getString("configuration.p4config.chooser")); fileLocation.setEditable(true); JLabel label = SwingUtil.createLabelFor(P4Bundle.getString("configuration.p4config"), fileLocation); label.setHorizontalAlignment(SwingConstants.TRAILING); rootPanel.add(label, BorderLayout.WEST); rootPanel.add(fileLocation, BorderLayout.CENTER); } }
fileRadioButton.setText("File"); radioButtonPanel.add(fileRadioButton); fileChooser = new TextFieldWithBrowseButton(); radioButtonPanel.add(fileChooser); placeHolder = new JTextArea();
private void createUIComponents() { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor(); descriptor.setTitle("Chooser Bash Interpreter..."); this.interpreterPath = new TextFieldWithBrowseButton(null, this); this.interpreterPath.addBrowseFolderListener("Choose Bash Interpreter...", null, project, descriptor); }
label4.setText("Output directory where all output is generated"); dialogContents.add(label4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 1, false)); outputDirField = new TextFieldWithBrowseButton(); dialogContents.add(outputDirField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); libDirField = new TextFieldWithBrowseButton(); dialogContents.add(libDirField, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK|GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); autoGenerateParsersCheckBox = new JCheckBox();
@NotNull private TextFieldWithBrowseButton getPath(String configurationPath) { FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileDescriptor(EXTENSION); FileTextField field = FileChooserFactory.getInstance().createFileTextField(descriptor, null); field.getField().setEnabled(false); field.getField().setText(configurationPath); TextFieldWithBrowseButton path = new TextFieldWithBrowseButton(field.getField()); path.addBrowseFolderListener(null, null, null, descriptor, TEXT_FIELD_WHOLE_TEXT); return path; }
private void createUIComponents() { mySchemaLocation = new TextFieldWithBrowseButton(); final String title = "Choose XSD or DTD schema"; mySchemaLocation.addBrowseFolderListener( myOutputDir = new TextFieldWithBrowseButton(); FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor(); myOutputDir.addBrowseFolderListener("Select Output Directory For Generated Files", "", myProject, descriptor);
this.directoryField = new TextFieldWithBrowseButton(); dirPanel.add(directoryField, BorderLayout.CENTER); directoryField.setButtonEnabled(true);
protected void initOwnComponents() { Project project = getProject(); FileChooserDescriptor chooseInterpreterDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor(); chooseInterpreterDescriptor.setTitle("Choose Interpreter..."); interpreterPathField = new TextFieldWithBrowseButton(); interpreterPathField.addBrowseFolderListener(new MacroAwareTextBrowseFolderListener(chooseInterpreterDescriptor, project)); interpreterPathComponent = LabeledComponent.create(createComponentWithMacroBrowse(interpreterPathField), "Interpreter path:"); interpreterPathComponent.setLabelLocation(BorderLayout.WEST); projectInterpreterCheckbox = new JBCheckBox(); projectInterpreterCheckbox.setToolTipText("If enabled then the interpreter path configured in the project settings will be used instead of a custom location."); projectInterpreterCheckbox.addChangeListener(e -> { boolean selected = projectInterpreterCheckbox.isSelected(); UIUtil.setEnabled(interpreterPathComponent, !selected, true); }); projectInterpreterLabeled = LabeledComponent.create(projectInterpreterCheckbox, "Use project interpreter"); projectInterpreterLabeled.setLabelLocation(BorderLayout.WEST); interpreterParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "Interpreter options"); interpreterParametersComponent.setLabelLocation(BorderLayout.WEST); scriptNameField = new TextFieldWithBrowseButton(); scriptNameField.addBrowseFolderListener(new MacroAwareTextBrowseFolderListener(FileChooserDescriptorFactory.createSingleLocalFileDescriptor(), project)); scriptNameComponent = LabeledComponent.create(createComponentWithMacroBrowse(scriptNameField), "Script:"); scriptNameComponent.setLabelLocation(BorderLayout.WEST); }