Package: VdmBuilder

VdmBuilder

nameinstructionbranchcomplexitylinemethod
VdmBuilder()
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%
build(IProgressMonitor)
M: 45 C: 0
0%
M: 8 C: 0
0%
M: 5 C: 0
0%
M: 13 C: 0
0%
M: 1 C: 0
0%
clean(IProgressMonitor)
M: 71 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 13 C: 0
0%
M: 1 C: 0
0%
endBuild(IProgressMonitor)
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%
initialize()
M: 16 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * #%~
3: * org.overture.ide.core
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.core.builder;
23:
24: import org.eclipse.core.resources.IContainer;
25: import org.eclipse.core.resources.IResource;
26: import org.eclipse.core.resources.ResourcesPlugin;
27: import org.eclipse.core.runtime.CoreException;
28: import org.eclipse.core.runtime.IProgressMonitor;
29: import org.overture.ide.core.VdmCore;
30: import org.overture.ide.core.resources.IVdmProject;
31:
32: public class VdmBuilder extends VdmCoreBuilder
33: {
34:
35:         @SuppressWarnings("deprecation")
36:         @Override
37:         public void build(final IProgressMonitor monitor) throws CoreException
38:         {
39:•                if (VdmCore.DEBUG)
40:                 {
41:                         System.out.println("VdmBuilder.build: "+ getProject().getName());
42:                 }
43:                 try
44:                 {
45:                         final SafeBuilder builder = new SafeBuilder(getVdmProject(),monitor);
46:
47:                         builder.start();
48:•                        while (!builder.isInterrupted() && builder.isAlive())
49:                         {
50:•                                if (monitor.isCanceled())
51:                                 {
52:                                         builder.interrupt();
53:                                         Thread.sleep(2000);
54:                                         builder.stop();
55:                                 }
56:                                 Thread.sleep(10);
57:                         }
58:                 } catch (Exception e)
59:                 {
60:                         VdmCore.log(e);
61:                 }
62:
63:         }
64:
65:         public void clean(IProgressMonitor monitor)
66:         {
67:•                if (VdmCore.DEBUG)
68:                 {
69:                         System.out.println("VdmBuilder.clean: "+ getProject().getName());
70:                 }
71:                 monitor.beginTask("Cleaning project: " + getProject().getName(), IProgressMonitor.UNKNOWN);
72:
73:•                if (getProject().getAdapter(IVdmProject.class) != null)
74:                 {
75:                         SafeBuilder.clearProblemMarkers(getProject());
76:
77:                         // IMPORTANT we do not have an incremental builder so a full parse/
78:                         // build is required, therefore remove any
79:                         // AST nodes in store.
80:                         // clearInternalModel();
81:
82:                         try
83:                         {
84:                                 IVdmProject vdmProject = ((IVdmProject) getProject().getAdapter(IVdmProject.class));
85:•                                if (vdmProject != null)
86:                                 {
87:                                         IContainer container = vdmProject.getModelBuildPath().getOutput();
88:                                         ResourcesPlugin.getWorkspace().delete(new IResource[] { container }, true, monitor);
89:                                 }
90:
91:                         } catch (Exception e)
92:                         {
93:                                 VdmCore.log("Error cleaning project: " + getProject(), e);
94:                         }
95:                 }
96:                 monitor.done();
97:
98:         }
99:
100:         public void endBuild(IProgressMonitor monitor)
101:         {
102:         }
103:
104:         public void initialize()
105:         {
106:•                if (VdmCore.DEBUG)
107:                 {
108:                         System.out.println("VdmBuilder.initialize: "+ getProject().getName());
109:                 }
110:
111:                 syncProjectResources();
112:
113:         }
114:
115: }