Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Runtime

org.eclipse.gmf.runtime.emf.core.util
Class EMFCoreUtil

java.lang.Object
  extended by 
org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil

public class EMFCoreUtil
extends java.lang.Object

Static utilities for working with EMF objects and resources in the GMF environment.


Constructor Summary
EMFCoreUtil ()
           
 
Method Summary
static org.eclipse.emf.ecore.EObject create (org.eclipse.emf.ecore.EObject container, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EClass eClass)
          Creates an object at a given containment reference whose EClass is eClass.
static org.eclipse.emf.ecore.EObject createProxy (org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.common.util.URI uri)
          Creates a proxy of the specified type with the specified proxy URI.
static org.eclipse.emf.ecore.EObject getContainer (org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EClass eClass)
          Gets the first container with the specified EClass.
static java.util.Collection getExports (org.eclipse.emf.ecore.resource.Resource resource)
          Gets the exports of a resource.
static java.util.Collection getImports (org.eclipse.emf.ecore.resource.Resource resource)
          Gets the imports of a resource.
static org.eclipse.emf.ecore.EObject getLeastCommonContainer (java.util.Collection objects, org.eclipse.emf.ecore.EClass desiredContainerType)
          Finds the first common container of a collection of objects.
static java.lang.String getName (org.eclipse.emf.ecore.EObject eObject)
          Gets the name of an object if the object has name, returns an empty string otherwise.
static org.eclipse.emf.ecore.EClass getProxyClass (org.eclipse.emf.ecore.EObject proxy)
          Gets the proxy class by parsing the proxy URI.
static java.lang.String getProxyID (org.eclipse.emf.ecore.EObject proxy)
          Gets the proxy ID by parsing the proxy URI.
static java.lang.String getQualifiedName (org.eclipse.emf.ecore.EObject eObject, boolean formatted)
          Gets the fully qualified name of an object.
static java.util.Collection getReferencers (org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.ecore.EReference[] features)
          Uses a reverse reference map that is maintained by the MSL service to find all referencers of a particular element.
static java.util.Collection getTransitiveExports (org.eclipse.emf.ecore.resource.Resource resource)
          Gets the transitive closure of the exports of a resource.
static java.util.Collection getTransitiveImports (org.eclipse.emf.ecore.resource.Resource resource)
          Gets the transitive closure of the imports of a resource.
static org.eclipse.emf.ecore.EObject resolve (org.eclipse.emf.transaction.TransactionalEditingDomain domain, org.eclipse.emf.ecore.EObject proxy)
          Attempts to resolve the specified proxy object, returning null (rather than the original proxy) if it is unresolvable.
static void setName (org.eclipse.emf.ecore.EObject eObject, java.lang.String name)
          Sets the name of an object if the object can be assigned a name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EMFCoreUtil

public EMFCoreUtil()
Method Detail

create

public static org.eclipse.emf.ecore.EObject create(org.eclipse.emf.ecore.EObject container,
                                                   org.eclipse.emf.ecore.EReference reference,
                                                   org.eclipse.emf.ecore.EClass eClass)
Creates an object at a given containment reference whose EClass is eClass.

Parameters:
container - The container of the new object.
reference - The feature containing the object.
eClass - The EClass.
Returns:
The new EObject.

getContainer

public static org.eclipse.emf.ecore.EObject getContainer(org.eclipse.emf.ecore.EObject eObject,
                                                         org.eclipse.emf.ecore.EClass eClass)
Gets the first container with the specified EClass.

Parameters:
eObject - The EObject.
eClass - The eClass.
Returns:
The container.

getLeastCommonContainer

public static org.eclipse.emf.ecore.EObject getLeastCommonContainer(java.util.Collection objects,
                                                                    org.eclipse.emf.ecore.EClass desiredContainerType)
Finds the first common container of a collection of objects.

Parameters:
objects - The EObjects.
desiredContainerType - The desired EClass of the container.
Returns:
The least common container.

getReferencers

public static java.util.Collection getReferencers(org.eclipse.emf.ecore.EObject eObject,
                                                  org.eclipse.emf.ecore.EReference[] features)
Uses a reverse reference map that is maintained by the MSL service to find all referencers of a particular element. The search can be narrowed down by passing the list of Reference features to match. features can be null.

Parameters:
eObject - The referenced object.
features - The reference features.
Returns:
The collection of referencers.

getImports

public static java.util.Collection getImports(org.eclipse.emf.ecore.resource.Resource resource)
Gets the imports of a resource. These are the resources to which this resource has references.

Parameters:
resource - a resource.
Returns:
the imports of the resource

getExports

public static java.util.Collection getExports(org.eclipse.emf.ecore.resource.Resource resource)
Gets the exports of a resource. These are the resources that have references to the resource.

Parameters:
resource - a resource.
Returns:
the exports of the resource

getTransitiveImports

public static java.util.Collection getTransitiveImports(org.eclipse.emf.ecore.resource.Resource resource)
Gets the transitive closure of the imports of a resource. This obtains those resources that import the resource, the resources that import those, etc.

Parameters:
resource - a resource.
Returns:
the transitive imports of the resource

getTransitiveExports

public static java.util.Collection getTransitiveExports(org.eclipse.emf.ecore.resource.Resource resource)
Gets the transitive closure of the exports of a resource. This obtains those resources that export the resource, the resources that export those, etc.

Parameters:
resource - a resource.
Returns:
the transitive exports of the resource

getName

public static java.lang.String getName(org.eclipse.emf.ecore.EObject eObject)
Gets the name of an object if the object has name, returns an empty string otherwise.

Parameters:
eObject - The object.
Returns:
The object's name.

setName

public static void setName(org.eclipse.emf.ecore.EObject eObject,
                           java.lang.String name)
Sets the name of an object if the object can be assigned a name.

Parameters:
eObject - The object.
name - The object's new name.
Throws:
java.lang.IllegalArgumentException - if the eObject does not have a name attribute

getQualifiedName

public static java.lang.String getQualifiedName(org.eclipse.emf.ecore.EObject eObject,
                                                boolean formatted)
Gets the fully qualified name of an object.

Parameters:
eObject - The object.
formatted - if True, unnamed parents will be listed using their meta-class name.
Returns:
The object's qualified name.

getProxyID

public static java.lang.String getProxyID(org.eclipse.emf.ecore.EObject proxy)
Gets the proxy ID by parsing the proxy URI.

Parameters:
proxy - The proxy object.
Returns:
The ID.

getProxyClass

public static org.eclipse.emf.ecore.EClass getProxyClass(org.eclipse.emf.ecore.EObject proxy)
Gets the proxy class by parsing the proxy URI.

Parameters:
proxy - The proxy object.
Returns:
The class.

createProxy

public static org.eclipse.emf.ecore.EObject createProxy(org.eclipse.emf.ecore.EClass eClass,
                                                        org.eclipse.emf.common.util.URI uri)
Creates a proxy of the specified type with the specified proxy URI.

Parameters:
classID - The type of proxy to create.
uri - The URI for the new proxy.
Returns:
The new proxy.

resolve

public static org.eclipse.emf.ecore.EObject resolve(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
                                                    org.eclipse.emf.ecore.EObject proxy)
Attempts to resolve the specified proxy object, returning null (rather than the original proxy) if it is unresolvable.

Parameters:
domain - Th editing domain.
proxy - The proxy object.
Returns:
The resolved object, or null if not resolved

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire