~mathieu.bastian/gephi/geolayout

« back to all changes in this revision

Viewing changes to VisualizationModule/src/org/gephi/visualization/screenshot/ScreenshotMaker.java

  • Committer: Mathieu Bastian
  • Date: 2009-09-13 20:25:12 UTC
  • Revision ID: mathieu.bastian@gmail.com-20090913202512-mb69uewzecob6ohn
Add Netbeans Directory Chooser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
import org.gephi.visualization.swing.GLAbstractListener;
49
49
import org.gephi.visualization.swing.GraphDrawableImpl;
50
50
import org.netbeans.validation.api.ui.ValidationPanel;
51
 
import org.openide.DialogDescriptor;
52
 
import org.openide.DialogDisplayer;
53
 
import org.openide.NotifyDescriptor;
54
51
import org.openide.util.NbBundle;
55
52
import org.openide.util.NbPreferences;
56
53
import org.openide.windows.WindowManager;
303
300
    public void setTransparentBackground(boolean transparentBackground) {
304
301
        this.transparentBackground = transparentBackground;
305
302
    }
 
303
 
 
304
    public File getDefaultDirectory() {
 
305
        String lastPathDefault = NbPreferences.forModule(ScreenshotMaker.class).get(LAST_PATH_DEFAULT, null);
 
306
        String lastPath = NbPreferences.forModule(ScreenshotMaker.class).get(LAST_PATH, lastPathDefault);
 
307
        File directory = null;
 
308
        if (lastPath != null) {
 
309
            directory = new File(lastPath);
 
310
            if (directory.isFile()) {
 
311
                directory = directory.getParentFile();
 
312
            }
 
313
        }
 
314
        return directory;
 
315
    }
 
316
 
 
317
    public void setDefaultDirectory(File directory) {
 
318
        if (directory != null && directory.exists()) {
 
319
            NbPreferences.forModule(ScreenshotMaker.class).put(LAST_PATH, directory.getAbsolutePath());
 
320
        }
 
321
    }
306
322
}