1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.actions;
14
15 import com.eviware.soapui.SoapUI;
16 import com.eviware.soapui.impl.WorkspaceImpl;
17 import com.eviware.soapui.model.project.Project;
18 import com.eviware.soapui.model.workspace.Workspace;
19 import com.eviware.soapui.model.workspace.WorkspaceListener;
20 import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
21
22 /***
23 * Action to save all projects
24 *
25 * @author ole.matzura
26 */
27
28 public class SaveAllProjectsAction extends AbstractSoapUIAction<WorkspaceImpl> implements WorkspaceListener
29 {
30 public static final String SOAPUI_ACTION_ID = "SaveAllProjectsAction";
31
32 public SaveAllProjectsAction()
33 {
34 super( "Save All Projects", "Saves all projects in the current Workspace" );
35
36 Workspace workspace = SoapUI.getWorkspace();
37 if( workspace == null )
38 {
39 setEnabled( true );
40 }
41 else
42 {
43 setEnabled( workspace.getProjectCount() > 0 );
44 workspace.addWorkspaceListener( this );
45 }
46 }
47
48 public void perform( WorkspaceImpl workspace, Object param )
49 {
50 workspace.save( false );
51 }
52
53 public void projectAdded( Project project )
54 {
55 setEnabled( true );
56 }
57
58 public void projectChanged( Project project )
59 {
60 }
61
62 public void projectRemoved( Project project )
63 {
64 setEnabled( project.getWorkspace().getProjectCount() == 0 );
65 }
66
67 public void workspaceSwitched( Workspace workspace )
68 {
69 setEnabled( workspace.getProjectCount() > 0 );
70 }
71
72 public void workspaceSwitching( Workspace workspace )
73 {
74 }
75 }