1 /*
2 WSMO Studio - a Semantic Web Service Editor
3 Copyright (c) 2004-2006, OntoText Lab. / SIRMA Group
4
5 This library is free software; you can redistribute it and/or modify it under
6 the terms of the GNU Lesser General Public License as published by the Free
7 Software Foundation; either version 2.1 of the License, or (at your option)
8 any later version.
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 details.
13 You should have received a copy of the GNU Lesser General Public License along
14 with this library; if not, write to the Free Software Foundation, Inc.,
15 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18 /***
19 * <p>Title: WSMO Studio</p>
20 * <p>Description: Semantic Web Service Editor</p>
21 * <p>Copyright: Copyright (c) 2004-2006</p>
22 * <p>Company: OntoText Lab. / SIRMA </p>
23 */
24
25 package org.wsmostudio.choreography.editors;
26
27 import org.eclipse.swt.widgets.Composite;
28 import org.wsmo.service.choreography.rule.*;
29 import org.wsmo.service.rule.*;
30 import org.wsmostudio.choreography.editors.model.ChoreographyModel;
31
32 public abstract class RuleFormEditor {
33
34 protected ChoreographyRule rule;
35 protected ChoreographyModel uiModel;
36
37 public RuleFormEditor(ChoreographyRule rule, ChoreographyModel model) {
38 this.rule = rule;
39 this.uiModel = model;
40 }
41
42 public abstract Composite initUI(Composite parent);
43
44 public abstract void updateRule() throws Exception;
45 public abstract void dispose();
46
47 protected String labelForRule() {
48 if (rule instanceof Add) {
49 return "add( ... )";
50 }
51 else if (rule instanceof Delete) {
52 return "delete( ... )";
53 }
54 else if (rule instanceof Update) {
55 return "update( ... )";
56 }
57 else if (rule instanceof ChoreographyIfThen) {
58 return "if ( ... ) then ";
59 }
60 else if (rule instanceof ChoreographyChoose) {
61 return "choose { ... } with ( ... ) do ";
62 }
63 else { // forAll
64 return "forall { ... } with ( ... ) do ";
65 }
66 }
67
68 public Rule getRule() {
69 return this.rule;
70 }
71 }
72
73 /*
74 * $Log$
75 * Revision 1.9 2006/11/22 14:11:06 alex_simov
76 * Code refactoring: the plug-in is synchronized with the latest wsmo4j changes
77 *
78 * Revision 1.8 2006/03/27 09:50:15 alex_simov
79 * ui fix
80 *
81 * Revision 1.7 2006/02/17 09:47:39 alex_simov
82 * method updateRue() throws a more general exception type
83 *
84 * Revision 1.6 2006/02/16 13:41:27 alex_simov
85 * bugfix [1426200]: namespace definitions were not used in choreography rule
86 * editors
87 *
88 * Revision 1.5 2006/02/14 15:09:38 alex_simov
89 * chor API minor changes adoption
90 *
91 * Revision 1.4 2006/01/09 12:51:11 alex_simov
92 * Copyright message in header updated
93 *
94 * Revision 1.3 2005/12/19 15:35:54 alex_simov
95 * update
96 *
97 * Revision 1.2 2005/11/18 13:48:06 alex_simov
98 * javadoc: header/footer added
99 *
100 */