net.sf.nakeduml.emf.workspace.EmfWorkspace Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of metamodel Show documentation
Show all versions of metamodel Show documentation
A uml code generator and execution engine
The newest version!
package net.sf.nakeduml.emf.workspace;
import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.sf.nakeduml.metamodel.mapping.internal.WorkspaceMappingInfoImpl;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.DirectedRelationship;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.Relationship;
import org.eclipse.uml2.uml.Stereotype;
/**
* Represents the concept of multiple emf models as one root workspace. Hacked
* to implement Element because of visitor constraints
*
*/
public class EmfWorkspace implements Element {
Set generatingModels = new HashSet();
Set supportingModels = new HashSet();
Package entryModel;
private WorkspaceMappingInfoImpl mappingInfo;
public EmfWorkspace(Package model, WorkspaceMappingInfoImpl mappingInfo) {
this.entryModel = model;
addGeneratingModelOrProfile(model);
this.mappingInfo = mappingInfo;
}
public WorkspaceMappingInfoImpl getMappingInfo() {
return mappingInfo;
}
public Set getGeneratingModelsOrProfiles() {
return this.generatingModels;
}
public Package getEntryModel() {
return this.entryModel;
}
public void setEntryModel(Package p) {
this.entryModel = p;
}
public boolean isGeneratingModelOrProfile(Package p) {
return generatingModels.contains(p);
}
public void addGeneratingModelOrProfile(Package p) {
generatingModels.add(p);
}
public void addSupportingModelOrPackage(Package p) {
supportingModels.add(p);
}
public EList getOwnedElements() {
final EList result = new BasicEList();
for (Resource r : entryModel.eResource().getResourceSet().getResources()) {
Package pkg = getPackageFrom(r);
String fileString = r.getURI().toString();
if (!fileString.contains("UML_METAMODELS") && pkg != null) {
result.add(pkg);
}
}
return result;
}
public Package getPackageFrom(Resource r) {
for (EObject o : r.getContents()) {
if (o instanceof Package) {
return (Package) o;
}
}
return null;
}
public boolean addKeyword(String arg0) {
return false;
}
public EList allOwnedElements() {
return getOwnedElements();
}
public EObject applyStereotype(Stereotype arg0) {
return null;
}
public EAnnotation createEAnnotation(String arg0) {
return null;
}
public Comment createOwnedComment() {
return null;
}
public void destroy() {
}
public Stereotype getApplicableStereotype(String arg0) {
return null;
}
public EList getApplicableStereotypes() {
return null;
}
public Stereotype getAppliedStereotype(String arg0) {
return null;
}
public EList getAppliedStereotypes() {
return null;
}
public Stereotype getAppliedSubstereotype(Stereotype arg0, String arg1) {
return null;
}
public EList getAppliedSubstereotypes(Stereotype arg0) {
return null;
}
public EList getKeywords() {
return null;
}
public Model getModel() {
return null;
}
public Package getNearestPackage() {
return null;
}
public EList getOwnedComments() {
return null;
}
public Element getOwner() {
return null;
}
public EList getRelationships() {
return null;
}
public EList getRelationships(EClass arg0) {
return null;
}
public Stereotype getRequiredStereotype(String arg0) {
return null;
}
public EList getRequiredStereotypes() {
return null;
}
public EList getSourceDirectedRelationships() {
return null;
}
public EList getSourceDirectedRelationships(EClass arg0) {
return null;
}
public EObject getStereotypeApplication(Stereotype arg0) {
return null;
}
public EList getStereotypeApplications() {
return null;
}
public EList getTargetDirectedRelationships() {
return null;
}
public EList getTargetDirectedRelationships(EClass arg0) {
return null;
}
public Object getValue(Stereotype arg0, String arg1) {
return null;
}
public boolean hasKeyword(String arg0) {
return false;
}
public boolean hasValue(Stereotype arg0, String arg1) {
return false;
}
public boolean isStereotypeApplicable(Stereotype arg0) {
return false;
}
public boolean isStereotypeApplied(Stereotype arg0) {
return false;
}
public boolean isStereotypeRequired(Stereotype arg0) {
return false;
}
public boolean mustBeOwned() {
return false;
}
public boolean removeKeyword(String arg0) {
return false;
}
public void setValue(Stereotype arg0, String arg1, Object arg2) {
}
public EObject unapplyStereotype(Stereotype arg0) {
return null;
}
public boolean validateHasOwner(DiagnosticChain arg0, Map