Package: TracefileMarker

TracefileMarker

nameinstructionbranchcomplexitylinemethod
TracefileMarker(IFile)
M: 43 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 12 C: 0
0%
M: 1 C: 0
0%
addError(String, Integer)
M: 70 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 18 C: 0
0%
M: 1 C: 0
0%
addWarning(String, Integer)
M: 45 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%
dispose()
M: 23 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
errorCount()
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%
warningCount()
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%

Coverage

1: /*
2: * #%~
3: * RT Trace Viewer Plugin
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.rttraceviewer.view;
23:
24: import java.util.HashSet;
25: import java.util.Iterator;
26:
27: import org.eclipse.core.resources.IFile;
28: import org.eclipse.core.resources.IMarker;
29: import org.eclipse.core.resources.ResourcesPlugin;
30: import org.eclipse.core.runtime.CoreException;
31: import org.overture.ide.core.utility.FileUtility;
32: import org.overture.ide.plugins.rttraceviewer.TracefileViewerPlugin;
33:
34: @SuppressWarnings({"unchecked","rawtypes"})
35: public class TracefileMarker
36: {
37:         IFile file;
38:         private HashSet markers;
39:         private Long errors;
40:         private Long warnings;
41:
42:         public TracefileMarker(IFile file)
43:         {
44:                 this.file = file;
45:                 markers = new HashSet();
46:                 errors = null;
47:                 warnings = null;
48:                 try
49:                 {
50:                         markers = new HashSet();
51:                         errors = new Long(0L);
52:                         warnings = new Long(0L);
53:                 } catch (Exception e)
54:                 {
55:                         e.printStackTrace(System.out);
56:                         System.out.println(e.getMessage());
57:                 }
58:         }
59:
60:         public void addError(String var_1_1, Integer var_2_2)
61:         {
62:                 try
63:                 {
64:                         IMarker theMarker = null;
65:•                        if (file == null)
66:                         {
67:                                 theMarker = ResourcesPlugin.getWorkspace().getRoot().createMarker(IMarker.PROBLEM);
68:                                 theMarker.setAttribute(IMarker.MESSAGE, var_1_1);
69:•                                if (var_2_2 != null)
70:                                 {
71:                                         theMarker.setAttribute(IMarker.LINE_NUMBER, new Integer(var_2_2.intValue()+1));
72:                                 }
73:                                 theMarker.setAttribute(IMarker.SEVERITY, new Integer(2));
74:                                 theMarker.setAttribute(IMarker.SOURCE_ID, TracefileViewerPlugin.PLUGIN_ID);
75:                                 markers.add(theMarker);
76:                                 errors = Long.valueOf(errors.longValue() + 1L);
77:                         } else
78:                         {
79:                                 int lineNumber = 0;
80:•                                if (var_2_2 != null)
81:                                 {
82:                                         lineNumber = var_2_2;
83:                                 }
84:                                 FileUtility.addMarker(file, var_1_1, lineNumber, IMarker.SEVERITY_ERROR,TracefileViewerPlugin.PLUGIN_ID);
85:                         }
86:
87:                 } catch (CoreException ce)
88:                 {
89:                         ce.printStackTrace();
90:                 }
91:         }
92:
93:         public void addWarning(String var_1_1, Integer var_2_2)
94:         {
95:                 try
96:                 {
97:                         IMarker theMarker = ResourcesPlugin.getWorkspace().getRoot().createMarker(IMarker.PROBLEM);
98:                         theMarker.setAttribute(IMarker.MESSAGE, var_1_1);
99:•                        if (var_2_2 != null)
100:                         {
101:                                 theMarker.setAttribute(IMarker.LINE_NUMBER, new Integer(var_2_2.intValue()));
102:                         }
103:                         theMarker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
104:                         theMarker.setAttribute(IMarker.SOURCE_ID, TracefileViewerPlugin.PLUGIN_ID);
105:                         markers.add(theMarker);
106:                         warnings = Long.valueOf(warnings.longValue() + 1L);
107:                 } catch (CoreException ce)
108:                 {
109:                         ce.printStackTrace();
110:                 }
111:         }
112:
113:         public Long errorCount()
114:         {
115:                 return errors;
116:         }
117:
118:         public Long warningCount()
119:         {
120:                 return warnings;
121:         }
122:
123:         public void dispose()
124:         {
125:                 IMarker mark = null;
126:•                for (Iterator enum_6 = markers.iterator(); enum_6.hasNext();)
127:                 {
128:                         IMarker elem_2 = (IMarker) enum_6.next();
129:                         mark = elem_2;
130:                         try
131:                         {
132:                                 mark.delete();
133:                         } catch (CoreException ce)
134:                         {
135:                                 ce.printStackTrace();
136:                         }
137:                 }
138:
139:         }
140:
141:         
142:
143: }