Package: WorkbenchPreferencePageLatex

WorkbenchPreferencePageLatex

nameinstructionbranchcomplexitylinemethod
WorkbenchPreferencePageLatex()
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: 48 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 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: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
performDefaults()
M: 14 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * org.overture.ide.plugins.latex
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.latex.preference;
23:
24: import org.eclipse.core.runtime.Platform;
25: import org.eclipse.jface.preference.ComboFieldEditor;
26: import org.eclipse.jface.preference.FieldEditorPreferencePage;
27: import org.eclipse.jface.preference.FileFieldEditor;
28: import org.eclipse.jface.preference.IPreferenceStore;
29: import org.eclipse.swt.widgets.Composite;
30: import org.eclipse.ui.IWorkbench;
31: import org.eclipse.ui.IWorkbenchPreferencePage;
32: import org.overture.ide.plugins.latex.ILatexConstants;
33: import org.overture.ide.plugins.latex.LatexPlugin;
34:
35: public class WorkbenchPreferencePageLatex extends FieldEditorPreferencePage
36:                 implements IWorkbenchPreferencePage
37: {
38:         class MacFieldEditor extends FileFieldEditor
39:         {
40:                 public MacFieldEditor(String osxLatexPathPreference, String string,
41:                                 Composite fieldEditorParent)
42:                 {
43:                         super(osxLatexPathPreference, string, fieldEditorParent);
44:                 }
45:
46:                 @Override
47:                 protected boolean checkState()
48:                 {
49:                         if(Platform.getOS().equalsIgnoreCase(Platform.OS_MACOSX))
50:                                 return super.checkState();
51:                         
52:                         return true;
53:                 }
54:         }
55:         
56:         @Override
57:         protected void createFieldEditors()
58:         {
59:                 addField(new MacFieldEditor(ILatexConstants.OSX_LATEX_PATH_PREFERENCE, "MacOS Latex Path", getFieldEditorParent()));
60:                 addField(new ComboFieldEditor(ILatexConstants.PDF_BUILDER, "PDF Builder", new String[][] {
61:                                 new String[] { "PdfLaTex", ILatexConstants.DEFAULT_PDF_BUILDER },
62:                                 new String[] { "XeTex", "xetex" } }, getFieldEditorParent()));
63:         }
64:
65:         @Override
66:         protected IPreferenceStore doGetPreferenceStore()
67:         {
68:                 return LatexPlugin.getDefault().getPreferenceStore();
69:         }
70:
71:         @Override
72:         protected void performDefaults()
73:         {
74:                 IPreferenceStore store = getPreferenceStore();
75:                 store.setDefault(ILatexConstants.OSX_LATEX_PATH_PREFERENCE, ILatexConstants.DEFAULT_OSX_LATEX_PATH);
76:                 store.setDefault(ILatexConstants.PDF_BUILDER, ILatexConstants.DEFAULT_PDF_BUILDER);
77:                 
78:                 super.performDefaults();
79:         }
80:
81:         public void init(IWorkbench workbench)
82:         {
83:                 IPreferenceStore store = getPreferenceStore();
84:                 store.setDefault(ILatexConstants.OSX_LATEX_PATH_PREFERENCE, ILatexConstants.DEFAULT_OSX_LATEX_PATH);
85:                 store.setDefault(ILatexConstants.PDF_BUILDER, ILatexConstants.DEFAULT_PDF_BUILDER);
86:         }
87: }