| Summary: | Inaccurate "If you need additional package registrations, do them here" | ||
|---|---|---|---|
| Product: | [Modeling] Acceleo | Reporter: | Ed Willink <ed> |
| Component: | Core | Assignee: | Project Inbox <acceleo-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | stephane.begaudeau |
| Version: | 3.0.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | |||
I have improved the documentation of the Java class generated by Acceleo to warn the users about the "@generated" tag and the goal of the "isInWorkspace" method.
On another note, I have seen in your code on our bugzilla that you have changed the previously invalid:
if (!isInWorkspace(org.eclipse.emf.ecore.impl.EPackageImpl.class)) {
resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.impl.EPackageImpl.eINSTANCE.getNsURI(),
org.eclipse.emf.ecore.impl.EPackageImpl.eINSTANCE);
}
to:
if (!isInWorkspace(org.eclipse.emf.ecore.impl.EPackageImpl.class)) {
resourceSet.getPackageRegistry().put("/org.eclipse.ocl.examples.pivot/model/pivot.ecore",
org.eclipse.ocl.examples.pivot.PivotPackage.eINSTANCE);
}
But it should be:
if (!isInWorkspace(org.eclipse.ocl.examples.pivot.PivotPackage.class)) {
resourceSet.getPackageRegistry().put("/org.eclipse.ocl.examples.pivot/model/pivot.ecore",
org.eclipse.ocl.examples.pivot.PivotPackage.eINSTANCE);
}
Or if you don't want the "isInWorkspace" check:
resourceSet.getPackageRegistry().put("/org.eclipse.ocl.examples.pivot/model/pivot.ecore",
org.eclipse.ocl.examples.pivot.PivotPackage.eINSTANCE);
The goal of "isInWorkspace" is to prevent the registration of a package currently in the workspace if this package is/will be also registered from a plugin.
(In reply to comment #1) > On another note, I have seen in your code on our bugzilla that you have changed > the previously invalid: Thanks. Yes, since I'm installing an alias for the mapping that the compiler uses but does not propagate to the standalone, the check is irrelevant. Fortunately the test was false. |
The generated public void registerPackages(ResourceSet resourceSet) { contains the instruction // TODO If you need additional package registrations, do them here. The following line is an example for UML. // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE); following these instructions by changing to // TODO If you need additional package registrations, do them here. The following line is an example for UML. // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE); if (!isInWorkspace(org.eclipse.emf.ecore.impl.EPackageImpl.class)) { resourceSet.getPackageRegistry().put("/org.eclipse.ocl.examples.pivot/model/pivot.ecore", org.eclipse.ocl.examples.pivot.PivotPackage.eINSTANCE); } works only until a regeneration. The instruction should mention to mark @generated NOT, or better still use the registerPackagesGen idiom (which works!).