Package: WorkbenchPreferencePageMain

WorkbenchPreferencePageMain

nameinstructionbranchcomplexitylinemethod
WorkbenchPreferencePageMain()
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%
createFieldEditors()
M: 62 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%
createTraceReductionTypeCombo()
M: 74 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 12 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: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
performDefaults()
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * Combinatorial Testing
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.combinatorialtesting.preferences;
23:
24: import java.util.ArrayList;
25: import java.util.List;
26:
27: import org.eclipse.jface.preference.BooleanFieldEditor;
28: import org.eclipse.jface.preference.ComboFieldEditor;
29: import org.eclipse.jface.preference.FieldEditorPreferencePage;
30: import org.eclipse.jface.preference.IPreferenceStore;
31: import org.eclipse.jface.preference.IntegerFieldEditor;
32: import org.eclipse.jface.preference.StringFieldEditor;
33: import org.eclipse.ui.IWorkbench;
34: import org.eclipse.ui.IWorkbenchPreferencePage;
35: import org.overture.ide.debug.core.IDebugConstants;
36: import org.overture.ide.plugins.combinatorialtesting.ITracesConstants;
37: import org.overture.ide.plugins.combinatorialtesting.OvertureTracesPlugin;
38: import org.overture.interpreter.traces.TraceReductionType;
39:
40: public class WorkbenchPreferencePageMain extends FieldEditorPreferencePage
41:                 implements IWorkbenchPreferencePage
42: {
43:
44:         private ComboFieldEditor createTraceReductionTypeCombo()
45:         {
46:                 TraceReductionType[] values = TraceReductionType.values();
47:                 List<TraceReductionType> toShow = new ArrayList<TraceReductionType>();
48:
49:•                for (int i = 0; i < values.length; i++)
50:                 {
51:•                        if (values[i] != TraceReductionType.NONE)
52:                         {
53:                                 toShow.add(values[i]);
54:                         }
55:                 }
56:
57:                 final String[][] contents = new String[toShow.size()][1];
58:
59:•                for (int i = 0; i < toShow.size(); i++)
60:                 {
61:
62:                         TraceReductionType current = toShow.get(i);
63:                         contents[i] = new String[] { current.getDisplayName(),
64:                                         "" + current.ordinal() };
65:                 }
66:
67:                 final ComboFieldEditor traceReductionType = new ComboFieldEditor(ITracesConstants.TRACE_REDUCTION_TYPE, "Trace reduction type", contents, getFieldEditorParent());
68:
69:                 return traceReductionType;
70:         }
71:
72:         @Override
73:         protected void createFieldEditors()
74:         {
75:                 addField(new BooleanFieldEditor(ITracesConstants.REMOTE_DEBUG_PREFERENCE, "Enable remote debug", getFieldEditorParent()));
76:                 addField(new BooleanFieldEditor(ITracesConstants.REMOTE_DEBUG_FIXED_PORT, "Use fixed port for remote debug", getFieldEditorParent()));
77:
78:                 addField(createTraceReductionTypeCombo());
79:
80:                 IntegerFieldEditor traceFilteringSeed = new IntegerFieldEditor(ITracesConstants.TRACE_SEED, "Trace filtering seed", getFieldEditorParent());
81:                 traceFilteringSeed.setValidRange(Integer.MIN_VALUE, Integer.MAX_VALUE);
82:                 addField(traceFilteringSeed);
83:
84:                 IntegerFieldEditor subsetLimitation = new IntegerFieldEditor(ITracesConstants.TRACE_SUBSET_LIMITATION, "Subset limitation (%)", getFieldEditorParent());
85:                 subsetLimitation.setValidRange(1, 100);
86:                 addField(subsetLimitation);
87:                 
88:                 addField(new StringFieldEditor(IDebugConstants.VDM_LAUNCH_CONFIG_VM_MEMORY_OPTION, "Additional VM arguments:", getFieldEditorParent()));
89:         }
90:
91:         @Override
92:         protected IPreferenceStore doGetPreferenceStore()
93:         {
94:                 return OvertureTracesPlugin.getDefault().getPreferenceStore();
95:         }
96:
97:         @Override
98:         protected void performDefaults()
99:         {
100:                 super.performDefaults();
101:                 IPreferenceStore store = getPreferenceStore();
102:                 OvertureTracesPlugin.initializeDefaultMainPreferences(store);
103:         }
104:
105:         public void init(IWorkbench workbench)
106:         {
107:                 IPreferenceStore store = getPreferenceStore();
108:                 OvertureTracesPlugin.initializeDefaultMainPreferences(store);
109:         }
110:
111: }