1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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.ui.editors;
26
27 import org.eclipse.swt.widgets.Composite;
28 import org.eclipse.ui.*;
29 import org.wsmo.common.TopEntity;
30 import org.wsmostudio.runtime.WSMORuntime;
31 import org.wsmostudio.ui.editors.model.*;
32
33 /***
34 * An editor component, subclass of WSMOEditor, capable to handle with WSMO-API
35 * Axiom objects.
36 * This editor appears as a part of the WSMO Studio workbench. It is the default
37 * editor implementation for this kind of objects and it can be replaced by
38 * extending extension points <code>org.wsmostudio.ui.editors</code> and
39 * <code>org.eclipse.ui.editors</code>.
40 *
41 * @author not attributable
42 * @version $Revision: 1.9 $ $Date: 2006/01/09 12:51:13 $
43 */
44
45 public class AxiomEditor extends WSMOEditor {
46
47 private AxiomEditorPanel mainEditor;
48 private AxiomModel axiomModel;
49
50
51 public void createPartControl(Composite parent) {
52
53 mainEditor = new AxiomEditorPanel(parent, axiomModel);
54 }
55
56 public void init(IEditorSite site, IEditorInput input) throws PartInitException {
57 super.init(site, input);
58 axiomModel = (AxiomModel)input.getAdapter(AxiomModel.class);
59 }
60
61 protected void updateFromModel() {
62 mainEditor.reloadDefinitionsInTable();
63 }
64
65 public void dispose() {
66 mainEditor.dispose();
67 axiomModel = null;
68 super.dispose();
69 }
70
71 public void setFocus() {
72 super.setFocus();
73 mainEditor.setFocus();
74 }
75
76 protected void doTryToSave() throws Exception {
77 mainEditor.doUpdate();
78 ObservableModel topModel = (ObservableModel)axiomModel;
79 while (topModel.getMasterModel() != null) {
80 topModel = topModel.getMasterModel();
81 }
82 WSMORuntime.getRuntime().doUpdateEntity(
83 (TopEntity)topModel.getAdapter(TopEntity.class));
84 }
85
86 }
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106