當前位置: 首頁>>代碼示例>>Java>>正文


Java FileChooserDescriptorFactory類代碼示例

本文整理匯總了Java中com.intellij.openapi.fileChooser.FileChooserDescriptorFactory的典型用法代碼示例。如果您正苦於以下問題:Java FileChooserDescriptorFactory類的具體用法?Java FileChooserDescriptorFactory怎麽用?Java FileChooserDescriptorFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FileChooserDescriptorFactory類屬於com.intellij.openapi.fileChooser包,在下文中一共展示了FileChooserDescriptorFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: EduLocalCoursePanel

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
public EduLocalCoursePanel(final StudyProjectGenerator generator, EduCustomCourseModuleBuilder builder) {
  myGenerator = generator;
  myBuilder = builder;
  myCourseArchivePath.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent actionEvent) {
      String coursePath = myCourseArchivePath.getText();
      Course courseInfo = generator.addLocalCourse(coursePath);
      if (courseInfo != null) {
        myBuilder.setSelectedCourse(courseInfo);
        myGenerator.setSelectedCourse(courseInfo);
        myStudyPanel.updateInfoPanel(courseInfo);
      }
      else {
        //TODO: implement validation
      }
    }
  });
  myCourseArchivePath.addBrowseFolderListener("Select Course Archive", null, null,
                                              FileChooserDescriptorFactory.createSingleFileDescriptor());
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:22,代碼來源:EduLocalCoursePanel.java

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

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

示例4: actionPerformed

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    logger.debug("Loading sample!");

    final Project project = anActionEvent.getProject();
    final PsiFile psiFile = anActionEvent.getData(CommonDataKeys.PSI_FILE);

    VirtualFile sample = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(),
            project, null);
    if (sample == null)
        return;

    try {
        final String text = new String(sample.contentsToByteArray(), sample.getCharset());

        new WriteCommandAction.Simple(project, psiFile) {
            @Override
            protected void run() throws Throwable {
                document.setText(text);
            }
        }.execute();
    } catch (Exception e) {
        logger.error(e);
    }

}
 
開發者ID:machaval,項目名稱:mule-intellij-plugins,代碼行數:27,代碼來源:OpenSampleAction.java

示例5: createUIComponents

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
private void createUIComponents() {
    defaultExtensionLabel = new JBLabel(TesterBundle.message("settings.defaultExtension"));
    defaultExtensionCombobox = new ComboBox<>(new String[]{"phpt", "php"});

    bootstrapFileLabel = new JBLabel(TesterBundle.message("settings.bootstrapFile"));
    bootstrapFileField = new TextFieldWithBrowseButton();
    bootstrapFileField.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("php"));

    namespaceMappingTable = new NamespaceMappingTable(project);
    namespaceMappingPanel = ToolbarDecorator.createDecorator(namespaceMappingTable.getTableView(), new ElementProducer<TesterNamespaceMapping>() {
        @Override
        public TesterNamespaceMapping createElement() {
            return new TesterNamespaceMapping();
        }

        @Override
        public boolean canCreateElement() {
            return true;
        }
    }).createPanel();

    namespaceMappingPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.LIGHT_GRAY), TesterBundle.message("settings.namespaceMappings.title")));
}
 
開發者ID:jiripudil,項目名稱:intellij-nette-tester,代碼行數:24,代碼來源:TesterConfigurableForm.java

示例6: createUIComponents

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
private void createUIComponents() {
    phpInterpreter = new PhpInterpreterComboBox(project, null);
    phpInterpreter.setModel(PhpInterpretersManagerImpl.getInstance(project).getInterpreters(), null);
    phpInterpreter.setNoItemText("<default project interpreter>");

    interpreterOptions = new PhpConfigurationOptionsComponent();

    phpIniPath = new TextFieldWithBrowseButton();
    phpIniPath.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("ini"));

    useSystemPhpIniCheckbox = new JBCheckBox(TesterBundle.message("runConfiguration.editor.testEnv.useSystemPhpIni"));

    interpreterLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.testEnv.interpreter"));
    interpreterOptionsLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.testEnv.interpreterOptions"));
    pathToPhpIniLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.testEnv.phpIni"));
}
 
開發者ID:jiripudil,項目名稱:intellij-nette-tester,代碼行數:17,代碼來源:TesterTestEnvironmentSettingsEditor.java

示例7: createUIComponents

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
private void createUIComponents() {
    testScope = new TextFieldWithBrowseButton();
    testScope.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor());

    testerExecutable = new TextFieldWithBrowseButton();
    testerExecutable.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor());

    testerOptions = new RawCommandLineEditor();
    testerOptions.setDialogCaption("Options");

    userSetupScript = new TextFieldWithBrowseButton();
    userSetupScript.addBrowseFolderListener(null, null, project, FileChooserDescriptorFactory.createSingleFileDescriptor("php"));

    testScopeLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.testScope"));
    testerExecutableLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.testerExecutable"));
    testerOptionsLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.testerOptions"));
    setupScriptLabel = new JBLabel(TesterBundle.message("runConfiguration.editor.tester.setupScript"));
}
 
開發者ID:jiripudil,項目名稱:intellij-nette-tester,代碼行數:19,代碼來源:TesterSettingsEditor.java

示例8: specifyADBPath

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
private void specifyADBPath() {
    final String adbPath = Global.instance().adbPath();
    final VirtualFile toSelect;

    if (Utils.isBlank(adbPath)) {
        toSelect = null;
    } else {
        toSelect = LocalFileSystem.getInstance().refreshAndFindFileByPath(adbPath);
    }

    final VirtualFile vFile = FileChooser.chooseFile(
            FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor(), Global.instance().project(), toSelect);

    if (vFile == null || !vFile.exists()) {
        return;
    }

    mPresenter.chooseADBPath(vFile);
}
 
開發者ID:huazhouwang,項目名稱:WIFIADB,代碼行數:20,代碼來源:RootWindow.java

示例9: createComponent

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
@Nullable
@Override
public JComponent createComponent() {
    FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
    imageFolder.addBrowseFolderListener(new TextBrowseFolderListener(descriptor) {
        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fc = new JFileChooser();
            String current = imageFolder.getText();
            if (!current.isEmpty()) {
                fc.setCurrentDirectory(new File(current));
            }
            fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            fc.showOpenDialog(rootPanel);

            File file = fc.getSelectedFile();
            String path = file == null
                    ? ""
                    : file.getAbsolutePath();
            imageFolder.setText(path);
        }
    });
    autoChangeCheckBox.addActionListener(e -> intervalSpinner.setEnabled(autoChangeCheckBox.isSelected()));
    return rootPanel;
}
 
開發者ID:lachlankrautz,項目名稱:backgroundImagePlus,代碼行數:26,代碼來源:Settings.java

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

示例11: createLogFileChooser

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
private void createLogFileChooser() {
  myLogFile = new TextFieldWithHistory();
  JPanel panel = GuiUtils.constructFieldWithBrowseButton(myLogFile, new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
      FileChooser.chooseFiles(descriptor, myProject, null, new Consumer<List<VirtualFile>>() {
        @Override
        public void consume(List<VirtualFile> files) {
          myLogFile.setText(FileUtil.toSystemDependentName(files.get(files.size() - 1).getPath()));
        }
      });
    }
  });
  myLogFileChooserPanel.setLayout(new BorderLayout());
  myLogFileChooserPanel.add(panel, BorderLayout.CENTER);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:UnscrambleDialog.java

示例12: downloadJar

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
private void downloadJar(String jarUrl, String jarName) {
  final Project project = myModule.getProject();
  final String dirPath = PropertiesComponent.getInstance(project).getValue("findjar.last.used.dir");
  VirtualFile toSelect = dirPath == null ? null : LocalFileSystem.getInstance().findFileByIoFile(new File(dirPath));
  final VirtualFile file = FileChooser.chooseFile(FileChooserDescriptorFactory.createSingleFolderDescriptor(), project, toSelect);
  if (file != null) {
    PropertiesComponent.getInstance(project).setValue("findjar.last.used.dir", file.getPath());
    final DownloadableFileService downloader = DownloadableFileService.getInstance();
    final DownloadableFileDescription description = downloader.createFileDescription(jarUrl, jarName);
    final List<VirtualFile> jars =
      downloader.createDownloader(Arrays.asList(description), jarName)
                .downloadFilesWithProgress(file.getPath(), project, myEditorComponent);
    if (jars != null && jars.size() == 1) {
      AccessToken token = WriteAction.start();
      try {
        OrderEntryFix.addJarToRoots(jars.get(0).getPresentableUrl(), myModule, myRef);
      }
      finally {
        token.finish();
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:FindJarFix.java

示例13: createUIComponents

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
private void createUIComponents() {
  myLanguageLevelCombo = new LanguageLevelCombo(JavaCoreBundle.message("default.language.level.description")) {
    @Override
    protected LanguageLevel getDefaultLevel() {
      Sdk sdk = myProjectJdkConfigurable.getSelectedProjectJdk();
      if (sdk == null) return null;
      JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
      return version == null ? null : version.getMaxLanguageLevel();
    }
  };
  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  outputPathsChooserDescriptor.setHideIgnored(false);
  BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
  myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
  FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:ProjectConfigurable.java

示例14: GroovyDocGenerationPanel

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
GroovyDocGenerationPanel() {
  myInputDir.addBrowseFolderListener(GroovyDocBundle.message("groovydoc.generate.directory.browse"), null, null,
                                     FileChooserDescriptorFactory.createSingleFolderDescriptor());

  myOutputDir.addBrowseFolderListener(GroovyDocBundle.message("groovydoc.generate.directory.browse"), null, null,
                                      FileChooserDescriptorFactory.createSingleFolderDescriptor());

  myDataModel = new DefaultListModel();

  myPackagesList = new JBList(myDataModel);
  myPackagesList.setMinimumSize(JBUI.size(100, 150));

  JScrollPane packagesScrollPane = ScrollPaneFactory.createScrollPane(myPackagesList);
  myPackagesPanel.setLayout(new BorderLayout());
  myPackagesPanel.setBorder(IdeBorderFactory.createTitledBorder("Source packages", false));

  ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("GroovyDoc", getActionGroup(), true);
  myPackagesPanel.add(actionToolbar.getComponent(), BorderLayout.NORTH);
  myPackagesPanel.add(packagesScrollPane, BorderLayout.SOUTH);

  actionToolbar.updateActionsImmediately();

  myPanel.setMinimumSize(JBUI.size(275, 350));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:25,代碼來源:GroovyDocGenerationPanel.java

示例15: constructFileURLBrowserField

import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory; //導入依賴的package包/類
public static JPanel constructFileURLBrowserField(final TextFieldWithHistory field, final String objectName) {
  return constructFieldWithBrowseButton(field, new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      FileChooserDescriptor descriptor =
        FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor().withTitle("Select " + objectName);
      VirtualFile file = FileChooser.chooseFile(descriptor, field, null, null);
      if (file != null) {
        try {
          field.setText(VfsUtilCore.virtualToIoFile(file).toURI().toURL().toString());
        }
        catch (MalformedURLException e1) {
          field.setText("");
        }
      }
    }
  });
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:GuiUtils.java


注:本文中的com.intellij.openapi.fileChooser.FileChooserDescriptorFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。