Java Code Examples for com.intellij.openapi.fileChooser.FileChooserDescriptorFactory#createSingleLocalFileDescriptor()
The following examples show how to use
com.intellij.openapi.fileChooser.FileChooserDescriptorFactory#createSingleLocalFileDescriptor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BashProjectSettingsPane.java From BashSupport with Apache License 2.0 | 5 votes |
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); }
Example 2
Source File: BashConfigForm.java From BashSupport with Apache License 2.0 | 5 votes |
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); }
Example 3
Source File: ChooseComponentsToExportDialog.java From consulo with Apache License 2.0 | 5 votes |
@Nonnull @RequiredUIAccess public static AsyncResult<String> chooseSettingsFile(String oldPath, Component parent, final String title, final String description) { FileChooserDescriptor chooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor(); chooserDescriptor.setDescription(description); chooserDescriptor.setHideIgnored(false); chooserDescriptor.setTitle(title); VirtualFile initialDir; if (oldPath != null) { final File oldFile = new File(oldPath); initialDir = LocalFileSystem.getInstance().findFileByIoFile(oldFile); if (initialDir == null && oldFile.getParentFile() != null) { initialDir = LocalFileSystem.getInstance().findFileByIoFile(oldFile.getParentFile()); } } else { initialDir = null; } final AsyncResult<String> result = AsyncResult.undefined(); AsyncResult<VirtualFile[]> fileAsyncResult = FileChooser.chooseFiles(chooserDescriptor, null, parent, initialDir); fileAsyncResult.doWhenDone(files -> { VirtualFile file = files[0]; if (file.isDirectory()) { result.setDone(file.getPath() + '/' + new File(DEFAULT_PATH).getName()); } else { result.setDone(file.getPath()); } }); fileAsyncResult.doWhenRejected((Runnable)result::setRejected); return result; }
Example 4
Source File: InsertPathAction.java From consulo with Apache License 2.0 | 4 votes |
private InsertPathAction(JTextComponent textField) { this(textField, FileChooserDescriptorFactory.createSingleLocalFileDescriptor()); }
Example 5
Source File: ExternalSystemTaskSettingsControl.java From consulo with Apache License 2.0 | 4 votes |
@Override public void fillUi(@Nonnull final PaintAwarePanel canvas, int indentLevel) { myProjectPathLabel = new JBLabel(ExternalSystemBundle.message( "run.configuration.settings.label.project", myExternalSystemId.getReadableName() )); ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(myExternalSystemId); FileChooserDescriptor projectPathChooserDescriptor = null; if (manager instanceof ExternalSystemUiAware) { projectPathChooserDescriptor = ((ExternalSystemUiAware)manager).getExternalProjectConfigDescriptor(); } if (projectPathChooserDescriptor == null) { projectPathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor(); } String title = ExternalSystemBundle.message("settings.label.select.project", myExternalSystemId.getReadableName()); myProjectPathField = new ExternalProjectPathField(myProject, myExternalSystemId, projectPathChooserDescriptor, title) { @Override public Dimension getPreferredSize() { return myVmOptionsEditor == null ? super.getPreferredSize() : myVmOptionsEditor.getTextField().getPreferredSize(); } }; canvas.add(myProjectPathLabel, ExternalSystemUiUtil.getLabelConstraints(0)); canvas.add(myProjectPathField, ExternalSystemUiUtil.getFillLineConstraints(0)); myTasksLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.tasks")); myTasksTextField = new JBTextField(ExternalSystemConstants.TEXT_FIELD_WIDTH_IN_COLUMNS); canvas.add(myTasksLabel, ExternalSystemUiUtil.getLabelConstraints(0)); GridBag c = ExternalSystemUiUtil.getFillLineConstraints(0); c.insets.right = myProjectPathField.getButton().getPreferredSize().width + 8 /* street magic, sorry */; canvas.add(myTasksTextField, c); myVmOptionsLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions")); myVmOptionsEditor = new RawCommandLineEditor(); myVmOptionsEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions")); canvas.add(myVmOptionsLabel, ExternalSystemUiUtil.getLabelConstraints(0)); canvas.add(myVmOptionsEditor, ExternalSystemUiUtil.getFillLineConstraints(0)); myScriptParametersLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.script.parameters")); myScriptParametersEditor = new RawCommandLineEditor(); myScriptParametersEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.script.parameters")); canvas.add(myScriptParametersLabel, ExternalSystemUiUtil.getLabelConstraints(0)); canvas.add(myScriptParametersEditor, ExternalSystemUiUtil.getFillLineConstraints(0)); }