Package: WorkbenchPreferencePageCsk

WorkbenchPreferencePageCsk

nameinstructionbranchcomplexitylinemethod
WorkbenchPreferencePageCsk()
M: 15 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
createContents(Composite)
M: 113 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 24 C: 0
0%
M: 1 C: 0
0%
doGetPreferenceStore()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
init(IWorkbench)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
performDefaults()
M: 27 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
performOk()
M: 20 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * org.overture.ide.plugins.csk
4: * %%
5: * Copyright (C) 2008 - 2014 Overture
6: * %%
7: * This program is free software: you can redistribute it and/or modify
8: * it under the terms of the GNU General Public License as
9: * published by the Free Software Foundation, either version 3 of the
10: * License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public
18: * License along with this program. If not, see
19: * <http://www.gnu.org/licenses/gpl-3.0.html>.
20: * #~%
21: */
22: package org.overture.ide.plugins.csk.internal;
23:
24: import org.eclipse.core.runtime.Platform;
25: import org.eclipse.jface.preference.DirectoryFieldEditor;
26: import org.eclipse.jface.preference.FileFieldEditor;
27: import org.eclipse.jface.preference.IPreferenceStore;
28: import org.eclipse.jface.preference.PreferencePage;
29: import org.eclipse.swt.SWT;
30: import org.eclipse.swt.layout.GridData;
31: import org.eclipse.swt.layout.GridLayout;
32: import org.eclipse.swt.widgets.Composite;
33: import org.eclipse.swt.widgets.Control;
34: import org.eclipse.swt.widgets.Label;
35: import org.eclipse.ui.IWorkbench;
36: import org.eclipse.ui.IWorkbenchPreferencePage;
37: import org.overture.ide.plugins.csk.Activator;
38: import org.overture.ide.plugins.csk.ICskConstants;
39:
40: public class WorkbenchPreferencePageCsk extends PreferencePage
41:                 implements IWorkbenchPreferencePage
42: {
43:         FileFieldEditor vdmPath = null;
44:         FileFieldEditor vppPath = null;
45:         //FileFieldEditor vicePath = null;
46:         
47:         DirectoryFieldEditor vdmPathMac = null;
48:         DirectoryFieldEditor vppPathMac = null;
49:         //DirectoryFieldEditor vicePathMac = null;
50:         
51:         
52:         @Override
53:         protected Control createContents(Composite parent) {
54:                 Composite top = new Composite(parent, SWT.LEFT);
55:
56:                 // Sets the layout data for the top composite's
57:                 // place in its parent's layout.
58:                 top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
59:
60:                 // Sets the layout for the top composite's
61:                 // children to populate.
62:                 top.setLayout(new GridLayout());
63:                         
64:•                if(Platform.getOS().equalsIgnoreCase(Platform.OS_MACOSX)){
65:                         vdmPathMac = new DirectoryFieldEditor(ICskConstants.VSLGDE_PATH, "Path to VDM Tools for VDM-SL (vdmgde):", top);
66:                         vdmPathMac.setPage(this);
67:                         vdmPathMac.setPreferenceStore(getPreferenceStore());
68:                         vdmPathMac.load();
69:                         
70:                         vppPathMac = new DirectoryFieldEditor(ICskConstants.VPPGDE_PATH, "Path to VDM Tools for VDM-PP (vppgde):", top);
71:                         vppPathMac.setPage(this);
72:                         vppPathMac.setPreferenceStore(getPreferenceStore());
73:                         vppPathMac.load();
74:                         
75: //                        vicePathMac = new DirectoryFieldEditor(ICskConstants.VRTGDE_PATH, "Path to VDMTools for VICE (vicegde):", top);
76: //                        vicePathMac.setPage(this);
77: //                        vicePathMac.setPreferenceStore(getPreferenceStore());
78: //                        vicePathMac.load();
79:                         
80:                         Label listLabel = new Label(top, SWT.BOLD);
81:                         listLabel.setText("NOTE: select the \"bin\" folder just above \"vxxgde\"");
82:                 }
83:                 else
84:                 {
85:                         vdmPath = new FileFieldEditor(ICskConstants.VSLGDE_PATH, "Path to VDM Tools for VDM-SL (vdmgde):", top);
86:                         vdmPath.setPage(this);
87:                         vdmPath.setPreferenceStore(getPreferenceStore());
88:                         vdmPath.load();
89:                         
90:                         vppPath = new FileFieldEditor(ICskConstants.VPPGDE_PATH, "Path to VDM Tools for VDM-PP (vppgde):", top);
91:                         vppPath.setPage(this);
92:                         vppPath.setPreferenceStore(getPreferenceStore());
93:                         vppPath.load();
94:                         
95: //                        vicePath = new FileFieldEditor(ICskConstants.VRTGDE_PATH, "Path to VDMTools for VICE (vicegde):", top);
96: //                        vicePath.setPage(this);
97: //                        vicePath.setPreferenceStore(getPreferenceStore());
98: //                        vicePath.load();
99:                 }
100:                 
101:                 return top;
102:         }
103:         
104:         
105:
106: //        @Override
107: //        protected void createFieldEditors()
108: //        {
109: //                if (!Platform.getOS().equalsIgnoreCase(Platform.OS_MACOSX))
110: //                {
111: //                        addField(new FileFieldEditor(ICskConstants.VPPGDE_PATH, "Path to VDM Tools for VDM-PP (vppgde):", getFieldEditorParent()));
112: //                        addField(new FileFieldEditor(ICskConstants.VRTGDE_PATH, "Path to VDM Tools for VICE (vicegde):", getFieldEditorParent()));
113: //                        addField(new FileFieldEditor(ICskConstants.VSLGDE_PATH, "Path to VDM Tools for VDM-SL (vdmgde):", getFieldEditorParent()));
114: //                } else
115: //                {
116: //                        addField(new DirectoryFieldEditor(ICskConstants.VPPGDE_PATH, "Path to VDM Tools for VDM-PP (vppgde):", getFieldEditorParent()));
117: //                        addField(new DirectoryFieldEditor(ICskConstants.VRTGDE_PATH, "Path to VDM Tools for VICE (vicegde):", getFieldEditorParent()));
118: //                        addField(new DirectoryFieldEditor(ICskConstants.VSLGDE_PATH, "Path to VDM Tools for VDM-SL (vdmgde):", getFieldEditorParent()));
119: //                }
120: //        }
121:
122:         
123:         
124:         @Override
125:         protected IPreferenceStore doGetPreferenceStore()
126:         {
127:                 return Activator.getDefault().getPreferenceStore();
128:         }
129:
130:         @Override
131:         protected void performDefaults()
132:         {
133:•                if(Platform.getOS().equalsIgnoreCase(Platform.OS_MACOSX)){
134:                         vdmPathMac.loadDefault();
135:                         vppPathMac.loadDefault();
136:                         //vicePathMac.loadDefault();
137:                 }
138:                 else
139:                 {
140:                         vdmPath.loadDefault();
141:                         vppPath.loadDefault();
142:                         //vicePath.loadDefault();
143:                 }
144:                 IPreferenceStore store = getPreferenceStore();
145:                 store.setDefault(ICskConstants.VPPGDE_PATH, ICskConstants.DEFAULT_VPPGDE_PATH);
146:                 super.performDefaults();
147:         }
148:
149:
150:         @Override
151:         public boolean performOk() {
152:•                if(Platform.getOS().equalsIgnoreCase(Platform.OS_MACOSX)){
153:                         vdmPathMac.store();
154:                         vppPathMac.store();
155:                         //vicePathMac.store();
156:                 }
157:                 else
158:                 {
159:                         vdmPath.store();
160:                         vppPath.store();
161:                         //vicePath.store();
162:                 }
163:                 return super.performOk();
164:         }
165:
166:         public void init(IWorkbench workbench) {
167:                 // TODO Auto-generated method stub
168:                 
169:         }
170:
171:         
172:
173:
174:
175:         
176:
177: }