1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 /***
36
37 * <p>Title: WSMO Studio</p>
38
39 * <p>Description: Semantic Web Service Editor</p>
40
41 * <p>Copyright: Copyright (c) 2004-2006</p>
42
43 * <p>Company: OntoText Lab. / SIRMA </p>
44
45 */
46
47
48
49 package org.wsmostudio.ui.editors;
50
51
52
53 import org.eclipse.swt.SWT;
54
55 import org.eclipse.swt.custom.SashForm;
56
57 import org.eclipse.swt.layout.*;
58
59 import org.eclipse.swt.widgets.*;
60
61 import org.eclipse.ui.*;
62
63 import org.wsmo.common.TopEntity;
64
65 import org.wsmo.service.Interface;
66
67 import org.wsmostudio.runtime.WSMORuntime;
68
69 import org.wsmostudio.ui.Utils;
70
71 import org.wsmostudio.ui.editors.common.*;
72
73 import org.wsmostudio.ui.editors.model.InterfaceModel;
74
75
76
77 /***
78
79 * An editor component, subclass of WSMOEditor, capable to handle with WSMO-API
80
81 * Interface objects.
82
83 * This editor appears as a part of the WSMO Studio workbench. It is the default
84
85 * editor implementation for this kind of objects and it can be replaced by
86
87 * extending extension points <code>org.wsmostudio.ui.editors</code> and
88
89 * <code>org.eclipse.ui.editors</code>.
90
91 *
92
93 * @author not attributable
94
95 * @version $Revision: 1.13 $ $Date: 2006/03/15 09:01:46 $
96
97 */
98
99
100
101 public class InterfaceEditor extends WSMOEditor {
102
103
104
105 private NFPPanel nfpPanel;
106
107 private NamespacesPanel nsPanel;
108
109 private ImportOntologyPanel ontologiesPanel;
110
111 private InterfaceModel model;
112
113
114
115 private TabFolder ontosFolder;
116
117
118
119 private Text choreographyField, orchestrationField;
120
121
122
123 public void createPartControl(Composite parent) {
124
125 GridLayout mainLayout = new GridLayout(1, false);
126
127 mainLayout.verticalSpacing = 0;
128
129 parent.setLayout(mainLayout);
130
131
132
133 nfpPanel = new NFPPanel(parent, model);
134
135
136
137 SashForm splitter = new SashForm(parent, SWT.VERTICAL );
138
139 splitter.setLayoutData(new GridData(GridData.FILL_BOTH));
140
141 nsPanel = new NamespacesPanel(splitter, model);
142
143 ontosFolder = new TabFolder(splitter, SWT.NONE);
144
145 ontologiesPanel = new ImportOntologyPanel(
146
147 ontosFolder,
148
149 model);
150
151
152
153 createInterfacePanel(parent);
154
155 }
156
157
158
159 public void init(IEditorSite site, IEditorInput input) throws PartInitException {
160
161 super.init(site, input);
162
163 this.model = (InterfaceModel)input.getAdapter(InterfaceModel.class);
164
165 }
166
167
168
169 public void dispose() {
170
171 nfpPanel.dispose();
172
173 super.dispose();
174
175 }
176
177
178
179 protected void doTryToSave() throws Exception {
180
181 nsPanel.doUpdate();
182
183 TopEntity topContainer = Utils.findTopContainer(model);
184
185 WSMORuntime.getRuntime().doUpdateEntity(topContainer);
186
187 }
188
189
190
191 @SuppressWarnings("unchecked")
192
193 protected void updateFromModel() {
194
195
196
197 nsPanel.reloadNSInfo();
198
199 ontologiesPanel.reloadOntologies();
200
201
202
203 Interface targetIface = model.getInterface();
204
205 orchestrationField.setText((targetIface.getOrchestration() != null) ?
206
207 targetIface.getOrchestration().getIdentifier().toString()
208
209 : "");
210
211 choreographyField.setText((targetIface.getChoreography() != null) ?
212
213 targetIface.getChoreography().getIdentifier().toString()
214
215 : "");
216
217 }
218
219
220
221 private void createInterfacePanel(Composite parent) {
222
223 Group mainPanel = new Group(parent, SWT.NONE);
224
225 mainPanel.setLayout(new GridLayout(2, false));
226
227 mainPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
228
229
230
231 new Label(mainPanel, SWT.NONE).setText("Choreography : ");
232
233 choreographyField = new Text(mainPanel, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
234
235
236
237 if (model.getInterface().getChoreography() != null) {
238
239 choreographyField.setText(model.getInterface()
240
241 .getChoreography()
242
243 .getIdentifier().toString());
244
245 }
246
247 choreographyField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
248
249 new Label(mainPanel, SWT.NONE).setText("Orchestration :");
250
251
252
253 orchestrationField = new Text(mainPanel, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
254
255
256
257 if (model.getInterface().getOrchestration() != null) {
258
259 orchestrationField.setText(model.getInterface()
260
261 .getOrchestration()
262
263 .getIdentifier().toString());
264
265 }
266
267 orchestrationField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
268
269 }
270
271
272
273 }
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306