~duyi001/gephi/DSNI

« back to all changes in this revision

Viewing changes to DesktopBranding/src/org/gephi/branding/desktop/Installer.java

  • Committer: sunsnowad
  • Author(s): Yi Du
  • Date: 2011-09-08 16:36:59 UTC
  • mfrom: (1435.1.968 gephi)
  • Revision ID: sunsnowad@www-691ed046717-20110908163659-aorx14ylp8f9qwdx
1.merge with main branch
2.update twitter4j to version 2.2.4
3.fix an existing bug on "twitter user import"

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
You should have received a copy of the GNU Affero General Public License
19
19
along with Gephi.  If not, see <http://www.gnu.org/licenses/>.
20
 
*/
 
20
 */
21
21
package org.gephi.branding.desktop;
22
22
 
23
23
import java.util.logging.Logger;
 
24
import javax.swing.JOptionPane;
24
25
import javax.swing.UIManager;
25
26
import org.gephi.branding.desktop.reporter.ReporterHandler;
 
27
import org.gephi.desktop.project.api.ProjectControllerUI;
26
28
import org.gephi.project.api.ProjectController;
27
29
import org.openide.modules.ModuleInstall;
28
30
import org.openide.util.Lookup;
 
31
import org.openide.util.NbBundle;
 
32
import org.openide.util.NbPreferences;
29
33
import org.openide.windows.WindowManager;
30
34
 
31
35
/**
45
49
        UIManager.put("Slider.paintValue", Boolean.FALSE);
46
50
 
47
51
        //Handler
48
 
        Logger.getLogger("").addHandler(new ReporterHandler());
 
52
        if (NbPreferences.forModule(Installer.class).getBoolean("CrashReporter.enabled", true)) {
 
53
            Logger.getLogger("").addHandler(new ReporterHandler());
 
54
        }
 
55
 
 
56
        //Memory Starvation Manager
 
57
        if (NbPreferences.forModule(Installer.class).getBoolean("MemoryStarvationManager.enabled", true)) {
 
58
            MemoryStarvationManager memoryStarvationManager = new MemoryStarvationManager();
 
59
            memoryStarvationManager.startup();
 
60
        }
49
61
    }
50
62
 
51
63
    private void initGephi() {
58
70
            }
59
71
        });
60
72
    }
 
73
 
 
74
    @Override
 
75
    public boolean closing() {
 
76
        if (Lookup.getDefault().lookup(ProjectController.class).getCurrentProject() == null) {
 
77
            //Close directly if no project open
 
78
            return true;
 
79
        }
 
80
 
 
81
        int option = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(Installer.class, "CloseConfirmation.message"), NbBundle.getMessage(Installer.class, "CloseConfirmation.message"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
 
82
        if (option == JOptionPane.YES_OPTION) {
 
83
            Lookup.getDefault().lookup(ProjectControllerUI.class).saveProject();
 
84
        } else if (option == JOptionPane.CANCEL_OPTION) {
 
85
            return false;//Exit canceled
 
86
        }
 
87
        Lookup.getDefault().lookup(ProjectController.class).closeCurrentProject();
 
88
        return true;
 
89
    }
61
90
}