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.SWT;
28 import org.eclipse.swt.custom.SashForm;
29 import org.eclipse.swt.layout.*;
30 import org.eclipse.swt.widgets.*;
31 import org.eclipse.ui.*;
32 import org.wsmostudio.runtime.WSMORuntime;
33 import org.wsmostudio.ui.editors.common.*;
34 import org.wsmostudio.ui.editors.model.OntologyModel;
35
36 /***
37 * An editor component, subclass of WSMOEditor, capable to handle with WSMO-API
38 * Ontology objects.
39 * This editor appears as a part of the WSMO Studio workbench. It is the default
40 * editor implementation for this kind of objects and it can be replaced by
41 * extending extension points <code>org.wsmostudio.ui.editors</code> and
42 * <code>org.eclipse.ui.editors</code>.
43 *
44 * @author not attributable
45 * @version $Revision: 1.8 $ $Date: 2006/01/09 12:51:13 $
46 */
47
48 public class OntologyEditor extends WSMOEditor {
49
50 private NFPPanel nfpPanel;
51 private NamespacesPanel nsPanel;
52 private ImportOntologyPanel ontologiesPanel;
53 private UsedMediatorsPanel mediatorsPanel;
54
55 private OntologyModel model;
56
57 private TabFolder importOntosFolder, usedMedsFolder;
58
59 public void createPartControl(Composite parent) {
60 GridLayout mainLayout = new GridLayout(1, false);
61 mainLayout.verticalSpacing = 0;
62 parent.setLayout(mainLayout);
63
64 nfpPanel = new NFPPanel(parent, model);
65
66 SashForm splitter = new SashForm(parent, SWT.VERTICAL );
67 splitter.setLayoutData(new GridData(GridData.FILL_BOTH));
68
69 nsPanel = new NamespacesPanel(splitter, model);
70
71 importOntosFolder = new TabFolder(splitter, SWT.NONE);
72 ontologiesPanel = new ImportOntologyPanel(
73 importOntosFolder,
74 model);
75
76 usedMedsFolder = new TabFolder(splitter, SWT.NONE);
77 mediatorsPanel = new UsedMediatorsPanel(usedMedsFolder, model);
78
79 }
80
81 public void init(IEditorSite site, IEditorInput input) throws PartInitException {
82 super.init(site, input);
83 this.model = (OntologyModel)input.getAdapter(OntologyModel.class);
84 }
85
86 public void dispose() {
87 nsPanel.dispose();
88 nfpPanel.dispose();
89 super.dispose();
90 }
91
92 protected void doTryToSave() throws Exception {
93
94 nsPanel.doUpdate();
95 WSMORuntime.getRuntime().doUpdateEntity(model.getOntology());
96 }
97
98 @SuppressWarnings("unchecked")
99 protected void updateFromModel() {
100 nsPanel.reloadNSInfo();
101 ontologiesPanel.reloadOntologies();
102 mediatorsPanel.reloadMediators();
103 }
104 }
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121