Java 类com.intellij.openapi.ui.TextFieldWithBrowseButton 实例源码

项目:Goal-Intellij-Plugin    文件:GoalSettingsEditor.java   
/**
 * Creates a new GOAL MAS configuration editor.
 *
 * @param project the project this editor is for
 */
public GoalSettingsEditor(final @NotNull Project project) {
    this.project = project;
    this.ui = new JPanel();

    this.fileChooser = this.rebuildChooser(project);

    final JLabel fileLabel = new JLabel("File to run:");

    this.fileBox = new TextFieldWithBrowseButton.NoPathCompletion();
    this.fileBox.addActionListener(event -> this.fileChooser.showDialog());
    this.fileBox.setEditable(false);
    this.fileBox.setAlignmentX(0);
    this.fileBox.setAlignmentY(0);
    //this.fileBox.setEditable(true);

    this.ui.add(fileLabel);
    this.ui.add(this.fileBox);
}
项目:sutr-io    文件:SutrConfigPanel.java   
private void AddFileSelectorHandler(TextFieldWithBrowseButton textFieldWithBrowseButton, Project project, String label, String description) {

        textFieldWithBrowseButton.addActionListener(
            e -> {
                final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(new FileSaverDescriptor(label, description), myPanel);
                final String path = FileUtil.toSystemIndependentName(getFileName(textFieldWithBrowseButton));
                final int idx = path.lastIndexOf("/");
                VirtualFile baseDir = idx == -1 ? project.getBaseDir() :
                        (LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path.substring(0, idx))));
                baseDir = baseDir == null ? project.getBaseDir() : baseDir;
                final String name = idx == -1 ? path : path.substring(idx + 1);
                final VirtualFileWrapper fileWrapper = dialog.save(baseDir, name);
                if (fileWrapper != null) {
                    textFieldWithBrowseButton.setText(fileWrapper.getFile().getPath());
                }
            }
        );
    }
项目:intellij-nette-tester    文件:TesterConfigurableForm.java   
private void createUIComponents() {
    defaultExtensionLabel = new JBLabel(TesterBundle.message("settings.defaultExtension"));
    defaultExtensionCombobox = new ComboBox<>(new String[]{"phpt", "php"});

    bootstrapFileLabel = new JBLabel(TesterBundle.message("settings.bootstrapFile"));
    bootstrapFileField = new TextFieldWithBrowseButton();
    bootstrapFileField.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("php"));

    namespaceMappingTable = new NamespaceMappingTable(project);
    namespaceMappingPanel = ToolbarDecorator.createDecorator(namespaceMappingTable.getTableView(), new ElementProducer<TesterNamespaceMapping>() {
        @Override
        public TesterNamespaceMapping createElement() {
            return new TesterNamespaceMapping();
        }

        @Override
        public boolean canCreateElement() {
            return true;
        }
    }).createPanel();

    namespaceMappingPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.LIGHT_GRAY), TesterBundle.message("settings.namespaceMappings.title")));
}
项目:intellij-nette-tester    文件:TesterTestEnvironmentSettingsEditor.java   
private void createUIComponents() {
    phpInterpreter = new PhpInterpreterComboBox(project, null);
    phpInterpreter.setModel(PhpInterpretersManagerImpl.getInstance(project).getInterpreters(), null);
    phpInterpreter.setNoItemText("<default project interpreter>");

    interpreterOptions = new PhpConfigurationOptionsComponent();

    phpIniPath = new TextFieldWithBrowseButton();
    phpIniPath.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("ini"));

    useSystemPhpIniCheckbox = new JBCheckBox(TesterBundle.message("runConfiguration.editor.testEnv.useSystemPhpIni"));

    interpreterLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.testEnv.interpreter"));
    interpreterOptionsLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.testEnv.interpreterOptions"));
    pathToPhpIniLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.testEnv.phpIni"));
}
项目:intellij-nette-tester    文件:TesterSettingsEditor.java   
private void createUIComponents() {
    testScope = new TextFieldWithBrowseButton();
    testScope.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor());

    testerExecutable = new TextFieldWithBrowseButton();
    testerExecutable.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor());

    testerOptions = new RawCommandLineEditor();
    testerOptions.setDialogCaption("Options");

    userSetupScript = new TextFieldWithBrowseButton();
    userSetupScript.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("php"));

    testScopeLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.testScope"));
    testerExecutableLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.testerExecutable"));
    testerOptionsLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.testerOptions"));
    setupScriptLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.setupScript"));
}
项目:PackageTemplates    文件:SelectPackageTemplateDialog.java   
private void makePathButton() {
        btnPath = new TextFieldWithBrowseButton();
        btnPath.setText(PackageTemplateHelper.getRootDirPath());
        btnPath.addBrowseFolderListener(Localizer.get("SelectPackageTemplate"), "", project, FileReaderUtil.getPackageTemplatesDescriptor());

//        panel.add(new SeparatorComponent(), new CC().growX().spanX().wrap());
        panel.add(btnPath, new CC().pushX().growX().spanX());
        addPathButtons();

        rbFromPath = new JBRadioButton(Localizer.get("label.FromPath"));
        rbFromPath.addItemListener(e -> {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                toggleSourcePath(
                        TemplateSourceType.PATH,
                        null,
                        btnPath
                );
            }
        });

        panel.add(rbFromPath, new CC().growX().spanX().wrap());
    }
项目:arma-intellij-plugin    文件:ArmaPluginSettingsForm.java   
private void createUIComponents() {
    tfArmaToolsDir = new JTextField(40);
    {
        panelForTfArmaToolsDir = new TextFieldWithBrowseButton(tfArmaToolsDir, e -> {
            JFileChooser fc = new JFileChooser();
            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            fc.showDialog(panelRoot, getBundle().getString("ApplicationSettings.ArmaToolsConfig.select"));
            File file = fc.getSelectedFile();

            if (file == null) {
                return;
            }
            tfArmaToolsDir.setText(file.getAbsolutePath());
        });
    }
}
项目:clion-kernel    文件:DeviceDriverForm.java   
public DeviceDriverForm() {
    author.setText(System.getProperty("user.name"));
    license.addItem(new ComboItem(DriverLicenseType.GPL.name(), DriverLicenseType.GPL.name()));
    license.addItem(new ComboItem(DriverLicenseType.BSD.name(), DriverLicenseType.BSD.name()));
    license.addItem(new ComboItem(DriverLicenseType.DUAL.name(), DriverLicenseType.DUAL.name()));
    kernelVersion.setText(KernelBundle.getString("kernel.version") + " " + System.getProperty("os.version"));
    useHostKernelCheckBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            kernelSourcePath.setEnabled(!useHostKernelCheckBox.isSelected());
        }
    });

    TextFieldWithBrowseButton textFieldWithBrowseButton = new TextFieldWithBrowseButton();
    textFieldWithBrowseButton.addBrowseFolderListener(KernelBundle.getString("choose.kernel.sources"), null, null,
            new FileChooserDescriptor(false, true, false, false, false, false));
    kernelSourcePath.setComponent(textFieldWithBrowseButton);
    kernelSourcePath.setEnabled(false);
    kernelSourcePath.getComponent().setText("/usr/src/linux-headers-" + System.getProperty("os.version"));
}
项目:camel-idea-plugin    文件:CamelEditorSettingsPageTest.java   
public void testCustomIconButtonShouldBeEnabledWhenSelectedItemIsCustomIconOnly() {
    TextFieldWithBrowseButton button = editorSettingsPage.getCustomIconButton();
    JComboBox<String> comboBox = editorSettingsPage.getCamelIconsComboBox();

    assertNotNull(comboBox.getSelectedItem());
    assertEquals("Camel Icon", comboBox.getSelectedItem().toString());
    assertEquals(false, button.isEnabled());

    comboBox.setSelectedIndex(1);
    assertNotNull(comboBox.getSelectedItem());
    assertEquals("Camel Badge Icon", comboBox.getSelectedItem().toString());
    assertEquals(false, button.isEnabled());

    comboBox.setSelectedIndex(2);
    assertNotNull(comboBox.getSelectedItem());
    assertEquals("Custom Icon", comboBox.getSelectedItem().toString());
    assertEquals(true, button.isEnabled());

    comboBox.setSelectedIndex(1);
    assertNotNull(comboBox.getSelectedItem());
    assertEquals("Camel Badge Icon", comboBox.getSelectedItem().toString());
    assertEquals(false, button.isEnabled());
}
项目:intellij-ce-playground    文件:ImportImlMode.java   
public JComponent getAdditionalSettings(final WizardContext wizardContext) {
  JTextField tfModuleFilePath = new JTextField();
  final String productName = ApplicationNamesInfo.getInstance().getProductName();
  final String message = IdeBundle.message("prompt.select.module.file.to.import", productName);
  final BrowseFilesListener listener = new BrowseFilesListener(tfModuleFilePath, message, null, new ModuleFileChooserDescriptor()) {
    @Override
    protected VirtualFile getFileToSelect() {
      final VirtualFile fileToSelect = super.getFileToSelect();
      if (fileToSelect != null) {
        return fileToSelect;
      }
      final Project project = wizardContext.getProject();
      return project != null ? project.getBaseDir() : null;
    }
  };
  myModulePathFieldPanel = new TextFieldWithBrowseButton(tfModuleFilePath, listener);
  onChosen(false);
  return myModulePathFieldPanel;
}
项目:intellij-ce-playground    文件:DirDiffPanel.java   
private void createUIComponents() {
  mySourceDirField = new TextFieldWithBrowseButton(null, this);
  myTargetDirField = new TextFieldWithBrowseButton(null, this);

  final AtomicBoolean callUpdate = new AtomicBoolean(true);
  myRootPanel = new JPanel(new BorderLayout()) {
    @Override
    protected void paintChildren(Graphics g) {
      super.paintChildren(g);
      if (callUpdate.get()) {
        callUpdate.set(false);
        myModel.reloadModel(false);
      }
    }
  };
}
项目:intellij-ce-playground    文件:ComboBoxFieldPanel.java   
public void createComponent() {
  super.createComponent();
  TextFieldWithBrowseButton.MyDoClickAction doClickAction = getDoClickAction();
  if (doClickAction != null) {
    doClickAction.registerShortcut(myComboBox);
  }

  myComboBox.setMaximumRowCount(8);

  myComboBox.setEditable(true);
  final JTextField editorComponent = (JTextField)myComboBox.getEditor().getEditorComponent();
  editorComponent.getDocument().addDocumentListener(new DocumentAdapter() {
    protected void textChanged(DocumentEvent e) {
      final String text = getText();
      if (!Comparing.equal(text, oldText, true)) {
        oldText = text;
        final Runnable changeListener = getChangeListener();
        if (changeListener != null) {
          changeListener.run();
        }
      }
    }
  });
}
项目:intellij-ce-playground    文件:RawCommandLineEditor.java   
public RawCommandLineEditor(final Function<String, List<String>> lineParser, final Function<List<String>, String> lineJoiner) {
  super(new BorderLayout());
  myTextField = new TextFieldWithBrowseButton(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (myDialogCaption == null) {
        Container parent = getParent();
        if (parent instanceof LabeledComponent) {
          parent = parent.getParent();
        }
        LOG.error("Did not call RawCommandLineEditor.setDialogCaption() in " + parent);
        myDialogCaption = "Parameters";
      }
      Messages.showTextAreaDialog(myTextField.getTextField(), myDialogCaption, "EditParametersPopupWindow", lineParser, lineJoiner);
    }
  });
  myTextField.setButtonIcon(AllIcons.Actions.ShowViewer);
  add(myTextField, BorderLayout.CENTER);
  setDescriptor(null);
}
项目:intellij-ce-playground    文件:CustomizableActionsPanel.java   
private static TextFieldWithBrowseButton createBrowseField(){
  TextFieldWithBrowseButton textField = new TextFieldWithBrowseButton();
  textField.setPreferredSize(new Dimension(200, textField.getPreferredSize().height));
  textField.setMinimumSize(new Dimension(200, textField.getPreferredSize().height));
  final FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
    @Override
    public boolean isFileSelectable(VirtualFile file) {
      //noinspection HardCodedStringLiteral
      return file.getName().endsWith(".png");
    }
  };
  textField.addBrowseFolderListener(IdeBundle.message("title.browse.icon"), IdeBundle.message("prompt.browse.icon.for.selected.action"), null,
                                    fileChooserDescriptor);
  InsertPathAction.addTo(textField.getTextField(), fileChooserDescriptor);
  return textField;
}
项目:intellij-ce-playground    文件:CreatePatchConfigurationPanel.java   
private void initMainPanel() {
  myFileNameField = new TextFieldWithBrowseButton();
  myReversePatchCheckbox = new JCheckBox(VcsBundle.message("create.patch.reverse.checkbox"));
  myEncoding = new ComboBox();
  myIncludeBaseRevisionTextCheckBox = new JCheckBox(VcsBundle.message("create.patch.base.revision", 0));
  myIncludeBaseRevisionTextCheckBox.setToolTipText(VcsBundle.message("create.patch.base.revision.tooltip"));
  myErrorLabel = new JLabel();

  myMainPanel = FormBuilder.createFormBuilder()
    .addLabeledComponent(VcsBundle.message("create.patch.file.path"), myFileNameField)
    .addComponent(myReversePatchCheckbox)
    .addComponent(myIncludeBaseRevisionTextCheckBox)
    .addLabeledComponent(VcsBundle.message("create.patch.encoding"), myEncoding)
    .addComponent(myErrorLabel)
    .getPanel();
}
项目:intellij-ce-playground    文件:LogConfigurationPanel.java   
public LogFileCellEditor(LogFileOptions options) {
  myLogFileOptions = options;
  myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this);
  getChildComponent().setEditable(false);
  getChildComponent().setBorder(null);
  myComponent.getComponentWithButton().getButton().addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(@NotNull ActionEvent e) {
      showEditorDialog(myLogFileOptions);
      JTextField textField = getChildComponent();
      textField.setText(myLogFileOptions.getName());
      textField.requestFocus();
      myModel.fireTableDataChanged();
    }
  });
}
项目:intellij-ce-playground    文件:StartBrowserPanel.java   
public static void setupUrlField(@NotNull TextFieldWithBrowseButton field, @NotNull final Project project) {
  FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) {
    @Override
    public boolean isFileSelectable(VirtualFile file) {
      return HtmlUtil.isHtmlFile(file) || virtualFileToUrl(file, project) != null;
    }
  };
  descriptor.setTitle(XmlBundle.message("javascript.debugger.settings.choose.file.title"));
  descriptor.setDescription(XmlBundle.message("javascript.debugger.settings.choose.file.subtitle"));
  descriptor.setRoots(ProjectRootManager.getInstance(project).getContentRoots());

  field.addBrowseFolderListener(new TextBrowseFolderListener(descriptor, project) {
    @NotNull
    @Override
    protected String chosenFileToResultingText(@NotNull VirtualFile chosenFile) {
      if (chosenFile.isDirectory()) {
        return chosenFile.getPath();
      }

      Url url = virtualFileToUrl(chosenFile, project);
      return url == null ? chosenFile.getUrl() : url.toDecodedForm();
    }
  });
}
项目:intellij-ce-playground    文件:ChooseGradleHomeDialogFixture.java   
@NotNull
public static ChooseGradleHomeDialogFixture find(@NotNull final Robot robot) {
  DialogFixture found = findDialog(new GenericTypeMatcher<Dialog>(Dialog.class) {
    @Override
    protected boolean isMatching(@NotNull Dialog dialog) {
      if (!dialog.isVisible() || !dialog.isShowing()) {
        return false;
      }
      ComponentFinder finder = robot.finder();
      finder.find(dialog, new ComponentMatcher() {
        @Override
        public boolean matches(Component c) {
          if (c instanceof JBLabel) {
            return "Gradle home:".equals(((JBLabel)c).getText());
          }
          return false;
        }
      });
      finder.findByType(dialog, TextFieldWithBrowseButton.class);
      return true;
    }
  }).withTimeout(LONG_TIMEOUT.duration()).using(robot);
  return new ChooseGradleHomeDialogFixture(robot, found.target());
}
项目:intellij-ce-playground    文件:GitVcsPanel.java   
private void createUIComponents() {
  myProtectedBranchesButton = new TextFieldWithBrowseButton.NoPathCompletion(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      Messages.showTextAreaDialog(myProtectedBranchesButton.getTextField(), "Protected Branches", "Git.Force.Push.Protected.Branches",
                                  ParametersListUtil.COLON_LINE_PARSER, ParametersListUtil.COLON_LINE_JOINER);
    }
  });
  myProtectedBranchesButton.setButtonIcon(AllIcons.Actions.ShowViewer);
  myUpdateMethodComboBox = new ComboBox(new EnumComboBoxModel<UpdateMethod>(UpdateMethod.class));
  myUpdateMethodComboBox.setRenderer(new ListCellRendererWrapper<UpdateMethod>() {
    @Override
    public void customize(JList list, UpdateMethod value, int index, boolean selected, boolean hasFocus) {
      setText(StringUtil.capitalize(StringUtil.toLowerCase(value.name().replace('_', ' '))));
    }
  });
}
项目:intellij-ce-playground    文件:ConfigureProxiesOptionsPanel.java   
public void setStringProperties(final Map<String, String> properties) {
  for (Map.Entry<String, String> entry : properties.entrySet()) {
    final JComponent component = myKey2Component.get(entry.getKey());
    if (component != null) {
      JTextComponent textComponent = null;
      if (component instanceof JTextComponent) {
        textComponent = (JTextComponent) component;
      } else if (component instanceof TextFieldWithBrowseButton) {
        textComponent = ((TextFieldWithBrowseButton) component).getTextField();
      }
      if (textComponent != null) {
        textComponent.setText(entry.getValue());
        textComponent.selectAll();
      }
      component.setToolTipText(entry.getKey());
    }
  }

  myTrustDefaultCAsCheckBox.setSelected(booleanPropertySelected(properties.get(myComponent2Key.get(myTrustDefaultCAsCheckBox))));
  repositoryUrlsRecalculation();
}
项目:intellij-ce-playground    文件:ConfigureProxiesOptionsPanel.java   
public void copyStringProperties(Map<String, String> map) {
  for (Map.Entry<String, JComponent> entry : myKey2Component.entrySet()) {
    final JComponent component = entry.getValue();
    String value = null;
    if (component instanceof JTextComponent) {
      value = ((JTextComponent) component).getText();
    } else if (component instanceof TextFieldWithBrowseButton) {
      value = ((TextFieldWithBrowseButton) component).getTextField().getText();
    } else if (component instanceof JCheckBox) {
      value = ((JCheckBox) component).isSelected() ? "yes" : "no";
    }

    if ((value != null) && ((! "".equals(value)) || (map.containsKey(entry.getKey())))) {
      map.put(entry.getKey(), value);
    }
  }
}
项目:intellij-ce-playground    文件:SdkHomeConfigurable.java   
@Override
public JComponent createComponent() {
  myPanel = new JPanel(new BorderLayout(10, 5));
  final JPanel contentPanel = new JPanel(new BorderLayout(4, 0));
  myPanel.add(contentPanel, BorderLayout.NORTH);
  contentPanel.add(new JLabel(myFrameworkName + " home:"), BorderLayout.WEST);
  myPathField = new TextFieldWithBrowseButton();
  contentPanel.add(myPathField);
  myPathField
    .addBrowseFolderListener("Select " + myFrameworkName + " home", "", myProject, new FileChooserDescriptor(false, true, false, false, false, false) {
      @Override
      public boolean isFileSelectable(VirtualFile file) {
        return isSdkHome(file);
      }
    });
  return myPanel;
}
项目:processing-idea    文件:CustomVersionSelectorListener.java   
CustomVersionSelectorListener(JComboBox versionSelectComboBox,
                                     TextFieldWithBrowseButton localPdeLibraryBrowser,
                                     JLabel pdeDependencySelectErrorLabel,
                                     JLabel versionResolutionErrorLabel,
                                     JLabel versionAnalysisProgressIcon) {
    this.versionSelectComboBox = versionSelectComboBox;
    this.localPdeLibraryBrowser = localPdeLibraryBrowser;
    this.pdeDependencySelectErrorLabel = pdeDependencySelectErrorLabel;
    this.versionResolutionErrorLabel = versionResolutionErrorLabel;
    this.versionAnalysisProgressIcon = versionAnalysisProgressIcon;
}
项目:mule-intellij-plugins    文件:SdkVersionSelectionDialog.java   
public SdkVersionSelectionDialog(JComponent parent, String title, String name, List<String> scalaVersions)
{
    super(parent, false);
    setTitle(title);
    //Create and populate the panel.
    centerPanel = new JPanel(new SpringLayout());

    versionLabel = new JLabel(name, JLabel.TRAILING);
    versionComboBox = new ComboBox(new DefaultComboBoxModel<>(scalaVersions.toArray()));
    versionLabel.setLabelFor(versionComboBox);

    centerPanel.add(versionLabel);
    centerPanel.add(versionComboBox);

    destination = new TextFieldWithBrowseButton();
    destination.addBrowseFolderListener("Select new Mule distribution destination", null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
    destinationLabel = new JLabel("Destination:", JLabel.TRAILING);
    destinationLabel.setLabelFor(destination);

    //By default, should be ~/mule-distro
    File distro = new File(SystemProperties.getUserHome(), "mule-distro");
    destination.setText(distro.getAbsolutePath());

    centerPanel.add(destinationLabel);
    centerPanel.add(destination);

    //Lay out the panel.
    SpringUtilities.makeCompactGrid(centerPanel,
            2, 2, //rows, cols
            6, 6,        //initX, initY
            6, 6);       //xPad, yPad

    init();
}
项目:nix-idea    文件:NixIDEASettings.java   
@Override
public String getText() {
    String txt = "";
    if (c instanceof JTextField) {
        txt = ((JTextField) c).getText();
    } else if (c instanceof TextFieldWithBrowseButton ) {
        txt = ((TextFieldWithBrowseButton) c).getText();
    }
    return txt;
}
项目:nix-idea    文件:NixIDEASettings.java   
@Override
public void setText(String txt) {
    if (c instanceof JTextField) {
        ((JTextField) c).setText(txt);
    } else if (c instanceof TextFieldWithBrowseButton ) {
        ((TextFieldWithBrowseButton) c).setText(txt);
    }
}
项目:sutr-io    文件:SutrConfigPanel.java   
private void EnableCustomPaths(boolean isEnabled) {

        for (TextFieldWithBrowseButton c : new TextFieldWithBrowseButton[] {
                handlerOutputLocationBrowseButton,
                intentOutputLocationBrowseButton,
                utterancesOutputLocationBrowseButton,
                customTypesOutputLocationBrowseButton
        }) {

            c.setEditable(isEnabled);
            c.setEnabled(isEnabled);
            c.setButtonEnabled(isEnabled);
        }

        handlerOutputFileLabel.setEnabled(isEnabled);
        intentOutputFileLabel.setEnabled(isEnabled);
        utterancesOutputFileLabel.setEnabled(isEnabled);
        customTypesOutputFileLabel.setEnabled(isEnabled);

        configProvider.useCustomPaths(isEnabled);

        handlerOutputLocationBrowseButton.setText(configProvider.getHandlerOutputLocation());
        intentOutputLocationBrowseButton.setText(configProvider.getIntentOutputLocation());
        utterancesOutputLocationBrowseButton.setText(configProvider.getUtterancesOutputLocation());
        customTypesOutputLocationBrowseButton.setText(configProvider.getCustomTypesOutputLocation());

    }
项目:intellij-nette-tester    文件:PhpCommandLineSettingsEditor.java   
private void createUIComponents() {
    interpreterOptions = new RawCommandLineEditor();
    interpreterOptions.setDialogCaption("Options");

    customWorkingDirectory = new TextFieldWithBrowseButton();
    customWorkingDirectory.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFolderDescriptor());

    environmentVariables = new EnvironmentVariablesComponent();

    interpreterOptionsLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.cli.interpreterOptions"));
    workingDirectoryLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.cli.workingDirectory"));
}
项目:arma-intellij-plugin    文件:ArmaAddonsSettingsForm.java   
private void createUIComponents() {
    bundle = ResourceBundle.getBundle("com.kaylerrenslow.armaplugin.ProjectSettingsBundle");

    tfWithBrowseReferenceDirectory = new TextFieldWithBrowseButton(new JTextField(40));

    treeAddonsRoots_rootNode = new RootTreeNode();
    treeAddonsRoots = new Tree(treeAddonsRoots_rootNode);
    treeAddonsRoots.setCellRenderer(new MyColoredTreeCellRenderer());
    treeAddonsRoots.setHoldSize(true);
    treeAddonsRoots.addTreeSelectionListener(e -> {
        System.out.println("ArmaAddonsSettingsForm.createUIComponents e=" + e);
    });
}
项目:camel-idea-plugin    文件:CamelEditorSettingsPageTest.java   
public void testCustomIconButtonShouldBeEnabledWhenSelectingCustomCamelIcon() {
    TextFieldWithBrowseButton button = editorSettingsPage.getCustomIconButton();
    JComboBox<String> comboBox = editorSettingsPage.getCamelIconsComboBox();
    assertNotNull(comboBox.getSelectedItem());
    assertEquals("Camel Icon", comboBox.getSelectedItem());
    assertEquals(false, button.isEnabled());
    comboBox.setSelectedIndex(2);
    assertEquals(2, comboBox.getSelectedIndex());
    assertNotNull(comboBox.getSelectedItem());
    assertEquals("Custom Icon", comboBox.getSelectedItem().toString());
    assertEquals(true, button.isEnabled());
}
项目:camel-idea-plugin    文件:CamelEditorSettingsPageTest.java   
public void testResetCustomIconButton() {
    TextFieldWithBrowseButton button = editorSettingsPage.getCustomIconButton();
    JComboBox<String> comboBox = editorSettingsPage.getCamelIconsComboBox();

    comboBox.setSelectedIndex(1);
    assertEquals(false, button.isEnabled());
    editorSettingsPage.reset();
    assertNotNull(comboBox.getSelectedItem());
    assertEquals("Camel Icon", comboBox.getSelectedItem().toString());
}
项目:intellij-ce-playground    文件:ClassFilterEditorAddDialog.java   
protected JComponent createCenterPanel() {
  final JPanel panel = new JPanel(new GridBagLayout());
  final JLabel header = new JLabel(UIBundle.message("label.class.filter.editor.add.dialog.filter.pattern"));
  myClassName = new TextFieldWithBrowseButton(new JTextField(35));
  final JLabel iconLabel = new JLabel(Messages.getQuestionIcon());

  panel.add(header, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 0), 0, 0));
  panel.add(myClassName, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 0), 0, 0));
  panel.add(iconLabel, new GridBagConstraints(0, 0, 1, 2, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(15, 0, 0, 0), 0, 0));

  myClassName.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      PsiClass currentClass = getSelectedClass();
      TreeClassChooser chooser = TreeClassChooserFactory.getInstance(myProject).createNoInnerClassesScopeChooser(
        UIBundle.message("class.filter.editor.choose.class.title"), GlobalSearchScope.allScope(myProject), null, null);
      if (currentClass != null) {
        PsiFile containingFile = currentClass.getContainingFile();
        if (containingFile != null) {
          PsiDirectory containingDirectory = containingFile.getContainingDirectory();
          if (containingDirectory != null) {
            chooser.selectDirectory(containingDirectory);
          }
        }
      }
      chooser.showDialog();
      PsiClass selectedClass = chooser.getSelected();
      if (selectedClass != null) {
        myClassName.setText(selectedClass.getQualifiedName());
      }
    }
  });

  myClassName.setEnabled(myProject != null);

  return panel;
}
项目:intellij-ce-playground    文件:JarApplicationConfigurable.java   
private void createUIComponents() {
  myJarPathComponent = new LabeledComponent<TextFieldWithBrowseButton>();
  TextFieldWithBrowseButton textFieldWithBrowseButton = new TextFieldWithBrowseButton();
  textFieldWithBrowseButton.addBrowseFolderListener("Choose JAR File", null, myProject,
                                                    new FileChooserDescriptor(false, false, true, true, false, false));
  myJarPathComponent.setComponent(textFieldWithBrowseButton);
}
项目:intellij-ce-playground    文件:SdkEditor.java   
protected TextFieldWithBrowseButton createHomeComponent() {
  return new TextFieldWithBrowseButton(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      doSelectHomePath();
    }
  });
}
项目:intellij-ce-playground    文件:CreateModuleFromSourcesMode.java   
@Override
public JComponent getAdditionalSettings(WizardContext wizardContext) {
  myPathPanel = new TextFieldWithBrowseButton();
  final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  myPathPanel.addBrowseFolderListener("Select Directory Containing Module Files", null, wizardContext.getProject(), descriptor);
  onChosen(false);
  return myPathPanel;
}
项目:intellij-ce-playground    文件:ManifestFileUtil.java   
public static void setupMainClassField(final Project project, final TextFieldWithBrowseButton field) {
  field.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      final PsiClass selected = selectMainClass(project, field.getText());
      if (selected != null) {
        field.setText(selected.getQualifiedName());
      }
    }
  });
}
项目:intellij-ce-playground    文件:GuiUtils.java   
private static JPanel constructFieldWithBrowseButton(final JComponent aComponent, final ActionListener aActionListener, int delta) {
  JPanel result = new JPanel(new GridBagLayout());
  result.add(aComponent, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0,0));
  FixedSizeButton browseButton = new FixedSizeButton(aComponent.getPreferredSize().height - delta);//ignore border in case of browse button
  TextFieldWithBrowseButton.MyDoClickAction.addTo(browseButton, aComponent);
  result.add(browseButton, new GridBagConstraints(1, 0, 1, 1, 0, 1, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0));
  browseButton.addActionListener(aActionListener);

  return result;
}
项目:intellij-ce-playground    文件:AbstractFieldPanel.java   
public void createComponent() {
  removeAll();
  setLayout(new GridBagLayout());

  if (myLabelText != null) {
    myLabel = new JLabel(myLabelText);
    this.add(myLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0));
    myLabel.setLabelFor(myComponent);
  }

  this.add(myComponent, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

  if (myBrowseButtonActionListener != null) {
    FixedSizeButton browseButton = new FixedSizeButton(getComponent());
    myDoClickAction = new TextFieldWithBrowseButton.MyDoClickAction(browseButton);
    browseButton.setFocusable(false);
    browseButton.addActionListener(myBrowseButtonActionListener);
    myButtons.add(browseButton);
    this.add(browseButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0));
  }
  if (myViewerDialogTitle != null) {
    final FixedSizeButton showViewerButton = new FixedSizeButton(getComponent());
    if (myBrowseButtonActionListener == null) {
      LOG.assertTrue(myDoClickAction == null);
      myDoClickAction = new TextFieldWithBrowseButton.MyDoClickAction(showViewerButton);
    }
    showViewerButton.setFocusable(false);
    showViewerButton.setIcon(PlatformIcons.OPEN_EDIT_DIALOG_ICON);
    showViewerButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Viewer viewer = new Viewer();
        viewer.setTitle(myViewerDialogTitle);
        viewer.show();
      }
    });
    myButtons.add(showViewerButton);
    this.add(showViewerButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  }
}
项目:intellij-ce-playground    文件:FieldPanel.java   
public void createComponent() {
  super.createComponent();
  TextFieldWithBrowseButton.MyDoClickAction doClickAction = getDoClickAction();
  if (doClickAction != null) {
    doClickAction.registerShortcut(getTextField());
  }

  myTextField.getDocument().addDocumentListener(new DocumentAdapter() {
    public void textChanged(DocumentEvent event) {
      if (getChangeListener() != null) {
        getChangeListener().run();
      }
    }
  });
}
项目:intellij-ce-playground    文件:LocationNameFieldsBinding.java   
public NameFieldDocument(final JTextField projectNameTextField, final TextFieldWithBrowseButton locationField) {
  addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(final DocumentEvent e) {
      if (!myModifyingLocation && !myExternalModify) {
        myModifyingProjectName = true;
        File f = new File(myBaseDir);
        locationField.setText(new File(f, projectNameTextField.getText()).getPath());
      }
    }
  });
}