View Javadoc

1   package gov.nasa.pds.ltdt.gui;
2   
3   import gov.nasa.pds.ltdt.gui.configuration.LTDTKeys;
4   
5   import java.awt.event.ActionEvent;
6   import java.util.Properties;
7   
8   import javax.swing.AbstractAction;
9   import javax.swing.Icon;
10  import javax.swing.JOptionPane;
11  
12  public class SaveProjectAction extends AbstractAction {
13  
14  	private Properties props;
15  	private MainWindow window;
16  	
17  	public SaveProjectAction (String name, Icon image, 
18  		String desc, Integer mnemonic, Properties props, MainWindow window ) {
19  	// TODO: saving a project
20  	// if the project name is "Untitiled" prompt the user for a name
21  	// (this is the same as Saved as)
22  		super(name, image);
23  		putValue(SHORT_DESCRIPTION,desc); // tooltip
24  		putValue(MNEMONIC_KEY,mnemonic);  // accelarator key	
25  		
26  		this.props = props;
27  		this.window = window;
28  	
29  		//initializeMenu();
30  		
31  	}
32  
33  	public void actionPerformed(ActionEvent ae) {
34  
35  
36  		// if the project name is "Untitled", a project should be created
37  		/*
38  		//if ("Untitled".equals(props.getProperty(LTDTKeys.PROJECTNAME))){
39  			////new ProjectCreateDialog (props, window, LTDTKeys.SAVEASTITLE, LTDTKeys.SAVEAS);
40  			//ProjectSave.save(props, window);
41  		
42  		//}
43  		//else {
44  			//ProjectSave.save(props, window);
45  		//}
46  		*/
47  		int status = ProjectSave.save(props, window);
48  		
49  		if (status==LTDTKeys.SUCCESS) {
50  		
51  			//JOptionPane.showMessageDialog(
52  			//	window, 
53  			//	"Project "+props.getProperty(LTDTKeys.PROJECTNAME)+" saved successfully");		
54  		}
55  		
56  	}
57  
58  
59  }
60  	
61  	
62  
63