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


Java FileChooserDescriptorFactory.createSingleFolderDescriptor方法代码示例

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


在下文中一共展示了FileChooserDescriptorFactory.createSingleFolderDescriptor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CreateCourseArchivePanel

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public CreateCourseArchivePanel(@NotNull final Project project, CreateCourseArchiveDialog dlg, String name) {
  setLayout(new BorderLayout());
  add(myPanel, BorderLayout.CENTER);
  myErrorIcon.setIcon(AllIcons.Actions.Lightning);
  setState(false);
  myDlg = dlg;
  String sanitizedName = FileUtil.sanitizeFileName(name);
  myNameField.setText(sanitizedName.startsWith("_") ? EduNames.COURSE : sanitizedName);
  myLocationField.setText(project.getBasePath());
  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  myLocationField.addBrowseFolderListener("Choose Location Folder", null, project, descriptor);
  myLocationField.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      String location = myLocationField.getText();
      File file = new File(location);
      if (!file.exists() || !file.isDirectory()) {
        myDlg.enableOKAction(false);
        setError("Invalid location");
      }
      myDlg.enableOKAction(true);
    }
  });
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:25,代码来源:CreateCourseArchivePanel.java

示例2: createDirectory

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public static PsiDirectory createDirectory(Project project, String title, String description) {
    final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    descriptor.setTitle(title);
    descriptor.setShowFileSystemRoots(false);
    descriptor.setDescription(description);
    descriptor.setHideIgnored(true);
    descriptor.setRoots(project.getBaseDir());
    descriptor.setForcedToUseIdeaFileChooser(true);
    VirtualFile file = FileChooser.chooseFile(descriptor, project, project.getBaseDir());
    if(Objects.isNull(file)){
        Messages.showInfoMessage("Cancel " + title, "Error");
        return null;
    }

    PsiDirectory psiDirectory = PsiDirectoryFactory.getInstance(project).createDirectory(file);
    if(PsiDirectoryFactory.getInstance(project).isPackage(psiDirectory)){
        return psiDirectory;
    }else {
        Messages.showInfoMessage("请选择正确的 package 路径。", "Error");
        return createDirectory(project, title, description);
    }
}
 
开发者ID:hykes,项目名称:CodeGen,代码行数:23,代码来源:PsiUtil.java

示例3: actionPerformed

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
  Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    project = ProjectManager.getInstance().getDefaultProject();
  }
  FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  fcd.setShowFileSystemRoots(true);
  fcd.setTitle(GitBundle.getString("init.destination.directory.title"));
  fcd.setDescription(GitBundle.getString("init.destination.directory.description"));
  fcd.setHideIgnored(false);
  VirtualFile baseDir = e.getData(CommonDataKeys.VIRTUAL_FILE);
  if (baseDir == null) {
    baseDir = project.getBaseDir();
  }
  doInit(project, fcd, baseDir, baseDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GitInit.java

示例4: selectFile

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
@Nullable
private File selectFile(String title, String description) {
  FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  fcd.setShowFileSystemRoots(true);
  fcd.setTitle(title);
  fcd.setDescription(description);
  fcd.setHideIgnored(false);
  VirtualFile file = FileChooser.chooseFile(fcd, myProject, null);
  if (file == null) {
    return null;
  }
  final String path = file.getPath();
  if (path.endsWith(":")) {   // workaround for VFS oddities with drive root (IDEADEV-20870)
    return new File(path + "/");
  }
  return new File(path);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:RepositoryBrowserDialog.java

示例5: run

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public void run() {
  final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  VirtualFile selectedFile = FileChooser.chooseFile(descriptor, myProject, null);
  if (selectedFile == null) {
    return;
  }

  final List<AbstractFilePatchInProgress.PatchChange> selectedChanges = myChangesTreeList.getSelectedChanges();
  if (selectedChanges.size() >= 1) {
    for (AbstractFilePatchInProgress.PatchChange patchChange : selectedChanges) {
      final AbstractFilePatchInProgress patch = patchChange.getPatchInProgress();
      patch.setNewBase(selectedFile);
    }
    updateTree(false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ApplyPatchDifferentiatedDialog.java

示例6: TemplateLanguagePanel

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public TemplateLanguagePanel() {
  super(new BorderLayout());
  add(myMainPanel, BorderLayout.CENTER);
  myTemplatesFolderLabel.setLabelFor(myTemplatesFolder);
  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  descriptor.withTreeRootVisible(true);
  descriptor.setShowFileSystemRoots(true);
  List<String> templateConfigurations = TemplatesService.getAllTemplateLanguages();
  for (String configuration : templateConfigurations) {
    if (!configuration.equals(TemplatesService.WEB2PY)) {
      myTemplateLanguage.addItem(configuration);
    }
  }
  myTemplatesFolder.setText(DEFAULT_TEMPLATES_FOLDER);
  myTemplatesFolder.addKeyListener(new KeyAdapter() {
    @Override
    public void keyTyped(KeyEvent e) {
      final int dot = myTemplatesFolder.getCaret().getDot();
      final int index = myTemplatesFolder.getText().indexOf(File.separator);
      if (index >= dot) {
        myTemplateFolderModified = true;
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TemplateLanguagePanel.java

示例7: CreateCourseArchivePanel

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public CreateCourseArchivePanel(@NotNull final Project project, CreateCourseArchiveDialog dlg, String name) {
  setLayout(new BorderLayout());
  add(myPanel, BorderLayout.CENTER);
  myErrorIcon.setIcon(AllIcons.Actions.Lightning);
  setState(false);
  myDlg = dlg;
  String sanitizedName = FileUtil.sanitizeFileName(name);
  myNameField.setText(sanitizedName.startsWith("_") ? EduNames.COURSE : sanitizedName);
  myLocationField.setText(project.getBasePath());
  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  myLocationField.addBrowseFolderListener("Choose location folder", null, project, descriptor);
  myLocationField.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      String location = myLocationField.getText();
      File file = new File(location);
      if (!file.exists() || !file.isDirectory()) {
        myDlg.enableOKAction(false);
        setError("Invalid location");
      }
      myDlg.enableOKAction(true);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:CreateCourseArchivePanel.java

示例8: chooseFolder

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public static VirtualFile chooseFolder(@Nullable Project project, String title, String description, boolean showFileSystemRoots, boolean hideIgnored, @Nullable VirtualFile toSelect){
    final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    descriptor.setTitle(title);
    descriptor.setDescription(description);
    descriptor.setShowFileSystemRoots(showFileSystemRoots);
    descriptor.setHideIgnored(hideIgnored);
    return FileChooser.chooseFile(descriptor, project, toSelect);
}
 
开发者ID:hykes,项目名称:CodeGen,代码行数:9,代码来源:PsiUtil.java

示例9: actionPerformed

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
  // choose directory here/
  FileChooserDescriptor fcd = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  fcd.setShowFileSystemRoots(true);
  fcd.setTitle("Export Directory");
  fcd.setDescription("Select directory to export from subversion");
  fcd.setHideIgnored(false);
  VirtualFile file = FileChooser.chooseFile(fcd, getContentPane(), myProject, null);
  if (file == null) {
    return;
  }
  myPathField.setText(file.getPath().replace('/', File.separatorChar));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ExportOptionsDialog.java

示例10: setupRootAndAnnotateExternally

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
private void setupRootAndAnnotateExternally(@NotNull final OrderEntry entry,
                                            @NotNull final Project project,
                                            @NotNull final PsiModifierListOwner listOwner,
                                            @NotNull final String annotationFQName,
                                            @NotNull final PsiFile fromFile,
                                            @NotNull final String packageName,
                                            @Nullable final PsiNameValuePair[] value) {
  final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  descriptor.setTitle(ProjectBundle.message("external.annotations.root.chooser.title", entry.getPresentableName()));
  descriptor.setDescription(ProjectBundle.message("external.annotations.root.chooser.description"));
  final VirtualFile newRoot = FileChooser.chooseFile(descriptor, project, null);
  if (newRoot == null) {
    notifyAfterAnnotationChanging(listOwner, annotationFQName, false);
    return;
  }
  new WriteCommandAction(project) {
    @Override
    protected void run(@NotNull final Result result) throws Throwable {
      appendChosenAnnotationsRoot(entry, newRoot);
      XmlFile xmlFileInRoot = findXmlFileInRoot(findExternalAnnotationsXmlFiles(listOwner), newRoot);
      if (xmlFileInRoot != null) { //file already exists under appeared content root
        if (!FileModificationService.getInstance().preparePsiElementForWrite(xmlFileInRoot)) {
          notifyAfterAnnotationChanging(listOwner, annotationFQName, false);
          return;
        }
        annotateExternally(listOwner, annotationFQName, xmlFileInRoot, fromFile, value);
      }
      else {
        final XmlFile annotationsXml = createAnnotationsXml(newRoot, packageName);
        if (annotationsXml != null) {
          List<PsiFile> createdFiles = new SmartList<PsiFile>(annotationsXml);
          cacheExternalAnnotations(packageName, fromFile, createdFiles);
        }
        annotateExternally(listOwner, annotationFQName, annotationsXml, fromFile, value);
      }
    }
  }.execute();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:ExternalAnnotationsManagerImpl.java

示例11: AdtImportLocationStep

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public AdtImportLocationStep(WizardContext context) {
  super(context);

  myDestinationLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));


  String prev = context.getProjectFileDirectory();
  mySourceProject = new File(FileUtil.toSystemDependentName(prev));

  String name = new File(prev).getName();
  //noinspection ConstantConditions
  context.setProjectFileDirectory(null);
  String defaultDir = context.getProjectFileDirectory();
  int index = 0;
  File file;
  do {
    String suffix = index == 0 ? "" : Integer.toString(index);
    index++;
    file = new File(defaultDir, name + suffix);
  } while (file.exists());
  myDestDirText.setText(file.getPath());
  context.setProjectFileDirectory(prev);

  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  descriptor.setTitle("Choose Destination Directory");
  descriptor.setDescription("Pick a directory to import the given Eclipse Android project into");
  myDestDirText.addBrowseFolderListener(new TextBrowseFolderListener(descriptor) {
    @Override
    protected void onFileChosen(@NotNull VirtualFile chosenFile) {
      super.onFileChosen(chosenFile);
      myIsPathChangedByUser = true;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
      super.actionPerformed(e);
      myIsPathChangedByUser = true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:AdtImportLocationStep.java

示例12: getFileChooserDescriptor

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public FileChooserDescriptor getFileChooserDescriptor() {
  if (myFileChooserDescriptor == null) {
    myFileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    if (myTitle != null) {
      myFileChooserDescriptor.setTitle(myTitle);
    }
    myFileChooserDescriptor.setShowFileSystemRoots(true);
  }
  return myFileChooserDescriptor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:LocalPathCellEditor.java

示例13: initComponents

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
protected void initComponents() {
  myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(),
                                                         ExecutionBundle.message("run.configuration.program.parameters"));

  FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  //noinspection DialogTitleCapitalization
  fileChooserDescriptor.setTitle(ExecutionBundle.message("select.working.directory.message"));
  myWorkingDirectoryField = new TextFieldWithBrowseButton();
  myWorkingDirectoryField.addBrowseFolderListener(new MacroAwareTextBrowseFolderListener(fileChooserDescriptor, getProject()) {
    @Override
    public void actionPerformed(ActionEvent e) {
      myFileChooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, myModuleContext);
      setProject(getProject());
      super.actionPerformed(e);
    }
  });

  myWorkingDirectoryComponent = LabeledComponent.create(createComponentWithMacroBrowse(myWorkingDirectoryField), ExecutionBundle.message("run.configuration.working.directory.label"));
  myEnvVariablesComponent = new EnvironmentVariablesComponent();

  myEnvVariablesComponent.setLabelLocation(BorderLayout.WEST);
  myProgramParametersComponent.setLabelLocation(BorderLayout.WEST);
  myWorkingDirectoryComponent.setLabelLocation(BorderLayout.WEST);

  addComponents();

  setPreferredSize(new Dimension(10, 10));

  setAnchor(myEnvVariablesComponent.getLabel());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:CommonProgramParametersPanel.java

示例14: JdkLocationStep

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public JdkLocationStep(@NotNull ScopedStateStore.Key<String> pathKey, @NotNull FirstRunWizardMode mode) {
  super("Java Settings");
  myPathKey = pathKey;
  myMode = mode;
  myDownloadPageLink.setText(getLinkText());
  WelcomeUIUtils.makeButtonAHyperlink(myDownloadPageLink, Jdks.DOWNLOAD_JDK_7_URL);
  myDownloadPageLink.getParent().invalidate();
  setComponent(myContents);
  myError.setForeground(JBColor.red);
  FileChooserDescriptor folderDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  myJdkPath.addBrowseFolderListener("Select JDK Location", "Select compatible JDK location", null, folderDescriptor);
  myError.setText(null);
  myDetectButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      myDetectButton.setEnabled(false);
      JdkDetection.startWithProgressIndicator(new JdkDetection.JdkDetectionResult() {
        @Override
        public void onSuccess(String newJdkPath) {
          if (newJdkPath == null) {
            String message = AndroidBundle.message("android.wizard.jdk.autodetect.result.not.found");
            ExternalSystemUiUtil.showBalloon(myJdkPath, MessageType.INFO, message);
          }
          else {
            myJdkPath.setText(newJdkPath);
          }
          myDetectButton.setEnabled(true);
        }

        @Override
        public void onCancel() {
          myDetectButton.setEnabled(true);
        }
      });
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:JdkLocationStep.java

示例15: create

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //导入方法依赖的package包/类
public AntInstallation create() {
  FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  VirtualFile file = FileChooser.chooseFile(descriptor, myParent, null, null);
  if (file == null) return null;
  try {
    final AntInstallation inst = AntInstallation.fromHome(file.getPresentableUrl());
    adjustName(inst);
    return inst;
  }
  catch (AntInstallation.ConfigurationException e) {
    Messages.showErrorDialog(myParent, e.getMessage(), AntBundle.message("ant.setup.dialog.title"));
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AntSetPanel.java


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