Package: VdmDebugModelPresentation

VdmDebugModelPresentation

nameinstructionbranchcomplexitylinemethod
VdmDebugModelPresentation()
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%
computeDetail(IValue, IValueDetailListener)
M: 25 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
getEditorId(IEditorInput, Object)
M: 39 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%
getEditorInput(Object)
M: 23 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
getText(Object)
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%
setAttribute(String, Object)
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%

Coverage

1: /*
2: * #%~
3: * org.overture.ide.debug
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.debug.ui.model;
23:
24: import org.eclipse.core.resources.IFile;
25: import org.eclipse.core.runtime.CoreException;
26: import org.eclipse.debug.core.DebugException;
27: import org.eclipse.debug.core.model.ILineBreakpoint;
28: import org.eclipse.debug.core.model.IValue;
29: import org.eclipse.debug.ui.IDebugModelPresentation;
30: import org.eclipse.debug.ui.IValueDetailListener;
31: import org.eclipse.jface.viewers.LabelProvider;
32: import org.eclipse.ui.IEditorInput;
33: import org.eclipse.ui.part.FileEditorInput;
34: import org.overture.ide.debug.core.model.internal.VdmValue;
35:
36: public class VdmDebugModelPresentation extends LabelProvider implements
37:                 IDebugModelPresentation
38: {
39:
40:         /*
41:          * (non-Javadoc)
42:          * @see org.eclipse.debug.ui.IDebugModelPresentation#computeDetail(org.eclipse.debug.core.model.IValue,
43:          * org.eclipse.debug.ui.IValueDetailListener)
44:          */
45:         public void computeDetail(IValue value, IValueDetailListener listener)
46:         {
47:                 String detail = "";
48:                 try
49:                 {
50:•                        if (value instanceof VdmValue)
51:                         {
52:                                 VdmValue vdmValue = (VdmValue) value;
53:                                 vdmValue.getVariables();
54:                                 detail = vdmValue.getRawValue();
55:                         } else
56:                         {
57:                                 detail = value.getValueString();
58:                         }
59:
60:                 } catch (DebugException e)
61:                 {
62:                 }
63:                 listener.detailComputed(value, detail);
64:         }
65:
66:         /*
67:          * (non-Javadoc)
68:          * @see org.eclipse.debug.ui.ISourcePresentation#getEditorId(org.eclipse.ui.IEditorInput, java.lang.Object)
69:          */
70:         public String getEditorId(IEditorInput input, Object element)
71:         {
72:•                if (element instanceof ILineBreakpoint)
73:                 {
74:                         ILineBreakpoint breakpoint = (ILineBreakpoint) element;
75:                         element = breakpoint.getMarker().getResource();
76:                 }
77:
78:•                if (element instanceof IFile)
79:                 {
80:                         IFile file = (IFile) element;
81:                         try
82:                         {
83:                                 String contentTypeId = file.getContentDescription().getContentType().getId();
84:•                                if (SourceViewerEditorManager.getInstance().getContentTypeIds().contains(contentTypeId))
85:                                 {
86:                                         return SourceViewerEditorManager.getInstance().getEditorId(contentTypeId);
87:                                 } else
88:                                 // TODO: it fixes the source lookup for wordDocs - not sure if this has other implications
89:                                 {
90:                                         return SourceViewerEditorManager.getInstance().getEditorId("org.overture.ide.vdm.external.content-type");
91:                                 }
92:                         } catch (CoreException e)
93:                         {
94:                                 // TODO Auto-generated catch block
95:                                 e.printStackTrace();
96:                         }
97:                         // return "org.overture.ide.vdmpp.ui.editor";
98:                 }
99:                 return null;
100:         }
101:
102:         public IEditorInput getEditorInput(Object element)
103:         {
104:•                if (element instanceof IFile)
105:                 {
106:                         return new FileEditorInput((IFile) element);
107:                 }
108:•                if (element instanceof ILineBreakpoint)
109:                 {
110:                         return new FileEditorInput((IFile) ((ILineBreakpoint) element).getMarker().getResource());
111:                 }
112:                 return null;
113:         }
114:
115:         public void setAttribute(String attribute, Object value)
116:         {
117:                 // TODO Auto-generated method stub
118:
119:         }
120:
121:         @Override
122:         public String getText(Object element)
123:         {
124:                 // TODO Auto-generated method stub
125:                 return null;
126:         }
127:
128: }