01: package com.opensymphony.workflow.designer.actions;
02:
03: import java.awt.event.ActionEvent;
04: import javax.swing.AbstractAction;
05:
06: import com.opensymphony.workflow.designer.event.WorkspaceListener;
07: import com.opensymphony.workflow.designer.event.WorkspaceEvent;
08: import com.opensymphony.workflow.loader.WorkflowFactory;
09: import com.opensymphony.workflow.designer.WorkflowDesigner;
10:
11: /**
12: * @author acapitani
13: */
14: public class ValidateWorkflow extends AbstractAction implements
15: WorkspaceListener {
16: private WorkflowFactory currentWorkspace;
17:
18: public ValidateWorkflow() {
19: setEnabled(false);
20: }
21:
22: public void actionPerformed(ActionEvent arg0) {
23: WorkflowDesigner.INSTANCE.validateCurrentWorkflow();
24: }
25:
26: public void workspaceChanged(WorkspaceEvent event) {
27: if (event.getId() == WorkspaceEvent.WORKSPACE_OPENED) {
28: setEnabled(true);
29: currentWorkspace = event.getWorkspace();
30: } else {
31: setEnabled(false);
32: currentWorkspace = null;
33: }
34: }
35:
36: }
|