1 package gov.nasa.pds.ltdt.gui;
2
3 import gov.nasa.pds.ltdt.gui.configuration.LTDTKeys;
4
5 import java.util.Enumeration;
6 import java.util.HashMap;
7 import java.util.Iterator;
8 import java.util.Properties;
9
10 import javax.swing.JOptionPane;
11
12 public class ToolExit {
13 Properties props;
14
15
16 public static void exitHandling (Properties props, MainWindow window){
17
18 if ("true".equals(props.getProperty("debug"))) {
19 System.err.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
20 System.err.println ("All configuration parameter values at closing time");
21 for (Enumeration e= props.propertyNames(); e.hasMoreElements();) {
22 String key = e.nextElement().toString();
23 System.err.println (key+"="+props.getProperty(key));
24 }
25
26
27 }
28
29 if ("true".equals(props.getProperty(LTDTKeys.PROJECTALTERED))) {
30 int response=JOptionPane.showConfirmDialog (
31 window,
32 "Do you want to save changes made to this project\nbefore exiting?",
33 LTDTKeys.PROJECTMODIFIEDTITLE,
34 JOptionPane.YES_NO_CANCEL_OPTION );
35
36 switch (response) {
37 case JOptionPane.YES_OPTION:
38
39
40
41
42
43
44
45
46 int status = ProjectSave.save(props, window);
47
48
49
50
51
52 window.dictionaryMap.clear();
53 System.exit(0);
54 break;
55 case JOptionPane.NO_OPTION:
56 window.dictionaryMap.clear();
57 System.exit(0);
58 break;
59 case JOptionPane.CANCEL_OPTION:
60 break;
61 default:;
62 }
63 }
64 else {
65 window.dictionaryMap.clear();
66 System.exit(0);
67 }
68 }
69
70 }