当前位置: 首页>>代码示例>>Java>>正文


Java FileChooserDialog.choose方法代码示例

本文整理汇总了Java中com.intellij.openapi.fileChooser.FileChooserDialog.choose方法的典型用法代码示例。如果您正苦于以下问题:Java FileChooserDialog.choose方法的具体用法?Java FileChooserDialog.choose怎么用?Java FileChooserDialog.choose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.fileChooser.FileChooserDialog的用法示例。


在下文中一共展示了FileChooserDialog.choose方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例9: 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


注:本文中的com.intellij.openapi.fileChooser.FileChooserDialog.choose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。