本文整理汇总了Java中com.intellij.openapi.fileChooser.FileChooserDialog类的典型用法代码示例。如果您正苦于以下问题:Java FileChooserDialog类的具体用法?Java FileChooserDialog怎么用?Java FileChooserDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FileChooserDialog类属于com.intellij.openapi.fileChooser包,在下文中一共展示了FileChooserDialog类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectFileAndCreateWizard
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
@Nullable
public static AddModuleWizard selectFileAndCreateWizard(@Nullable Project project,
@Nullable Component dialogParent,
@NotNull FileChooserDescriptor descriptor,
ProjectImportProvider[] providers) {
FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project, dialogParent);
VirtualFile toSelect = null;
String lastLocation = PropertiesComponent.getInstance().getValue(LAST_IMPORTED_LOCATION);
if (lastLocation != null) {
toSelect = LocalFileSystem.getInstance().refreshAndFindFileByPath(lastLocation);
}
VirtualFile[] files = chooser.choose(project, toSelect);
if (files.length == 0) {
return null;
}
final VirtualFile file = files[0];
PropertiesComponent.getInstance().setValue(LAST_IMPORTED_LOCATION, file.getPath());
return createImportWizard(project, dialogParent, file, providers);
}
示例2: selectFileAndCreateWizard
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
@Nullable
private AddModuleWizard selectFileAndCreateWizard(@NotNull FileChooserDescriptor descriptor)
throws IOException, ConfigurationException {
FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, null, null);
VirtualFile toSelect = null;
String lastLocation = PropertiesComponent.getInstance().getValue(LAST_IMPORTED_LOCATION);
if (lastLocation != null) {
toSelect = LocalFileSystem.getInstance().refreshAndFindFileByPath(lastLocation);
}
VirtualFile[] files = chooser.choose(null, toSelect);
if (files.length == 0) {
return null;
}
VirtualFile file = files[0];
PropertiesComponent.getInstance().setValue(LAST_IMPORTED_LOCATION, file.getPath());
return createImportWizard(file);
}
示例3: chooseDirectory
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
private void chooseDirectory() {
FileChooserDescriptor descriptor =
FileChooserDescriptorFactory.createSingleFolderDescriptor()
.withTitle("Export Directory Location")
.withDescription("Choose directory to export run configurations to")
.withHideIgnored(false);
FileChooserDialog chooser =
FileChooserFactory.getInstance().createFileChooser(descriptor, null, null);
final VirtualFile[] files;
File existingLocation = new File(getOutputDirectoryPath());
if (existingLocation.exists()) {
VirtualFile toSelect =
LocalFileSystem.getInstance().refreshAndFindFileByPath(existingLocation.getPath());
files = chooser.choose(null, toSelect);
} else {
files = chooser.choose(null);
}
if (files.length == 0) {
return;
}
VirtualFile file = files[0];
outputDirectoryPanel.setText(file.getPath());
}
示例4: selectFileAndCreateWizard
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
@Nullable
public static AddModuleWizard selectFileAndCreateWizard(final Project project,
@Nullable Component dialogParent,
@NotNull FileChooserDescriptor descriptor,
ProjectImportProvider[] providers)
{
FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project, dialogParent);
VirtualFile toSelect = null;
String lastLocation = PropertiesComponent.getInstance().getValue(LAST_IMPORTED_LOCATION);
if (lastLocation != null) {
toSelect = LocalFileSystem.getInstance().refreshAndFindFileByPath(lastLocation);
}
VirtualFile[] files = chooser.choose(toSelect, project);
if (files.length == 0) {
return null;
}
final VirtualFile file = files[0];
PropertiesComponent.getInstance().setValue(LAST_IMPORTED_LOCATION, file.getPath());
return createImportWizard(project, dialogParent, file, providers);
}
示例5: selectFileAndCreateWizard
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
@Nullable
public static AddModuleWizard selectFileAndCreateWizard(final Project project,
@Nullable Component dialogParent,
@Nonnull FileChooserDescriptor descriptor,
@Nonnull List<ModuleImportProvider> providers) {
FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project, dialogParent);
VirtualFile toSelect = null;
String lastLocation = PropertiesComponent.getInstance().getValue(LAST_IMPORTED_LOCATION);
if (lastLocation != null) {
toSelect = LocalFileSystem.getInstance().refreshAndFindFileByPath(lastLocation);
}
VirtualFile[] files = chooser.choose(project, toSelect == null ? VirtualFile.EMPTY_ARRAY : new VirtualFile[]{toSelect});
if (files.length == 0) {
return null;
}
final VirtualFile file = files[0];
PropertiesComponent.getInstance().setValue(LAST_IMPORTED_LOCATION, file.getPath());
return createImportWizard(project, dialogParent, file, providers);
}
示例6: chooseWorkspacePath
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
private void chooseWorkspacePath() {
FileChooserDescriptor descriptor =
new FileChooserDescriptor(true, false, false, false, false, false)
.withShowHiddenFiles(true) // Show root project view file
.withHideIgnored(false)
.withTitle("Select Project View File")
.withDescription("Select a project view file to import.")
.withFileFilter(
virtualFile ->
ProjectViewStorageManager.isProjectViewFile(new File(virtualFile.getPath())));
FileChooserDialog chooser =
FileChooserFactory.getInstance().createFileChooser(descriptor, null, null);
File startingLocation = null;
String projectViewPath = getProjectViewPath();
if (!projectViewPath.isEmpty()) {
File fileLocation = new File(projectViewPath);
if (fileLocation.exists()) {
startingLocation = fileLocation;
}
}
final VirtualFile[] files;
if (startingLocation != null) {
VirtualFile toSelect =
LocalFileSystem.getInstance().refreshAndFindFileByPath(startingLocation.getPath());
files = chooser.choose(null, toSelect);
} else {
files = chooser.choose(null);
}
if (files.length == 0) {
return;
}
VirtualFile file = files[0];
projectViewPathField.setText(file.getPath());
}
示例7: openFileChooserDialog
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
@Nullable
private PsiFile openFileChooserDialog(Project project) {
FileChooserDialog fileChooserDialog = FileChooserFactory.getInstance().createFileChooser(FileChooserDescriptorFactory.createSingleFileDescriptor(), project, null);
VirtualFile[] virtualFiles = fileChooserDialog.choose(project, selectedFile.getVirtualFile());
if (virtualFiles.length > 0) {
PsiFile xliffFile = PsiManager.getInstance(project).findFile(virtualFiles[0]);
if (xliffFile.isWritable() && xliffFile.isValid()) {
return xliffFile;
}
}
return null;
}
示例8: LibraryAttachDialog
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
public LibraryAttachDialog(@Nullable Project project) {
super(project, true);
this.project = project;
PropertiesComponent storage = PropertiesComponent.getInstance(project);
boolean registryPathSet = storage.isValueSet(PROPERTY_REGISTRY_PATH);
if (registryPathSet) {
String value = storage.getValue(PROPERTY_REGISTRY_PATH);
myDirectoryField.getTextField().setText(value);
registryFile = value;
}
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
descriptor.putUserData(FileChooserDialog.PREFER_LAST_OVER_TO_SELECT, Boolean.TRUE);
myDirectoryField.addBrowseFolderListener("Choose registry", "Choose registry file for library", null, descriptor);
myDirectoryField.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent actionEvent) {
if (!myDirectoryField.getTextField().getText().isEmpty()) {
registryFile = myDirectoryField.getTextField().getText();
registryEntries.clear();
registryEntries.add(DeftRegistryInfo.parseRegistryEntry(registryFile));
matchedRegistryEntries.setListData(registryEntries.toArray(new DeftRegistryEntryInfo[registryEntries.size()]));
}
setOKActionEnabled(!registryEntries.isEmpty());
}
});
setOKActionEnabled(false);
init();
}
示例9: createFileChooser
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
@Nonnull
@Override
public FileChooserDialog createFileChooser(@Nonnull FileChooserDescriptor descriptor, @javax.annotation.Nullable Project project, @javax.annotation.Nullable Component parent) {
if (useNativeMacChooser(descriptor)) {
return new MacPathChooserDialog(descriptor, parent, project);
}
if (parent != null) {
return new FileChooserDialogImpl(descriptor, parent, project);
}
else {
return new FileChooserDialogImpl(descriptor, project);
}
}
示例10: chooseWorkspacePath
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
private void chooseWorkspacePath() {
FileChooserDescriptor descriptor =
new FileChooserDescriptor(true, false, false, false, false, false)
.withShowHiddenFiles(true) // Show root project view file
.withHideIgnored(false)
.withTitle("Select Project View File")
.withDescription("Select a project view file to import.")
.withFileFilter(
virtualFile ->
ProjectViewStorageManager.isProjectViewFile(new File(virtualFile.getPath())));
FileChooserDialog chooser =
FileChooserFactory.getInstance().createFileChooser(descriptor, null, null);
WorkspacePathResolver workspacePathResolver =
builder.getWorkspaceOption().getWorkspacePathResolver();
File fileBrowserRoot = builder.getWorkspaceOption().getFileBrowserRoot();
File startingLocation = fileBrowserRoot;
String projectViewPath = getProjectViewPath();
if (!projectViewPath.isEmpty()) {
// If the user has typed part of the path then clicked the '...', try to start from the
// partial state
projectViewPath = StringUtil.trimEnd(projectViewPath, '/');
if (WorkspacePath.isValid(projectViewPath)) {
File fileLocation = workspacePathResolver.resolveToFile(new WorkspacePath(projectViewPath));
if (fileLocation.exists() && FileUtil.isAncestor(fileBrowserRoot, fileLocation, true)) {
startingLocation = fileLocation;
}
}
}
VirtualFile toSelect =
LocalFileSystem.getInstance().refreshAndFindFileByPath(startingLocation.getPath());
VirtualFile[] files = chooser.choose(null, toSelect);
if (files.length == 0) {
return;
}
VirtualFile file = files[0];
if (!FileUtil.isAncestor(fileBrowserRoot.getPath(), file.getPath(), true)) {
Messages.showErrorDialog(
String.format(
"You must choose a project view file under %s. "
+ "To use an external project view, please use the 'Copy external' option.",
fileBrowserRoot.getPath()),
"Cannot Use Project View File");
return;
}
String newWorkspacePath = FileUtil.getRelativePath(fileBrowserRoot, new File(file.getPath()));
projectViewPathField.setText(newWorkspacePath);
}
示例11: getFromFileChooser
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
public String getFromFileChooser() {
FileChooserDialog fileChooser = FileChooserFactoryImpl.getInstance().createFileChooser(
FileChooserDescriptorFactory.createSingleLocalFileDescriptor(), null, null);
VirtualFile[] chosenFile = fileChooser.choose(null);
return chosenFile[0].getUrl();
}
示例12: PathEditor
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
public PathEditor(final FileChooserDescriptor descriptor) {
myDescriptor = descriptor;
myDescriptor.putUserData(FileChooserDialog.PREFER_LAST_OVER_TO_SELECT, Boolean.TRUE);
myModel = createListModel();
}
示例13: createFileChooser
import com.intellij.openapi.fileChooser.FileChooserDialog; //导入依赖的package包/类
@Nonnull
@Override
public FileChooserDialog createFileChooser(@Nonnull FileChooserDescriptor descriptor, @javax.annotation.Nullable Project project, @javax.annotation.Nullable Component parent) {
return null;
}