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.grounding.sawsdl.preferences;
26
27 import org.eclipse.jface.preference.PreferencePage;
28 import org.eclipse.swt.SWT;
29 import org.eclipse.swt.layout.GridData;
30 import org.eclipse.swt.layout.GridLayout;
31 import org.eclipse.swt.widgets.Button;
32 import org.eclipse.swt.widgets.Composite;
33 import org.eclipse.swt.widgets.Control;
34 import org.eclipse.swt.widgets.Group;
35 import org.eclipse.ui.*;
36 import org.wsmostudio.grounding.sawsdl.ui.UiPlugin;
37 import org.wsmostudio.grounding.sawsdl.ui.editor.WSDLSEditor;
38
39
40 public class SAWSDLPrefsPage extends PreferencePage
41 implements IWorkbenchPreferencePage {
42
43
44 private Button enableWSDL11SupportButton;
45 private Button showLocalIRIsButton;
46
47 protected Control createContents(Composite parent) {
48 final Group mainPanel = new Group(parent, SWT.NONE);
49 mainPanel.setText("WSDL Annotation");
50 mainPanel.setLayout(new GridLayout(1, false));
51
52 enableWSDL11SupportButton = new Button(mainPanel, SWT.CHECK);
53 enableWSDL11SupportButton.setSelection(UiPlugin.hasWSDL11Support());
54 enableWSDL11SupportButton.setText("Enable WSDL 1.1 Support");
55 enableWSDL11SupportButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
56
57 showLocalIRIsButton = new Button(mainPanel, SWT.CHECK);
58 showLocalIRIsButton.setSelection(UiPlugin.isShowingLocalNames());
59 showLocalIRIsButton.setText("Show local reference names in tree");
60 showLocalIRIsButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
61
62 return mainPanel;
63 }
64
65 public void init(IWorkbench workbench) {
66 }
67
68 protected void performDefaults() {
69 enableWSDL11SupportButton.setSelection(false);
70 showLocalIRIsButton.setSelection(false);
71 }
72
73 public boolean performOk() {
74 UiPlugin.setWSDL11Support(enableWSDL11SupportButton.getSelection());
75 UiPlugin.setIsShowingLocalNames(showLocalIRIsButton.getSelection());
76 doUpdateOpenedEditors();
77 return super.performOk();
78 }
79
80 private void doUpdateOpenedEditors() {
81
82 IWorkbenchPage page = PlatformUI.getWorkbench()
83 .getActiveWorkbenchWindow()
84 .getActivePage();
85 if (page == null) {
86 return;
87 }
88 IEditorReference[] editors = page.getEditorReferences();
89 if (editors == null) {
90 return;
91 }
92 for(int i = 0; i < editors.length; i++) {
93 IEditorPart editor = editors[i].getEditor(true);
94 if (editor != null
95 && editor instanceof WSDLSEditor) {
96 ((WSDLSEditor)editor).getUITree().refresh(true);
97 }
98 }
99 }
100
101 }
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116