Package com.intellij.openapi.fileChooser

Examples of com.intellij.openapi.fileChooser.FileSaverDescriptor



  private void exportPreferences() {
    final PersistencePreferencesBean prefs = _plugin.getState();
    final VirtualFileWrapper wrapper = FileChooserFactory.getInstance().createSaveFileDialog(
        new FileSaverDescriptor("Export FindBugs Preferences to File...", "", "xml"), this).save( null, null );
    if (wrapper == null) return;
    final Element el= XmlSerializer.serialize(prefs);
    el.setName(PERSISTENCE_ROOT_NAME); // rename "PersistencePreferencesBean"
    final Document document = new Document(el);
    try {
View Full Code Here


    final String flexFileName = getFlexFileName(bnfFile);

    Collection<VirtualFile> files = FilenameIndex.getVirtualFilesByName(project, flexFileName, ProjectScope.getAllScope(project));
    VirtualFile firstItem = ContainerUtil.getFirstItem(files);

    FileSaverDescriptor descriptor = new FileSaverDescriptor("Save JFlex Lexer", "", "flex");
    VirtualFile baseDir = firstItem != null ? firstItem.getParent() : bnfFile.getVirtualFile().getParent();
    VirtualFileWrapper fileWrapper = FileChooserFactory.getInstance().createSaveFileDialog(descriptor, project).
      save(baseDir, firstItem != null ? firstItem.getName() : flexFileName);
    if (fileWrapper == null) return;
    final VirtualFile virtualFile = fileWrapper.getVirtualFile(true);
View Full Code Here

                sendResults(email.toString());
            }
        });
        results.getExportButton().addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final FileSaverDescriptor descriptor = new FileSaverDescriptor("Save results to", "");
                final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(
                        descriptor, javaPuzzlersGame.getProject());
                VirtualFile base = javaPuzzlersGame.getProject().getBaseDir();

                final VirtualFileWrapper fileWrapper = dialog.save(base, "results.html");
                if (fileWrapper != null) {
                    ApplicationManager.getApplication().invokeLater(new Runnable() {
                        public void run() {
                            final VirtualFile fileToSave = fileWrapper.getVirtualFile(true);
                            assert fileToSave != null;
                            try {
                                fileToSave.setBinaryContent(results.exportResultsToXML(login.getLogin()).getBytes());
                            } catch (IOException e) {
                                e.printStackTrace(System.err);
                            }
                        }
                    });
                }

            }
        });
        results.getXsltButton().addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
                final FileSaverDescriptor descriptor = new FileSaverDescriptor("Choose xsl file", "xsl");
                final FileChooserDialog dialog = FileChooserFactory.getInstance().createFileChooser(descriptor, javaPuzzlersGame.getProject());
                VirtualFile[] xsl = dialog.choose(null, javaPuzzlersGame.getProject());
                results.transformXML(javaPuzzlersGame.getProject(), login.getLogin(), xsl[0]);

            }
View Full Code Here

                answerButton.setEnabled(false);
            }
        });
        runButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                final FileSaverDescriptor descriptor = new FileSaverDescriptor("Save Main class to", "");
                final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(
                        descriptor, project);
                VirtualFile base = project.getBaseDir();
                try {
                    VirtualFile vf = base.findFileByRelativePath("src" + File.separator + "puzzlers");
View Full Code Here

    }

    public void transformXML(final Project project, final String name, VirtualFile xsl) {
        try {

            final FileSaverDescriptor saverDescriptor = new FileSaverDescriptor("Save results to", "");
            final FileSaverDialog saverDialog = FileChooserFactory.getInstance().createSaveFileDialog(
                    saverDescriptor, project);
            VirtualFile base = project.getBaseDir();

            final VirtualFileWrapper fileWrapper = saverDialog.save(base, "");
View Full Code Here

TOP

Related Classes of com.intellij.openapi.fileChooser.FileSaverDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.