Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
846 additions
and
54 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
edelta.parent/edelta.example/edelta-gen/edelta/ExampleAccessNotYetExistingElements.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package edelta; | ||
|
||
import edelta.lib.AbstractEdelta; | ||
import org.eclipse.emf.common.util.EList; | ||
import org.eclipse.emf.ecore.EClass; | ||
import org.eclipse.emf.ecore.EPackage; | ||
|
||
@SuppressWarnings("all") | ||
public class ExampleAccessNotYetExistingElements extends AbstractEdelta { | ||
public ExampleAccessNotYetExistingElements() { | ||
|
||
} | ||
|
||
public ExampleAccessNotYetExistingElements(final AbstractEdelta other) { | ||
super(other); | ||
} | ||
|
||
public void creation(final EPackage it) { | ||
this.lib.addNewEClass(it, "NewClass"); | ||
EList<EClass> _eSuperTypes = getEClass("myecore", "NewClass").getESuperTypes(); | ||
_eSuperTypes.add(getEClass("myecore", "MyEClass")); | ||
} | ||
|
||
public void anotherCreation(final EPackage it) { | ||
this.lib.addNewEClass(it, "AnotherNewClass"); | ||
EList<EClass> _eSuperTypes = getEClass("myecore", "AnotherNewClass").getESuperTypes(); | ||
_eSuperTypes.add(getEClass("myecore", "MyEClass")); | ||
} | ||
|
||
@Override | ||
public void performSanityChecks() throws Exception { | ||
ensureEPackageIsLoaded("ecore"); | ||
ensureEPackageIsLoaded("myecore"); | ||
} | ||
|
||
@Override | ||
protected void doExecute() throws Exception { | ||
creation(getEPackage("myecore")); | ||
anotherCreation(getEPackage("myecore")); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
edelta.parent/edelta.example/src/ExampleAccessNotYetExistingElements.edelta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
|
||
// IMPORTANT: ecores must be in source directories | ||
// otherwise you can't refer to them | ||
metamodel "ecore" | ||
metamodel "myecore" | ||
|
||
modifyEcore creation epackage myecore { | ||
// uncomment to see the error: Element not yet available in this context: myecore.NewClass | ||
// not that you can still navigate to the creation expression | ||
|
||
// ecoreref(NewClass).abstract = true | ||
// ecoreref(AnotherNewClass).abstract = true | ||
|
||
addNewEClass("NewClass") | ||
ecoreref(NewClass).ESuperTypes += ecoreref(MyEClass) | ||
} | ||
|
||
modifyEcore anotherCreation epackage myecore { | ||
addNewEClass("AnotherNewClass") | ||
ecoreref(AnotherNewClass).ESuperTypes += ecoreref(MyEClass) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.