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 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); } }