Java 类org.eclipse.emf.ecore.EModelElement 实例源码
项目:OCCI-Studio
文件:ConverterUtils.java
public static void persistMetamodel(ResourceSet resourceSet, EPackage generated, String path) throws IOException {
if (new File(path).exists()) {
EPackage existing = (EPackage) OcciHelper.getRootElement(resourceSet, "file:/" + path);
for (Iterator<EObject> iterator = existing.eAllContents(); iterator.hasNext();) {
EObject eo = iterator.next();
if (eo instanceof EAnnotation && isOCLRelated((EAnnotation) eo)) {
EModelElement existingContainer = (EModelElement) eo.eContainer();
EModelElement generatedContainer = (EModelElement) getGeneratedElement(generated,
existingContainer);
if (generatedContainer == null) {
throw new RuntimeException("Unable to find " + existingContainer + " to reattach " + eo + " "
+ ((EAnnotation) eo).getEAnnotations());
} else {
generatedContainer.getEAnnotations().add((EAnnotation) EcoreUtil.copy(eo));
}
}
}
}
ConverterUtils.save(resourceSet, generated, "file:/" + path);
}
项目:NEXCORE-UML-Modeler
文件:LabelNodeEditPart.java
/**
* activate에서 등록한 어댑터를 삭제한다.
*
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#deactivate()
*/
@Override
public void deactivate() {
super.deactivate();
LabelNode node = (LabelNode) getModel();
if (node.getParent() != null) {
node.getParent().eAdapters().remove(this);
Element umlModel = ((AbstractView) node.getParent()).getUmlModel();
if (umlModel != null) {
umlModel.eAdapters().remove(this);
for (Stereotype stereotype : ((Element) umlModel).getAppliedStereotypes()) {
stereotype.eAdapters().remove(this);
}
for (EAnnotation annotation : ((EModelElement) umlModel).getEAnnotations()) {
annotation.eAdapters().remove(this);
}
}
}
}
项目:NEXCORE-UML-Modeler
文件:CompartmentLabelNodeEditPart.java
/**
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#activate()
*/
@Override
public void activate() {
super.activate();
LabelNode node = (LabelNode) getModel();
if (node.getParent() != null) {
node.getParent().eAdapters().add(this);
if (null == ((AbstractView) node.getParent()).getParent()) {
return;
}
((AbstractView) node.getParent()).getParent().eAdapters().add(this);
((AbstractView) node.getParent()).getUmlModel().eAdapters().add(this);
for (Stereotype stereotype : ((Element) ((AbstractView) node.getParent()).getUmlModel()).getAppliedStereotypes()) {
stereotype.eAdapters().add(this);
}
for (EAnnotation annotation : ((EModelElement) ((AbstractView) node.getParent()).getUmlModel()).getEAnnotations()) {
annotation.eAdapters().add(this);
}
}
}
项目:NEXCORE-UML-Modeler
文件:CompartmentLabelNodeEditPart.java
/**
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#deactivate()
*/
@Override
public void deactivate() {
super.deactivate();
LabelNode node = (LabelNode) getModel();
if (node.getParent() != null) {
node.getParent().eAdapters().remove(this);
((AbstractView) node.getParent()).getParent().eAdapters().remove(this);
((AbstractView) node.getParent()).getUmlModel().eAdapters().remove(this);
for (Stereotype stereotype : ((Element) ((AbstractView) node.getParent()).getUmlModel()).getAppliedStereotypes()) {
stereotype.eAdapters().remove(this);
}
for (EAnnotation annotation : ((EModelElement) ((AbstractView) node.getParent()).getUmlModel()).getEAnnotations()) {
annotation.eAdapters().remove(this);
}
}
}
项目:NEXCORE-UML-Modeler
文件:AbstractControlNodeEditPart.java
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#activate()
*/
public void activate() {
if (!isActive()) {
super.activate();
EObject model = (EObject) getModel();
model.eAdapters().add(this);
model = ((AbstractNode) getModel()).getUmlModel();
model.eAdapters().add(this);
model = ((AbstractNode) getModel()).getUmlModel();
for (Stereotype stereotype : ((Element) model).getAppliedStereotypes()) {
stereotype.eAdapters().add(this);
}
model = ((AbstractNode) getModel()).getUmlModel();
for (EAnnotation annotation : ((EModelElement) model).getEAnnotations()) {
annotation.eAdapters().add(this);
}
}
}
项目:NEXCORE-UML-Modeler
文件:AbstractControlNodeEditPart.java
/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#deactivate()
*/
public void deactivate() {
if (isActive()) {
super.deactivate();
EObject model = (EObject) getModel();
model.eAdapters().remove(this);
model = ((AbstractNode) getModel()).getUmlModel();
model.eAdapters().remove(this);
model = ((AbstractNode) getModel()).getUmlModel();
for (Stereotype stereotype : ((Element) model).getAppliedStereotypes()) {
stereotype.eAdapters().remove(this);
}
model = ((AbstractNode) getModel()).getUmlModel();
for (EAnnotation annotation : ((EModelElement) model).getEAnnotations()) {
annotation.eAdapters().remove(this);
}
}
}
项目:NEXCORE-UML-Modeler
文件:AbstractPropertySectionWithAdapter.java
/**
* 모델에서 어답터를 제거함 void
*/
protected void deactivate() {
if (null == this.selectedModel) {
return;
}
if (this.selectedModel.eAdapters().contains(this)) {
this.selectedModel.eAdapters().remove(this);
}
for (Stereotype stereotype : ((Element) selectedModel).getAppliedStereotypes()) {
stereotype.eAdapters().remove(this);
}
for (EAnnotation annotation : ((EModelElement) selectedModel).getEAnnotations()) {
annotation.eAdapters().remove(this);
}
if (selectedModel instanceof InteractionConstraint) {
InteractionConstraint constraint = (InteractionConstraint) selectedModel;
OpaqueExpression expression = (OpaqueExpression) constraint.getSpecification();
expression.eAdapters().remove(this);
}
}
项目:OpenSPIFe
文件:EMFTreeTableUtils.java
protected static int getColumnWidth(EObject eObject, final IItemPropertyDescriptor descriptor) {
int columnWidth = 100;
Object feature = descriptor.getFeature(eObject);
if (feature instanceof EModelElement) {
EModelElement element = (EModelElement) feature;
String valueString = EMFUtils.getAnnotation(element, ANNOTATION_SOURCE_TABLE, ANNOTATION_DETAIL_COLUMN_WIDTH);
if (valueString != null) {
try {
columnWidth = Integer.parseInt(valueString);
} catch (Exception e) {
LogUtil.error("cannot parse '"+valueString+"' for "+element);
}
}
}
return columnWidth;
}
项目:anatlyzer
文件:AtlTransformationMapping.java
private void computeMappings() {
this.mappings = new ArrayList<ITransformationMapping.MetamodelElementMapping>();
this.srcUses = new HashSet<EModelElement>();
this.tgtUses = new HashSet<EModelElement>();
List<RuleWithPattern> rules = analysis.getATLModel().allObjectsOf(RuleWithPattern.class);
for (RuleWithPattern r : rules) {
InPatternElement src = r.getInPattern().getElements().get(0);
for (OutPatternElement ope : r.getOutPattern().getElements()) {
Metaclass srcType = (Metaclass) src.getInferredType();
Metaclass tgtType = (Metaclass) ope.getInferredType();
addMapping(mappings, r, srcType.getKlass(), tgtType.getKlass());
}
}
}
项目:eclipse-avro
文件:EcoreUtil.java
public static void setDocumentation(EModelElement eModelElement, String documentation)
{
EAnnotation eAnnotation = eModelElement.getEAnnotation(GEN_MODEL_PACKAGE_NS_URI);
if (documentation == null)
{
if (eAnnotation != null)
{
eAnnotation.getDetails().removeKey("documentation");
}
}
else
{
if (eAnnotation == null)
{
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(GEN_MODEL_PACKAGE_NS_URI);
eModelElement.getEAnnotations().add(eAnnotation);
}
eAnnotation.getDetails().put("documentation", documentation);
}
}
项目:eclipse-avro
文件:EcoreUtil.java
public static List<String> getConstraints(EModelElement eModelElement)
{
EAnnotation eAnnotation = eModelElement.getEAnnotation(EcorePackage.eNS_URI);
if (eAnnotation != null)
{
String constraints = eAnnotation.getDetails().get("constraints");
if (constraints != null)
{
List<String> result = new ArrayList<String>();
for (StringTokenizer stringTokenizer = new StringTokenizer(constraints); stringTokenizer.hasMoreTokens();)
{
String constraint = stringTokenizer.nextToken();
result.add(constraint);
}
return result;
}
}
return Collections.emptyList();
}
项目:eclipse-avro
文件:EcoreUtil.java
public static void setAnnotation(EModelElement eModelElement, String sourceURI, String key, String value)
{
EAnnotation eAnnotation = eModelElement.getEAnnotation(sourceURI);
if (value == null)
{
if (eAnnotation != null)
{
eAnnotation.getDetails().removeKey(key);
}
}
else
{
if (eAnnotation == null)
{
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(sourceURI);
eModelElement.getEAnnotations().add(eAnnotation);
}
eAnnotation.getDetails().put(key, value);
}
}
项目:eclipse-avro
文件:EAnnotationImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEModelElement(EModelElement newEModelElement)
{
if (newEModelElement != eInternalContainer() || (eContainerFeatureID() != EcorePackage.EANNOTATION__EMODEL_ELEMENT && newEModelElement != null))
{
if (EcoreUtil.isAncestor(this, newEModelElement))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newEModelElement != null)
msgs = ((InternalEObject)newEModelElement).eInverseAdd(this, EcorePackage.EMODEL_ELEMENT__EANNOTATIONS, EModelElement.class, msgs);
msgs = basicSetEModelElement(newEModelElement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EANNOTATION__EMODEL_ELEMENT, newEModelElement, newEModelElement));
}
项目:eclipse-avro
文件:EAnnotationImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case EcorePackage.EANNOTATION__EANNOTATIONS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getEAnnotations()).basicAdd(otherEnd, msgs);
case EcorePackage.EANNOTATION__EMODEL_ELEMENT:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetEModelElement((EModelElement)otherEnd, msgs);
}
return eDynamicInverseAdd(otherEnd, featureID, msgs);
}
项目:clickwatch
文件:EcoreUtil.java
public static void setDocumentation(EModelElement eModelElement, String documentation)
{
EAnnotation eAnnotation = eModelElement.getEAnnotation(GEN_MODEL_PACKAGE_NS_URI);
if (documentation == null)
{
if (eAnnotation != null)
{
eAnnotation.getDetails().remove("documentation");
}
}
else
{
if (eAnnotation == null)
{
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(GEN_MODEL_PACKAGE_NS_URI);
eModelElement.getEAnnotations().add(eAnnotation);
}
eAnnotation.getDetails().put("documentation", documentation);
}
}
项目:clickwatch
文件:EcoreUtil.java
public static List<String> getConstraints(EModelElement eModelElement)
{
EAnnotation eAnnotation = eModelElement.getEAnnotation(EcorePackage.eNS_URI);
if (eAnnotation != null)
{
String constraints = eAnnotation.getDetails().get("constraints");
if (constraints != null)
{
List<String> result = new ArrayList<String>();
for (StringTokenizer stringTokenizer = new StringTokenizer(constraints); stringTokenizer.hasMoreTokens();)
{
String constraint = stringTokenizer.nextToken();
result.add(constraint);
}
return result;
}
}
return Collections.emptyList();
}
项目:clickwatch
文件:EAnnotationImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setEModelElement(EModelElement newEModelElement)
{
if (newEModelElement != eInternalContainer() || (eContainerFeatureID() != EcorePackage.EANNOTATION__EMODEL_ELEMENT && newEModelElement != null))
{
if (EcoreUtil.isAncestor(this, newEModelElement))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newEModelElement != null)
msgs = ((InternalEObject)newEModelElement).eInverseAdd(this, EcorePackage.EMODEL_ELEMENT__EANNOTATIONS, EModelElement.class, msgs);
msgs = basicSetEModelElement(newEModelElement, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EcorePackage.EANNOTATION__EMODEL_ELEMENT, newEModelElement, newEModelElement));
}
项目:clickwatch
文件:EAnnotationImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case EcorePackage.EANNOTATION__EANNOTATIONS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getEAnnotations()).basicAdd(otherEnd, msgs);
case EcorePackage.EANNOTATION__EMODEL_ELEMENT:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetEModelElement((EModelElement)otherEnd, msgs);
}
return eDynamicInverseAdd(otherEnd, featureID, msgs);
}
项目:mappingtools
文件:MergeModelsAction.java
/**
* keep appending to the documentation of the first model element
* @param firstEl
* @param secondEl
*/
private void appendDocumentation(EModelElement firstEl,EModelElement secondEl)
{
EAnnotation firstAnn = firstEl.getEAnnotation(ModelUtil.genModelURI());
String firstDoc = null;
if (firstAnn != null) firstDoc = firstAnn.getDetails().get("documentation");
EAnnotation secondAnn = secondEl.getEAnnotation(ModelUtil.genModelURI());
String secondDoc = null;
if (secondAnn != null) secondDoc = secondAnn.getDetails().get("documentation");
// append documentation strings if they are both non-null
String fullDoc = null;
if (firstDoc == null) fullDoc = secondDoc;
if (secondDoc == null) fullDoc = firstDoc;
if ((firstDoc != null) && (secondDoc != null)) fullDoc = firstDoc + secondDoc;
if (fullDoc != null) firstEl.getEAnnotation(ModelUtil.genModelURI()).getDetails().put("documentation",fullDoc);
}
项目:mappingtools
文件:MakeITSMappingsAction.java
/**
*
* @param mappedEobject
* @param docString
*/
private void addDocumentation(EModelElement mappedEobject,String docString)
{
EAnnotation ann = mappedEobject.getEAnnotation(javaDocURI);
// if this is the first documentation for this class or feature, add it with the preface defining the message
if (ann == null)
{
ann = EcoreFactory.eINSTANCE.createEAnnotation();
ann.setSource(javaDocURI);
ann.getDetails().put(javaDocKey, docPreface() + docString);
mappedEobject.getEAnnotations().add(ann);
}
// append any subsequent documentation on the same class or feature
else if (ann != null)
{
String previousDoc = ann.getDetails().get(javaDocKey);
String newDoc = previousDoc + docString;
ann.getDetails().put(javaDocKey, newDoc);
}
}
项目:mappingtools
文件:ModelUtil.java
/**
* copy an ECore annotation from one object to another -
* maybe overwriting the values of existing annotations with the same
* source and the same key
* @param toObject
* @param note
*/
public static void copyAnnotation(EModelElement toObject, EAnnotation note)
{
String source = note.getSource();
// if the target does not have an annotation with this source, make one
EAnnotation existing = toObject.getEAnnotation(source);
if (existing == null)
{
existing = EcoreFactory.eINSTANCE.createEAnnotation();
existing.setSource(source);
toObject.getEAnnotations().add(existing);
}
// transfer values for all keys, overwriting if values already exist
for (Iterator<String> it = note.getDetails().keySet().iterator();it.hasNext();)
{
String key = it.next();
existing.getDetails().put(key, note.getDetails().get(key));
}
}
项目:Tarski
文件:MarkHandler.java
private void createMarker() {
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
file = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getActiveEditor().getEditorInput().getAdapter(IFile.class);
selection =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
final IMarker beAdded = getMarker();
@SuppressWarnings("unused")
String text = "";
if (selection instanceof ITextSelection) {
if (beAdded != null && beAdded.exists()) {
text = ((ITextSelection) selection).getText();
AnnotationFactory.addAnnotation(beAdded, AnnotationFactory.ANNOTATION_MARKING);
}
} else if (selection instanceof ITreeSelection) {
if (editor instanceof EcoreEditor) {
final ITreeSelection treeSelection = (ITreeSelection) selection;
if (beAdded != null && beAdded.exists()) {
if (treeSelection.getFirstElement() instanceof EModelElement) {
text = ((ENamedElement) treeSelection.getFirstElement()).getName();
} else {
text = MarkUtilities.getText(beAdded);
}
}
}
}
addToAlloyXML(beAdded);
// MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark Information",
// null,
// "\"" + text + "\" has been selected to be marked", MessageDialog.INFORMATION,
// new String[] {"OK"}, 0);
// dialog.open();
}
项目:Tarski
文件:EcoreUtilities.java
/**
* Loads EMF Metamodel via given @URI
*
* @param uri Metamodel's @URI
* @return List of @EModelElement
* @throws IOException
*/
public static List<EModelElement> loadMetaModel(final URI uri) throws IOException {
List<EModelElement> list = null;
try {
final ModelIO<EModelElement> modelIO = new ModelIO<>();
list = modelIO.read(uri);
} catch (final Exception e) {
return null;
}
return list;
}
项目:Tarski
文件:EcoreUtilities.java
/**
* Loads EMF Metamodel via given path
*
* @param anyPath
* @return root @EObject
* @throws IOException
*/
public static List<EModelElement> loadMetaModel(final String anyPath) throws IOException {
List<EModelElement> elems =
EcoreUtilities.loadMetaModel(URI.createPlatformResourceURI(anyPath, true));
if (elems == null) {
elems = EcoreUtilities.loadMetaModel(URI.createFileURI(anyPath));
if (elems == null) {
elems = EcoreUtilities.loadMetaModel(URI.createPlatformPluginURI(anyPath, true));
if (elems == null) {
elems = EcoreUtilities.loadMetaModel(URI.createURI(anyPath));
}
}
}
return elems;
}
项目:OCCI-Studio
文件:OCCIExtension2Ecore.java
private void attachInfo(EModelElement element, String value) {
EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();
annotation.setSource("http://www.eclipse.org/emf/2002/GenModel");
element.getEAnnotations().add(annotation);
if (value != null)
annotation.getDetails().put("documentation", value);
else
annotation.getDetails().put("documentation", "");
}
项目:codegen-ecore
文件:EcoreCodeGeneratorCheckStateProvider.java
private boolean hasSelectedChildren(Object element) {
for (Object child: contentProvider.getChildren(element)) {
ModelElement modelElement = eCoreCodeGeneratorWritableValue.getValue().find((EModelElement) child, false);
if (modelElement != null && modelElement.isSelected()) {
return true;
}
if (hasSelectedChildren(child)) {
return true;
}
}
return false;
}
项目:codegen-ecore
文件:EcoreCodeGeneratorCheckStateProvider.java
private boolean hasUnselectedChildren(Object element) {
for (Object child: contentProvider.getChildren(element)) {
ModelElement modelElement = eCoreCodeGeneratorWritableValue.getValue().find((EModelElement) child, false);
if (modelElement == null || !modelElement.isSelected()) {
return true;
}
if (hasUnselectedChildren(child)) {
return true;
}
}
return false;
}
项目:codegen-ecore
文件:EcoreCodeGeneratorCheckStateProvider.java
private boolean isSelfOrParentSelected(Object element) {
EcoreCodeGenerator eCoreCodeGenerator = eCoreCodeGeneratorWritableValue.getValue();
if (eCoreCodeGenerator.isSelected() || element == eCoreCodeGenerator || element == null) {
return eCoreCodeGenerator.isSelected();
}
if (element instanceof EModelElement) {
ModelElement modelElement = eCoreCodeGenerator.find((EModelElement) element, false);
if (modelElement != null && modelElement.isSelected()) {
return true;
}
}
return isSelfOrParentSelected(contentProvider.getParent(element));
}
项目:codegen-ecore
文件:EcoreCodegenForm.java
private boolean isSupportedByGenerationTargets(EModelElement modelElement) {
for (GenerationTarget generationTarget: generationTargets) {
if (generationTarget.isSupported(modelElement)) {
return true;
}
}
return false;
}
项目:codegen-ecore
文件:ModelElementImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case EcorePackage.MODEL_ELEMENT___FIND__EMODELELEMENT_BOOLEAN:
return find((EModelElement)arguments.get(0), (Boolean)arguments.get(1));
case EcorePackage.MODEL_ELEMENT___GET_CONFIGURATION__STRING:
return getConfiguration((String)arguments.get(0));
}
return super.eInvoke(operationID, arguments);
}
项目:codegen-ecore
文件:EcoreCodeGeneratorImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public boolean isSelected(EModelElement eModelElement) {
if (isSelected()) {
// Selected if contained in one of packages
return EcoreUtil.isAncestor(getEPackages(), eModelElement);
}
ModelElement me = find(eModelElement, false);
if (me != null && me.isSelected()) {
return true;
}
TreeIterator<EObject> cit = eModelElement.eAllContents();
while (cit.hasNext()) {
EObject next = cit.next();
if (next instanceof EModelElement) {
me = find((EModelElement) next, false);
if (me != null && me.isSelected()) {
return true;
}
}
}
for (EObject container = eModelElement.eContainer(); container instanceof EModelElement; container = container.eContainer()) {
me = find((EModelElement) container, false);
if (me != null && me.isSelected()) {
return true;
}
}
return false;
}
项目:codegen-ecore
文件:EcoreCodeGeneratorImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public Map<String, EObject> getConfiguration(EModelElement eModelElement) {
if (isSelected(eModelElement)) {
Map<String, EObject> ret = new HashMap<>();
ModelElement me = find(eModelElement, false);
if (me != null) {
for (ConfigurationEntry ce: me.getConfiguration()) {
ret.put(ce.getId(), ce.getConfiguration());
}
}
return ret;
}
return null;
}
项目:codegen-ecore
文件:EcoreCodeGeneratorImpl.java
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case EcorePackage.ECORE_CODE_GENERATOR___GET_EPACKAGES:
return getEPackages();
case EcorePackage.ECORE_CODE_GENERATOR___IS_SELECTED__EMODELELEMENT:
return isSelected((EModelElement)arguments.get(0));
case EcorePackage.ECORE_CODE_GENERATOR___GET_CONFIGURATION__EMODELELEMENT:
return getConfiguration((EModelElement)arguments.get(0));
}
return super.eInvoke(operationID, arguments);
}
项目:NEXCORE-UML-Modeler
文件:LabelNodeEditPart.java
/**
* @see nexcore.tool.uml.ui.core.diagram.edit.part.AbstractNotationNodeEditPart#activate()
*/
@Override
public void activate() {
super.activate();
// 현재 뷰모델에 어댑터 등록
LabelNode node = (LabelNode) getModel();
if (node.getParent() != null) {
node.getParent().eAdapters().add(this);
// 현재 뷰모델의 UML 모델에도 어댑터 등록
Element umlModel = ((AbstractView) node.getParent()).getUmlModel();
if (umlModel != null) {
umlModel.eAdapters().add(this);
// 현재 UML 모델의 Stereotyp과 annotation에 어댑터 등록
// annotation 안에 keyword가 존재한다.
for (Stereotype stereotype : ((Element) umlModel).getAppliedStereotypes()) {
stereotype.eAdapters().add(this);
}
for (EAnnotation annotation : ((EModelElement) umlModel).getEAnnotations()) {
annotation.eAdapters().add(this);
}
}
}
}
项目:SecureBPMN
文件:PropertiesLabelProvider.java
/**
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
*/
@Override
public String getText(Object objects) {
if (objects == null || objects.equals(StructuredSelection.EMPTY)) {
return "No items selected";//$NON-NLS-1$
}
final boolean multiple[] = { false };
Object object = getObject(objects, multiple);
if (object == null || ((IStructuredSelection) objects).size() > 1) {
return ((IStructuredSelection) objects).size() + " items selected";//$NON-NLS-1$
} else {
if (object instanceof EditPart) {
object = ((EditPart) object).getModel();
}
if (object instanceof EObject) {
EObject robj = (EObject) object;
if (robj instanceof PictogramElement) {
PictogramElement pe = (PictogramElement) robj;
EObject businessObject = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
if (businessObject == null) {
businessObject = robj;
}
// return the name of the MetamodelClass
EObject refMetaObject = businessObject.eClass();
if (refMetaObject instanceof ENamedElement) {
return ((ENamedElement) refMetaObject).getName();
}
return ""; // no luck //$NON-NLS-1$
} else {
return "" + ((EModelElement) robj.eClass()).getClass().getName(); //$NON-NLS-1$
}
} else {
return object.toString();
}
}
}
项目:OpenSPIFe
文件:EMFUtils.java
public static void addAnnotation(EModelElement eNamedElement, String source, String... details) {
EAnnotation eAnnotation = eNamedElement.getEAnnotation(source);
if (eAnnotation == null) {
eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(source);
eNamedElement.getEAnnotations().add(eAnnotation);
}
EMap<String, String> theDetails = eAnnotation.getDetails();
for (int i = 1; i < details.length; i += 2) {
theDetails.put(details[i - 1], details[i]);
}
}
项目:OpenSPIFe
文件:EMFUtils.java
public static String getAnnotation(EModelElement eNamedElement, String source, String key) {
if (eNamedElement != null) {
EAnnotation annotation = eNamedElement.getEAnnotation(source);
if (annotation != null) {
return annotation.getDetails().get(key);
}
}
return null;
}
项目:OpenSPIFe
文件:AbstractPlanTimelineBuilder.java
private static Boolean parseBoolean(EModelElement element, String source, String key, Boolean defaultValue) {
String string = EMFUtils.getAnnotation(element, source, key);
if (string == null) {
return defaultValue;
}
return Boolean.valueOf(string);
}
项目:OpenSPIFe
文件:EMFTreeTableUtils.java
/**
* Check the visibility of the annotation WRT the annotations, there is a lot of capability repeated here acros
* the details, ParameterDescritpor, etc, which we should clean up an unify
* @param feature
* @return
*/
private static boolean isVisible(Object feature) {
if (feature instanceof EModelElement) {
EModelElement modelElement = (EModelElement) feature;
String valueString = EMFUtils.getAnnotation(modelElement, ANNOTATION_SOURCE_TABLE, "visible"); // TODO: Move ParameterDescriptor to core
if (valueString != null && valueString.equalsIgnoreCase("FALSE")) {
return false;
}
}
return true;
}
项目:anatlyzer
文件:MetamodelInvariantsExtension.java
public static EAnnotation getOclAnnotation(EModelElement c) {
EAnnotation ann = c.getEAnnotation("http://www.eclipse.org/emf/2002/Ecore/OCL");
if ( ann == null ) {
ann = c.getEAnnotation("http://www.eclipse.org/ocl/examples/OCL");
if ( ann == null ) {
ann = c.getEAnnotation("http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot");
}
}
return ann;
}