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 CrossReferenceAdapter

java.lang.Object
  extended by org.eclipse.emf.ecore.util.ECrossReferenceAdapter
      extended by 
org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter
All Implemented Interfaces:
org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal

public class CrossReferenceAdapter
extends org.eclipse.emf.ecore.util.ECrossReferenceAdapter

An adapter that maintains itself as an adapter for all contained objects. It can be installed for an EObject, a Resource, or a ResourceSet.

This adapter maintain information on inverse references, resource imports, and resource exports.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.util.ECrossReferenceAdapter
org.eclipse.emf.ecore.util.ECrossReferenceAdapter.InverseCrossReferencer
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
 
Fields inherited from class org.eclipse.emf.ecore.util.ECrossReferenceAdapter
inverseCrossReferencer, unloadedEObjects, unloadedResources
 
Constructor Summary
CrossReferenceAdapter ()
          Initializes me.
CrossReferenceAdapter (boolean resolve)
          Initializes me.
 
Method Summary
protected  void exportAdded (org.eclipse.emf.ecore.resource.Resource referenced, org.eclipse.emf.ecore.resource.Resource referencer)
          Hook to be implemented by subclasses upon the establishment of a new export of the referenced resource to the referencer.
protected  void exportRemoved (org.eclipse.emf.ecore.resource.Resource referenced, org.eclipse.emf.ecore.resource.Resource referencer)
          Hook to be implemented by subclasses upon the elimination of an export of the referenced resource to the referencer.
static  CrossReferenceAdapter getCrossReferenceAdapter (org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Obtains the cross-reference adapter for the specified resource set, if necessary creating it and attaching it.
static  CrossReferenceAdapter getExistingCrossReferenceAdapter (org.eclipse.emf.common.notify.Notifier notifier)
          Searches the adapter list of the given Notifier for a CrossReferenceAdapter.
 java.util.Set getExports (org.eclipse.emf.ecore.resource.Resource referenced)
          Gets the exports of a resource.
 java.util.Set getImports (org.eclipse.emf.ecore.resource.Resource referencer)
          Gets the imports of a resource.
 java.util.Set getInverseReferencers (org.eclipse.emf.ecore.EObject referenced, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EClass type)
          Returns a Set of EObjects that reference the given EObject.
 java.util.Set getInverseReferencersCrossResource (org.eclipse.emf.ecore.EObject referenced, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EClass type)
          Like the getInverseReferencers(EObject, EReference, EClass) method, obtains referencing objects (optionally filtered by reference and type), except that it additionally only considers references that are changeable and can reference other resources.
 java.util.Collection getInverseReferences (org.eclipse.emf.ecore.EObject eObject, boolean _resolve)
           
 java.util.Collection getInverseReferencesCrossResource (org.eclipse.emf.ecore.EObject eObject)
          Like the ECrossReferenceAdapter.getInverseReferences(EObject) method, obtains settings implementing references to the specified object, except that it only considers references that are changeable and can reference other resources.
 java.util.Collection getInverseReferencesCrossResource (org.eclipse.emf.ecore.EObject eObject, boolean resolve)
          Like the getInverseReferences(EObject, boolean) method, obtains settings implementing references to the specified object, except that it only considers references that are changeable and can reference other resources.
 java.util.Set getNonNavigableInverseReferencers (org.eclipse.emf.ecore.EObject referenced, org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EClass type)
          Returns a Set of EObjects that reference the given EObject through a uni directional EReferences.
protected  void handleContainment (org.eclipse.emf.common.notify.Notification notification)
          Extends the superclass method to handle the removal cases of containment, to tear down aggregate (resource-level) cross-references.
protected  void importAdded (org.eclipse.emf.ecore.resource.Resource referencer, org.eclipse.emf.ecore.resource.Resource referenced)
          Hook to be implemented by subclasses upon the establishment of a new import of the referenced resource by the referencer.
protected  void importRemoved (org.eclipse.emf.ecore.resource.Resource referencer, org.eclipse.emf.ecore.resource.Resource referenced)
          Hook to be implemented by subclasses upon the elimination of an import of the referenced resource by the referencer.
protected  boolean isImportExportCapable (org.eclipse.emf.ecore.EReference reference, org.eclipse.emf.ecore.EObject owner)
          Queries whether the specified reference, applied to the given owner object, is capable of establishing a resource import or export by virtue of being a mutable cross-resource reference.
protected  boolean resolve ()
           
 void selfAdapt (org.eclipse.emf.common.notify.Notification notification)
          Updates imports and exports maps.
 void setTarget (org.eclipse.emf.common.notify.Notifier target)
           
 void unsetTarget (org.eclipse.emf.common.notify.Notifier notifier)
           
 void updateImportsAndExports (org.eclipse.emf.ecore.resource.Resource resource, org.eclipse.emf.ecore.EObject value, boolean register)
          Updates the imports and exports map for the specified eObject
 void updateImportsAndExportsForContents (org.eclipse.emf.ecore.resource.Resource resource, org.eclipse.emf.ecore.EObject value, boolean register)
          Updates the imports and exports map for the contents of the specified eObject
 
Methods inherited from class org.eclipse.emf.ecore.util.ECrossReferenceAdapter
addAdapter, createInverseCrossReferencer, dump, getCrossReferenceAdapter, getInverseReferences, getNonNavigableInverseReferences, getNonNavigableInverseReferences, getTarget, handleCrossReference, isAdapterForType, isIncluded, notifyChanged, removeAdapter, resolveAll, resolveProxy, setTarget, setTarget, setTarget, unsetTarget, unsetTarget, unsetTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CrossReferenceAdapter

public CrossReferenceAdapter()
Initializes me.


CrossReferenceAdapter

public CrossReferenceAdapter(boolean resolve)
Initializes me.

Parameters:
resolve - flag to determine if the proxies need to be resolved
Method Detail

selfAdapt

public void selfAdapt(org.eclipse.emf.common.notify.Notification notification)
Updates imports and exports maps.

Overrides:
selfAdapt in class org.eclipse.emf.ecore.util.ECrossReferenceAdapter
Parameters:
notification - the event notification

handleContainment

protected void handleContainment(org.eclipse.emf.common.notify.Notification notification)
Extends the superclass method to handle the removal cases of containment, to tear down aggregate (resource-level) cross-references.

Overrides:
handleContainment in class org.eclipse.emf.ecore.util.ECrossReferenceAdapter

updateImportsAndExports

public void updateImportsAndExports(org.eclipse.emf.ecore.resource.Resource resource,
                                    org.eclipse.emf.ecore.EObject value,
                                    boolean register)
Updates the imports and exports map for the specified eObject

Parameters:
resource - a resource
eObject - the specified eObject
register - boolean flag to indicate whether to register imports or unregister imports

updateImportsAndExportsForContents

public void updateImportsAndExportsForContents(org.eclipse.emf.ecore.resource.Resource resource,
                                               org.eclipse.emf.ecore.EObject value,
                                               boolean register)
Updates the imports and exports map for the contents of the specified eObject

Parameters:
resource - a resource
eObject - the specified eObject
register - boolean flag to indicate whether to register imports or unregister imports

setTarget

public void setTarget(org.eclipse.emf.common.notify.Notifier target)
Specified by:
setTarget in interface org.eclipse.emf.common.notify.Adapter
Overrides:
setTarget in class org.eclipse.emf.ecore.util.ECrossReferenceAdapter
See Also:
ECrossReferenceAdapter.setTarget(org.eclipse.emf.common.notify.Notifier)

unsetTarget

public void unsetTarget(org.eclipse.emf.common.notify.Notifier notifier)
Specified by:
unsetTarget in interface org.eclipse.emf.common.notify.Adapter.Internal
Overrides:
unsetTarget in class org.eclipse.emf.ecore.util.ECrossReferenceAdapter
See Also:
ECrossReferenceAdapter.unsetTarget(org.eclipse.emf.common.notify.Notifier)

getImports

public java.util.Set getImports(org.eclipse.emf.ecore.resource.Resource referencer)
Gets the imports of a resource.

Parameters:
referencer - the resource to retrieve imports for
Returns:
a Set of resource imports

getExports

public java.util.Set getExports(org.eclipse.emf.ecore.resource.Resource referenced)
Gets the exports of a resource.

Parameters:
referenced - the resource to retrieve exports for
Returns:
a Set of resource exports

importAdded

protected void importAdded(org.eclipse.emf.ecore.resource.Resource referencer,
                           org.eclipse.emf.ecore.resource.Resource referenced)
Hook to be implemented by subclasses upon the establishment of a new import of the referenced resource by the referencer. This implementation does nothing; subclasses need not call super.

Parameters:
referencer - the referencing resource (doing the importing)
referenced - the resource that it references

importRemoved

protected void importRemoved(org.eclipse.emf.ecore.resource.Resource referencer,
                             org.eclipse.emf.ecore.resource.Resource referenced)
Hook to be implemented by subclasses upon the elimination of an import of the referenced resource by the referencer. This implementation does nothing; subclasses need not call super.

Parameters:
referencer - the formerly referencing resource (doing the importing)
referenced - the resource that it had referenced

exportAdded

protected void exportAdded(org.eclipse.emf.ecore.resource.Resource referenced,
                           org.eclipse.emf.ecore.resource.Resource referencer)
Hook to be implemented by subclasses upon the establishment of a new export of the referenced resource to the referencer. This implementation does nothing; subclasses need not call super.

Parameters:
referenced - the resource being referenced (doing the exporting)
referencer - the referencing resource

exportRemoved

protected void exportRemoved(org.eclipse.emf.ecore.resource.Resource referenced,
                             org.eclipse.emf.ecore.resource.Resource referencer)
Hook to be implemented by subclasses upon the elimination of an export of the referenced resource to the referencer. This implementation does nothing; subclasses need not call super.

Parameters:
referenced - the resource formerly being referenced (doing the exporting)
referencer - the formerly referencing resource

getInverseReferencers

public java.util.Set getInverseReferencers(org.eclipse.emf.ecore.EObject referenced,
                                           org.eclipse.emf.ecore.EReference reference,
                                           org.eclipse.emf.ecore.EClass type)
Returns a Set of EObjects that reference the given EObject. If an EReference is specified, the scope of the search is limited only to that EReference. To include all references specify a value of null. If an EClass type is specified, the returned Set will only include those referencers that match the given type. To include all types specify a value of null.

Parameters:
referenced - the referenced EObject
reference - the reference to find referencers on, null for any reference
type - the type of the referencers, use null for any type
Returns:
a Set of referencers

getInverseReferencersCrossResource

public java.util.Set getInverseReferencersCrossResource(org.eclipse.emf.ecore.EObject referenced,
                                                        org.eclipse.emf.ecore.EReference reference,
                                                        org.eclipse.emf.ecore.EClass type)
Like the getInverseReferencers(EObject, EReference, EClass) method, obtains referencing objects (optionally filtered by reference and type), except that it additionally only considers references that are changeable and can reference other resources.

Parameters:
referenced - the referenced EObject
reference - the reference to find referencers on, null for any reference
type - the type of the referencers, use null for any type
Returns:
a Set of referencers on potentially cross-resource references

getInverseReferencesCrossResource

public java.util.Collection getInverseReferencesCrossResource(org.eclipse.emf.ecore.EObject eObject)
Like the ECrossReferenceAdapter.getInverseReferences(EObject) method, obtains settings implementing references to the specified object, except that it only considers references that are changeable and can reference other resources.

Parameters:
eObject - the referenced EObject
Returns:
a collection of EStructuralFeature.Settings on potentially cross-resource references

getNonNavigableInverseReferencers

public java.util.Set getNonNavigableInverseReferencers(org.eclipse.emf.ecore.EObject referenced,
                                                       org.eclipse.emf.ecore.EReference reference,
                                                       org.eclipse.emf.ecore.EClass type)
Returns a Set of EObjects that reference the given EObject through a uni directional EReferences. If an EReference is specified, the scope of the search is limited only to that EReference. To include all references specify a value of null. If an EClass type is specified, the returned Set will only include those referencers that match the given type. To include all types specify a value of null.

Parameters:
referenced - the referenced EObject
reference - the reference to find referencers on, null for any reference
type - the type of the referencers, use null for any type
Returns:
a Set of referencers

getExistingCrossReferenceAdapter

public static 
CrossReferenceAdapter getExistingCrossReferenceAdapter(org.eclipse.emf.common.notify.Notifier notifier)
Searches the adapter list of the given Notifier for a CrossReferenceAdapter. If not found, returns null.

Parameters:
notifier - the notifier to search
Returns:
the CrossReferenceAdapter if found, otherwise null

getCrossReferenceAdapter

public static 
CrossReferenceAdapter getCrossReferenceAdapter(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Obtains the cross-reference adapter for the specified resource set, if necessary creating it and attaching it.

Parameters:
resourceSet - the resource set
Returns:
the resourceSet's cross-reference adapter

resolve

protected boolean resolve()
Overrides:
resolve in class org.eclipse.emf.ecore.util.ECrossReferenceAdapter

getInverseReferences

public java.util.Collection getInverseReferences(org.eclipse.emf.ecore.EObject eObject,
                                                 boolean _resolve)
Overrides:
getInverseReferences in class org.eclipse.emf.ecore.util.ECrossReferenceAdapter

getInverseReferencesCrossResource

public java.util.Collection getInverseReferencesCrossResource(org.eclipse.emf.ecore.EObject eObject,
                                                              boolean resolve)
Like the getInverseReferences(EObject, boolean) method, obtains settings implementing references to the specified object, except that it only considers references that are changeable and can reference other resources.

Parameters:
eObject - the referenced EObject
resolve - whether to resolve proxies or not
Returns:
a collection of EStructuralFeature.Settings on potentially cross-resource references

isImportExportCapable

protected boolean isImportExportCapable(org.eclipse.emf.ecore.EReference reference,
                                        org.eclipse.emf.ecore.EObject owner)
Queries whether the specified reference, applied to the given owner object, is capable of establishing a resource import or export by virtue of being a mutable cross-resource reference.

A reference is considered to support resource imports and exports if all of the following apply:

  • the reference is not a container or containment reference. Note that this excludes cross-resource containment from registering as an import/export dependency
  • the reference resolves proxies
  • the reference is changeable

Parameters:
reference - a reference feature
owner - an object under consideration that defines this reference. Subclasses may need to introspect the object or its EClass to further refine their criteria
Returns:
true if this reference in the context of this owner should be counted for resource imports and exports; false, otherwise

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