Skip to content

Commit

Permalink
Fix #34 and 35#.
Browse files Browse the repository at this point in the history
  • Loading branch information
fzalila committed Jul 26, 2018
1 parent 941b9a8 commit 6669fc9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,12 @@ private void generateEMFModels(Extension ext, IFile occieFile, String basePackag
importsAnnotation.setSource("http://www.eclipse.org/OCL/Import");
for(Extension importedExt : ext.getImport())
if(importedExt.getScheme().equals("http://schemas.ogf.org/occi/core#"))
importsAnnotation.getDetails().put("occi", Occi2Ecore.convertOcciScheme2EcoreNamespace(importedExt.getScheme()));
importsAnnotation.getDetails().put("occi", "platform:/plugin/org.eclipse.cmf.occi.core/model/OCCI.ecore#/");
else
importsAnnotation.getDetails().put(importedExt.getName(), Occi2Ecore.convertOcciScheme2EcoreNamespace(importedExt.getScheme()));
{
//System.out.println("imported extension file uri " + OcciRegistry.getInstance().getFileURI(importedExt.getScheme()).replace(".occie", ".ecore#/"));
importsAnnotation.getDetails().put(importedExt.getName(), OcciRegistry.getInstance().getFileURI(importedExt.getScheme()).replace(".occie", ".ecore#/"));
}
ePackage.getEAnnotations().add(importsAnnotation);

resourceSet.getPackageRegistry().put(ePackage.getNsURI(), ePackage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public static GenPackage createGenModel(final EPackage rootPackage, final String
"- Faiez Zalila <faiez.zalila@inria.fr>"
);
// Added to generate java code corresponding to OCL constraints defined in the OCCI extension
// GenAnnotation genannotation = GenModelFactory.eINSTANCE.createGenAnnotation();
// genannotation.setSource("http://www.eclipse.org/OCL/GenModel");
// genannotation.getDetails().put("Use Delegates", "false");
// genModel.getGenAnnotations().add(genannotation);
GenAnnotation genannotation = GenModelFactory.eINSTANCE.createGenAnnotation();
genannotation.setSource("http://www.eclipse.org/OCL/GenModel");
genannotation.getDetails().put("Use Delegates", "false");
genModel.getGenAnnotations().add(genannotation);

String modelPluginId = new Path(ecoreLocation).removeLastSegments(2).lastSegment().toString();
String editPluginId = modelPluginId + ".edit";
Expand All @@ -87,7 +87,7 @@ public static GenPackage createGenModel(final EPackage rootPackage, final String
GenPackage genPackage = genModel.getGenPackages().get(0);
genPackage.setPrefix(ConverterUtils.toU1Case(rootPackage.getNsPrefix()));
genPackage.setBasePackage(basePackage);
genPackage.setLoadInitialization(false);
//genPackage.setLoadInitialization(false);
URI genModelURI = URI
.createFileURI(new Path(ecoreLocation).removeFileExtension().addFileExtension("genmodel").toString());
final XMIResourceImpl genModelResource = new XMIResourceImpl(genModelURI);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,13 @@ private EDataType createNumericType(NumericType type) {
if (type.isSetTotalDigits())
eannotation.getDetails().put("totalDigits", Integer.toString(type.getTotalDigits()));
if (type.isSetMinInclusive())
eannotation.getDetails().put("MinInclusive", type.getMinInclusive());
eannotation.getDetails().put("minInclusive", type.getMinInclusive());
if (type.isSetMinExclusive())
eannotation.getDetails().put("MinExclusive", type.getMinExclusive());
eannotation.getDetails().put("minExclusive", type.getMinExclusive());
if (type.isSetMaxInclusive())
eannotation.getDetails().put("MaxInclusive", type.getMaxInclusive());
eannotation.getDetails().put("maxInclusive", type.getMaxInclusive());
if (type.isSetMaxExclusive())
eannotation.getDetails().put("MaxExclusive", type.getMaxExclusive());
eannotation.getDetails().put("maxExclusive", type.getMaxExclusive());
}
if (type.getDocumentation() != null) {
attachInfo(edatatype, type.getDocumentation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,8 @@ public static EObject getRootElement(ResourceSet resourceSet, String path) {

public static EObject getRootElement(ResourceSet resourceSet, IFile file) {
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
System.out.println("file " + file.getFullPath().toString());
System.out.println("uri " + uri);
//System.out.println("file " + file.getFullPath().toString());
//System.out.println("uri " + uri);
org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(uri, true);
EcoreUtil.resolveAll(resource);
return resource.getContents().get(0);
Expand Down

0 comments on commit 6669fc9

Please sign in to comment.