本文整理汇总了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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ImportModuleAction.java
示例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);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidImportProjectAction.java
示例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());
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:25,代码来源:ExportRunConfigurationDialog.java
示例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);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:ImportModuleAction.java
示例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);
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:ImportModuleAction.java
示例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());
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:36,代码来源:CopyExternalProjectViewOption.java
示例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;
}
开发者ID:onigunn,项目名称:intellij.xliff,代码行数:14,代码来源:AbstractXLIFFAction.java
示例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();
}
开发者ID:dylan-foundry,项目名称:DeftIDEA,代码行数:38,代码来源:LibraryAttachDialog.java
示例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);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:FileChooserFactoryImpl.java
示例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);
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:51,代码来源:ImportFromWorkspaceProjectViewOption.java
示例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();
}
开发者ID:bjorm,项目名称:PageObjectEvaluator,代码行数:7,代码来源:HtmlFileProvider.java
示例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();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:PathEditor.java
示例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;
}
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:WebFileChooserFactory.java
注:本文中的com.intellij.openapi.fileChooser.FileChooserDialog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论