/
FreeBirdToolsResourceFactory.java
53 lines (42 loc) · 1.84 KB
/
FreeBirdToolsResourceFactory.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*******************************************************************************
* Copyright (c) 2020 Bird Software Solutions Ltd
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Neil Mackenzie - initial API and implementation
* */
package org.eclipse.efbt.cocamo.smcubes.component.importexport.impl;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;
import org.eclipse.xtext.resource.IResourceFactory;
/**
* @author Neil Mackenzie
*
*/
@SuppressWarnings("restriction")
public class FreeBirdToolsResourceFactory extends XMLResourceFactoryImpl implements IResourceFactory {
/**
* Creates an instance of the resource. we set the defaultSaveOptions
* and defaultLoadOptions also to be the sam as we use elsewhere.
*
*
*/
@Override
public Resource createResource(URI uri) {
XMLResource result = (XMLResource) super.createResource(uri);
result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
return result;
}
}