Package: ResourceManager

ResourceManager

nameinstructionbranchcomplexitylinemethod
ResourceManager()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
initialize(Resource)
M: 0 C: 1
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
save(Resource)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2015 RCP Vision (http://www.rcp-vision.com) and others.
3: * All rights reserved. This program and the accompanying materials
4: * are made available under the terms of the Eclipse Public License v1.0
5: * which accompanies this distribution, and is available at
6: * http://www.eclipse.org/legal/epl-v10.html
7: *
8: * Contributors:
9: * Lorenzo Bettini - initial API and implementation
10: *******************************************************************************/
11: package org.eclipse.emf.parsley.resource;
12:
13: import java.io.IOException;
14:
15: import org.eclipse.emf.ecore.resource.Resource;
16:
17: /**
18: * ResourceManager is responsible for tasks concerning a {@link Resource}.
19: *
20: * @author Lorenzo Bettini - initial API and implementation
21: *
22: */
23: public class ResourceManager {
24:
25:         /**
26:          * This method is called by the framework when a loaded resource has to be
27:          * initialized; subclasses can redefine it in order to put some contents in
28:          * the empty resource.
29:          *
30:          * The default implementation is empty
31:          *
32:          * @param resource
33:          */
34:         public void initialize(Resource resource) {
35:                 // the default implementation does nothing
36:         }
37:
38:         /**
39:          * Saves the passed {@link Resource} and returns whether the resource
40:          * has been actually saved.
41:          *
42:          * @param resource
43:          * @return
44:          * @throws IOException
45:          */
46:         public boolean save(Resource resource) throws IOException {
47:                 resource.save(null);
48:                 return true;
49:         }
50: }