本文整理匯總了Java中com.intellij.openapi.fileChooser.FileChooserDescriptorFactory.createSingleLocalFileDescriptor方法的典型用法代碼示例。如果您正苦於以下問題:Java FileChooserDescriptorFactory.createSingleLocalFileDescriptor方法的具體用法?Java FileChooserDescriptorFactory.createSingleLocalFileDescriptor怎麽用?Java FileChooserDescriptorFactory.createSingleLocalFileDescriptor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
的用法示例。
在下文中一共展示了FileChooserDescriptorFactory.createSingleLocalFileDescriptor方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: selectFileAndCreateWizard
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入方法依賴的package包/類
@Nullable
public static AddModuleWizard selectFileAndCreateWizard(@Nullable Project project, @Nullable Component dialogParent) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
descriptor.setHideIgnored(false);
descriptor.setTitle("Select File or Directory to Import");
List<ProjectImportProvider> providers = getProviders(project);
String description = getFileChooserDescription(providers);
descriptor.setDescription(description);
return selectFileAndCreateWizard(project, dialogParent, descriptor, toObjectArray(providers, ProjectImportProvider.class));
}
示例2: chooseSettingsFile
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入方法依賴的package包/類
@NotNull
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 = new AsyncResult<String>();
FileChooser.chooseFiles(chooserDescriptor, null, parent, initialDir, new FileChooser.FileChooserConsumer() {
@Override
public void consume(List<VirtualFile> files) {
VirtualFile file = files.get(0);
if (file.isDirectory()) {
result.setDone(file.getPath() + '/' + new File(DEFAULT_PATH).getName());
}
else {
result.setDone(file.getPath());
}
}
@Override
public void cancelled() {
result.setRejected();
}
});
return result;
}
示例3: InsertPathAction
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入方法依賴的package包/類
private InsertPathAction(JTextComponent textField) {
this(textField, FileChooserDescriptorFactory.createSingleLocalFileDescriptor());
}
示例4: setUpDialog
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入方法依賴的package包/類
private void setUpDialog() {
JComponent commandLineComponent;
if (myHistory == null) {
commandLineEditor = new EditorTextField("", myProject, PlainTextFileType.INSTANCE);
commandLineComponent = commandLineEditor;
commandLineLabel.setLabelFor(commandLineEditor);
}
else {
commandLineComboBox = new ComboBox(ArrayUtilRt.toStringArray(myHistory));
commandLineComponent = commandLineComboBox;
commandLineLabel.setLabelFor(commandLineComboBox);
commandLineComboBox.setLightWeightPopupEnabled(false);
EditorComboBoxEditor editor = new StringComboboxEditor(myProject, PlainTextFileType.INSTANCE, commandLineComboBox);
//noinspection GtkPreferredJComboBoxRenderer
commandLineComboBox.setRenderer(new EditorComboBoxRenderer(editor));
commandLineComboBox.setEditable(true);
commandLineComboBox.setEditor(editor);
commandLineComboBox.setFocusable(true);
commandLineEditor = editor.getEditorComponent();
}
commandLinePanel.add(commandLineComponent);
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
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", GradleConstants.SYSTEM_ID.getReadableName());
myProjectPathField = new ExternalProjectPathField(myProject, GradleConstants.SYSTEM_ID, projectPathChooserDescriptor, title) {
@Override
public Dimension getPreferredSize() {
return commandLinePanel == null ? super.getPreferredSize() : commandLinePanel.getPreferredSize();
}
};
projectPathFieldPanel.add(myProjectPathField);
new GradleArgumentsCompletionProvider(myProject, myProjectPathField).apply(commandLineEditor);
}