|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gmf.runtime.diagram.core.util.ViewUtil
public class ViewUtil
provides different utility functions for the notation view
Field Summary | |
---|---|
static int |
APPEND
the append index, this is the index you should use to append a view to a container |
Constructor Summary | |
---|---|
ViewUtil()
|
Method Summary | |
---|---|
static void |
destroy(View view)
Destroys the supplied view notational element and remove any references this class may have to it. |
static java.util.Set<Edge> |
getAllInnerEdges(View view)
|
static void |
getAllRelatedEdgesForView(View view,
java.util.Set<Edge> allEdges)
Constructs a set of all source and target edges from a view and all its children down to the leaves of a view hierarchy |
static void |
getAllRelatedEdgesFromViews(java.util.List views,
java.util.HashSet<Edge> allEdges)
Constructs a set of all source and target edges from a list of view and all their children down to the leaves of a view hierarchy |
static View |
getChildByIdStr(View view,
java.lang.String idStr)
returns the first child whose id matched the given id |
static View |
getChildBySemanticHint(View view,
java.lang.String semanticHint)
gets a the first child in the passed View that had the
same type as the passed semantic hint. |
static View |
getContainerView(View eObject)
Returns the container view, or null if the container is not a view or null |
static java.lang.String |
getIdStr(View view)
returns the unique GUID of the view |
static java.lang.Object |
getPropertyValue(View view,
org.eclipse.emf.ecore.EStructuralFeature feature,
org.eclipse.emf.ecore.EClass featureClass)
Returns the value of the featrue inside a specific EClass within the passed view |
static java.lang.Object |
getPropertyValue(View view,
java.lang.Object id)
Deprecated. use getStructuralFeatureValue(View, EStructuralFeature)
instead |
static java.lang.String |
getSemanticEClassName(View view)
return eClass Name of the view's semantic element, this method works only if the semantic element is a NameElement, otherwise it will return an Empty String |
static java.lang.String |
getSemanticElementClassId(View view)
gets the View 's semantic element Class Id, this could be
used to check the semantic element type |
static java.util.List |
getSourceConnections(View view)
gets all the Edge 's whose source is this view |
static java.util.List |
getSourceConnectionsConnectingVisibleViews(View view)
gets all the Edge 's whose source is this view |
static java.lang.Object |
getStructuralFeatureValue(View view,
org.eclipse.emf.ecore.EStructuralFeature feature)
Returns the value of the passed feature inside the passed view |
static java.util.List |
getTargetConnections(View view)
gets all the Edge 's whose target is this view |
static java.util.List |
getTargetConnectionsConnectingVisibleViews(View view)
gets all the Edge 's whose target is this view |
static View |
getTopViewToPersist(View view)
Returns the top view that should be persisted, starting from the passed view, it could return the passed view itself if it is a transient view, other wise it will check its parent and so on ... |
static View |
getViewContainer(org.eclipse.emf.ecore.EObject obj)
Goes up through the containers of the passed in EObject
and returns the first container that is a View |
static void |
insertChildView(View containerView,
View childView,
int index,
boolean persisted)
inserts a child View in a container. the view will be
inserted in the persisted collection if the persisted flag is
true; otherwise it will be added to the transied collection. |
static boolean |
isFeatureSupported(View view,
org.eclipse.emf.ecore.EStructuralFeature feature)
checks if the passed feature is supported by the passed view |
static boolean |
isPropertySupported(View view,
org.eclipse.emf.ecore.EStructuralFeature feature,
org.eclipse.emf.ecore.EClass featureClass)
checks if the passed feature is supported by the passed view |
static boolean |
isPropertySupported(View view,
java.lang.Object id)
checks if the passed property is supported bythe passed view |
static boolean |
isTransient(org.eclipse.emf.ecore.EObject view)
checks if the passed view is transient or exists in a transient branch |
static java.util.List |
makeViewsAdaptable(java.util.Collection views)
create a list of View Adapters from a Notation View collection |
static void |
persistElement(View view)
move the supplied view from, and all of its parents from the transient collections to the persisted collections. |
static void |
repositionChildAt(View container,
View child,
int newIndex)
reorders the child at the oldIndex to the newIndex |
static org.eclipse.emf.ecore.EObject |
resolve(org.eclipse.emf.ecore.EObject object)
resolves the passed element, and returns it. |
static org.eclipse.emf.ecore.EObject |
resolveSemanticElement(View view)
resolves the passed View |
static void |
setPropertyValue(View view,
org.eclipse.emf.ecore.EStructuralFeature feature,
org.eclipse.emf.ecore.EClass featureClass,
java.lang.Object value)
Sets the passed featrue on the passed EClass inside the passed view to the new value if possible |
static void |
setPropertyValue(View view,
java.lang.Object id,
java.lang.Object value)
Deprecated. use ViewUtil#setStructuralFeatureValue(View, EStructuralFeature, Object }
instead |
static void |
setStructuralFeatureValue(View view,
org.eclipse.emf.ecore.EStructuralFeature feature,
java.lang.Object value)
Sets the passed feature if possible on the passed view to the passed value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int APPEND
Constructor Detail |
---|
public ViewUtil()
Method Detail |
---|
public static java.util.List makeViewsAdaptable(java.util.Collection views)
views
- a collection of Notation View
s
EObjectAdapter
spublic static void persistElement(View view)
view
- the View
to persistpublic static View getTopViewToPersist(View view)
view
- ,
view to start from
public static void destroy(View view)
view
- view to destroypublic static View getContainerView(View eObject)
eObject
- a notation view
View
public static void insertChildView(View containerView, View childView, int index, boolean persisted)
View
in a container. the view will be
inserted in the persisted collection if the persisted flag is
true; otherwise it will be added to the transied collection.
inserting a transient child does not dirty the model, inserting a
persisted child will dirty the model
containerView
- the view's containerchildView
- notation View
to insertindex
- the view's position within the container's listpersisted
- indicats the persisted state of the viewpublic static boolean isTransient(org.eclipse.emf.ecore.EObject view)
view
- View
to check
public static View getChildBySemanticHint(View view, java.lang.String semanticHint)
View
that had the
same type as the passed semantic hint.
view
- the view to search insidesemanticHint
- the semantic hint to look for
public static boolean isPropertySupported(View view, java.lang.Object id)
view
- the view to use for the searchid
- the property to look for
public static boolean isFeatureSupported(View view, org.eclipse.emf.ecore.EStructuralFeature feature)
view
- the view to use for the searchfeature
- the feature to look for
public static boolean isPropertySupported(View view, org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.emf.ecore.EClass featureClass)
view
- the view to use for the searchfeature
- the feature to look forfeatureClass
- the feature's EClass
public static final java.lang.Object getStructuralFeatureValue(View view, org.eclipse.emf.ecore.EStructuralFeature feature)
view
- the view to use to get the valuefeature
- the feature to use
null
public static java.lang.Object getPropertyValue(View view, org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.emf.ecore.EClass featureClass)
view
- the view to use to get the valuefeature
- the featrue to use to get the valuefeatureClass
- the EClass
to use to get the feature
null
public static void setStructuralFeatureValue(View view, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.Object value)
view
- the view to set the value onfeature
- the feature to usevalue
- the value of the property being setpublic static void setPropertyValue(View view, org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.emf.ecore.EClass featureClass, java.lang.Object value)
view
- the view to set the value onfeature
- the feature to setfeatureClass
- EClass
that owns the featurevalue
- the value of the feature being setpublic static org.eclipse.emf.ecore.EObject resolveSemanticElement(View view)
View's semantic element, and returns it.
If the semantic element is unresolvable the method will returns null
- Parameters:
view
- the view to use to get the semantic element
- Returns:
- the semanticelement or null if there is no semantic element or if it is unresolvable
public static org.eclipse.emf.ecore.EObject resolve(org.eclipse.emf.ecore.EObject object)
null
the
- element to resolve
public static java.lang.String getSemanticElementClassId(View view)
View
's semantic element Class Id, this could be
used to check the semantic element type
view
- the owner of the semantic element
public static java.util.List getSourceConnections(View view)
Edge
's whose source is this view
view
- the view to use
public static java.util.List getTargetConnections(View view)
Edge
's whose target is this view
view
- the view to use
public static java.util.List getSourceConnectionsConnectingVisibleViews(View view)
Edge
's whose source is this view
view
- the view to use
public static java.util.List getTargetConnectionsConnectingVisibleViews(View view)
Edge
's whose target is this view
view
- the view to use
public static java.lang.String getSemanticEClassName(View view)
view
- the view object
public static java.lang.String getIdStr(View view)
view
- the view
public static void repositionChildAt(View container, View child, int newIndex)
container
- the view's containerchild
- the child to repositionnewIndex
- (zero-based)
java.lang.IndexOutOfBoundsException
- if index is out of bounds
java.lang.IllegalArgumentException
- if the child is not contianed by the container, or if the new
position is the ViewUtil.APPEND
positionpublic static View getChildByIdStr(View view, java.lang.String idStr)
view
- the view to search inidStr
- the child's id
public static void setPropertyValue(View view, java.lang.Object id, java.lang.Object value)
ViewUtil#setStructuralFeatureValue(View, EStructuralFeature, Object
}
instead
view
- the view to set the value onid
- the id of the property being setvalue
- the value of the property being setpublic static final java.lang.Object getPropertyValue(View view, java.lang.Object id)
getStructuralFeatureValue(View, EStructuralFeature)
instead
view
- the view to use to get the valueid
- the id of the property to get
null
public static View getViewContainer(org.eclipse.emf.ecore.EObject obj)
EObject
and returns the first container that is a View
obj
- the EObject
View
container of the objectpublic static void getAllRelatedEdgesForView(View view, java.util.Set<Edge> allEdges)
view
- allEdges
- public static void getAllRelatedEdgesFromViews(java.util.List views, java.util.HashSet<Edge> allEdges)
views
- allEdges
- public static java.util.Set<Edge> getAllInnerEdges(View view)
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.