Search in sources :

Example 6 with MostRecentFiles

use of org.gephi.desktop.mrufiles.api.MostRecentFiles in project gephi by gephi.

the class ProjectControllerUIImpl method saveProject.

private void saveProject(Project project, File file) {
    lockProjectActions();
    final Runnable saveTask = controller.saveProject(project, file);
    final String fileName = file.getName();
    Runnable saveRunnable = new Runnable() {

        @Override
        public void run() {
            saveTask.run();
            //Status line
            StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(ProjectControllerUIImpl.class, "ProjectControllerUI.status.saved", fileName));
        }
    };
    if (saveTask instanceof LongTask) {
        longTaskExecutor.execute((LongTask) saveTask, saveRunnable);
    } else {
        longTaskExecutor.execute(null, saveRunnable);
    }
    //Save MRU
    MostRecentFiles mostRecentFiles = Lookup.getDefault().lookup(MostRecentFiles.class);
    mostRecentFiles.addFile(file.getAbsolutePath());
}
Also used : MostRecentFiles(org.gephi.desktop.mrufiles.api.MostRecentFiles) LongTask(org.gephi.utils.longtask.spi.LongTask)

Aggregations

MostRecentFiles (org.gephi.desktop.mrufiles.api.MostRecentFiles)6 LongTask (org.gephi.utils.longtask.spi.LongTask)4 FileObject (org.openide.filesystems.FileObject)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 GZIPInputStream (java.util.zip.GZIPInputStream)2 JPanel (javax.swing.JPanel)2 ChangeEvent (javax.swing.event.ChangeEvent)2 ChangeListener (javax.swing.event.ChangeListener)2 BZip2CompressorInputStream (org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream)2 Container (org.gephi.io.importer.api.Container)2 FileImporter (org.gephi.io.importer.spi.FileImporter)2 ImporterUI (org.gephi.io.importer.spi.ImporterUI)2 ValidationPanel (org.netbeans.validation.api.ui.ValidationPanel)2 DialogDescriptor (org.openide.DialogDescriptor)2 NotifyDescriptor (org.openide.NotifyDescriptor)2 ActionEvent (java.awt.event.ActionEvent)1