Package: VdmExternalEditorImpl

VdmExternalEditorImpl

nameinstructionbranchcomplexitylinemethod
VdmExternalEditorImpl()
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%
doSetInput(IEditorInput)
M: 54 C: 0
0%
M: 6 C: 0
0%
M: 5 C: 0
0%
M: 16 C: 0
0%
M: 1 C: 0
0%
getVdmSourceViewerConfiguration(IPreferenceStore)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
isPrefQuickDiffAlwaysOn()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * org.overture.ide.plugins.externaleditor
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.externaleditor;
23:
24: import org.eclipse.core.resources.IFile;
25: import org.eclipse.core.resources.IProject;
26: import org.eclipse.core.runtime.CoreException;
27: import org.eclipse.jface.preference.IPreferenceStore;
28: import org.eclipse.ui.IEditorInput;
29: import org.eclipse.ui.part.FileEditorInput;
30: import org.overture.ide.core.resources.IVdmProject;
31: import org.overture.ide.ui.editor.core.VdmExternalEditor;
32: import org.overture.ide.ui.editor.core.VdmSourceViewerConfiguration;
33: import org.overture.ide.vdmpp.ui.editor.core.VdmPpSourceViewerConfiguration;
34: import org.overture.ide.vdmrt.ui.editor.core.VdmRtSourceViewerConfiguration;
35: import org.overture.ide.vdmsl.ui.editor.core.VdmSlSourceViewerConfiguration;
36:
37: public class VdmExternalEditorImpl extends VdmExternalEditor
38: {
39:         @Override
40:         public VdmSourceViewerConfiguration getVdmSourceViewerConfiguration(IPreferenceStore preferenceStore)
41:         {
42:                 return new VdmSlSourceViewerConfiguration(preferenceStore);
43:         }
44:         
45:         
46:         @Override
47:         protected boolean isPrefQuickDiffAlwaysOn()
48:         {
49:                 return false;
50:         }
51:         
52:         @Override
53:         protected void doSetInput(IEditorInput input) throws CoreException
54:         {
55:
56:•                if (input instanceof FileEditorInput)
57:                 {
58:                         IFile file = ((FileEditorInput) input).getFile();
59:                         
60:                         IProject p =file.getProject();
61:                         
62:                         IVdmProject project = (IVdmProject) p.getAdapter(IVdmProject.class);
63:                         
64:                         VdmSourceViewerConfiguration config = null;
65:•                        switch (project.getDialect())
66:                         {
67:                                 case VDM_PP:
68:                                         config = new VdmPpSourceViewerConfiguration(getPreferenceStore());
69:                                         break;
70:                                 case VDM_RT:
71:                                         config = new VdmRtSourceViewerConfiguration(getPreferenceStore());
72:                                         break;
73:                                 case VDM_SL:
74:                                         config = new VdmSlSourceViewerConfiguration(getPreferenceStore());
75:                                         break;
76:                                 case CML:
77:                                         break;
78:                                 
79:                         }
80:                         super.fVdmSourceViewer = config;
81:                         super.setSourceViewerConfiguration(config);
82:                 }
83:                 
84:                 super.doSetInput(input);
85:         }
86: }