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.diagram.core.util
Class ViewUtil

java.lang.Object
  extended by 
org.eclipse.gmf.runtime.diagram.core.util.ViewUtil

public class ViewUtil
extends java.lang.Object

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's semantic element, and returns it.
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

APPEND

public static final int APPEND
the append index, this is the index you should use to append a view to a container

See Also:
Constant Field Values
Constructor Detail

ViewUtil

public ViewUtil()
Method Detail

makeViewsAdaptable

public static java.util.List makeViewsAdaptable(java.util.Collection views)
create a list of View Adapters from a Notation View collection

Parameters:
views - a collection of Notation Views
Returns:
list of EObjectAdapters

persistElement

public static void persistElement(
View view)
move the supplied view from, and all of its parents from the transient collections to the persisted collections. This Api will modify the model and make it dirty, it needs to run within a write action or unchecked operation. A view will get persisted if the following conditions are met
  • this method is invoked inside an UNDO interval
  • the supplied view is in a transient list or owned by a transient container

Parameters:
view - the View to persist

getTopViewToPersist

public 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 ...

Parameters:
view - , view to start from
Returns:
first view needs to get persisted

destroy

public static void destroy(
View view)
Destroys the supplied view notational element and remove any references this class may have to it.

Parameters:
view - view to destroy

getContainerView

public static 
View getContainerView(
View eObject)
Returns the container view, or null if the container is not a view or null

Parameters:
eObject - a notation view
Returns:
the container View

insertChildView

public 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. inserting a transient child does not dirty the model, inserting a persisted child will dirty the model

Parameters:
containerView - the view's container
childView - notation View to insert
index - the view's position within the container's list
persisted - indicats the persisted state of the view

isTransient

public static boolean isTransient(org.eclipse.emf.ecore.EObject view)
checks if the passed view is transient or exists in a transient branch

Parameters:
view - View to check
Returns:
true if transient otherwise false

getChildBySemanticHint

public 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.

Parameters:
view - the view to search inside
semanticHint - the semantic hint to look for
Returns:
the found view or null if none is found

isPropertySupported

public static boolean isPropertySupported(
View view,
                                          java.lang.Object id)
checks if the passed property is supported bythe passed view

Parameters:
view - the view to use for the search
id - the property to look for
Returns:
boolean true if supported otherwise false

isFeatureSupported

public static boolean isFeatureSupported(
View view,
                                         org.eclipse.emf.ecore.EStructuralFeature feature)
checks if the passed feature is supported by the passed view

Parameters:
view - the view to use for the search
feature - the feature to look for
Returns:
boolean true if supported otherwise false

isPropertySupported

public 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

Parameters:
view - the view to use for the search
feature - the feature to look for
featureClass - the feature's EClass
Returns:
boolean true if supported otherwise false

getStructuralFeatureValue

public static final java.lang.Object getStructuralFeatureValue(
View view,
                                                               org.eclipse.emf.ecore.EStructuralFeature feature)
Returns the value of the passed feature inside the passed view

Parameters:
view - the view to use to get the value
feature - the feature to use
Returns:
the value of the property, or null

getPropertyValue

public 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

Parameters:
view - the view to use to get the value
feature - the featrue to use to get the value
featureClass - the EClass to use to get the feature
Returns:
the value of the feature, or null

setStructuralFeatureValue

public 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.

Parameters:
view - the view to set the value on
feature - the feature to use
value - the value of the property being set

setPropertyValue

public 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

Parameters:
view - the view to set the value on
feature - the feature to set
featureClass - EClass that owns the feature
value - the value of the feature being set

resolveSemanticElement

public static org.eclipse.emf.ecore.EObject resolveSemanticElement(
View view)
resolves the passed 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

resolve

public static org.eclipse.emf.ecore.EObject resolve(org.eclipse.emf.ecore.EObject object)
resolves the passed element, and returns it. If the element is unresolvable the method will returns null

Parameters:
the - element to resolve
Returns:
the element or null if it is unresolvable

getSemanticElementClassId

public 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

Parameters:
view - the owner of the semantic element
Returns:
the semantic element class Id

getSourceConnections

public static java.util.List getSourceConnections(
View view)
gets all the Edge's whose source is this view

Parameters:
view - the view to use
Returns:
List the edges list

getTargetConnections

public static java.util.List getTargetConnections(
View view)
gets all the Edge's whose target is this view

Parameters:
view - the view to use
Returns:
List the edges list

getSourceConnectionsConnectingVisibleViews

public static java.util.List getSourceConnectionsConnectingVisibleViews(
View view)
gets all the Edge's whose source is this view

Parameters:
view - the view to use
Returns:
List the edges list

getTargetConnectionsConnectingVisibleViews

public static java.util.List getTargetConnectionsConnectingVisibleViews(
View view)
gets all the Edge's whose target is this view

Parameters:
view - the view to use
Returns:
List the edges list

getSemanticEClassName

public 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

Parameters:
view - the view object
Returns:
the eClass name

getIdStr

public static java.lang.String getIdStr(
View view)
returns the unique GUID of the view

Parameters:
view - the view
Returns:
String the GUID of a view (constant)

repositionChildAt

public static void repositionChildAt(
View container,
                                     
View child,
                                     int newIndex)
reorders the child at the oldIndex to the newIndex

Parameters:
container - the view's container
child - the child to reposition
newIndex - (zero-based)
Throws:
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.APPENDposition

getChildByIdStr

public static 
View getChildByIdStr(
View view,
                                   java.lang.String idStr)
returns the first child whose id matched the given id

Parameters:
view - the view to search in
idStr - the child's id
Returns:
View the first matching child or null if no one was found

setPropertyValue

public static void setPropertyValue(
View view,
                                    java.lang.Object id,
                                    java.lang.Object value)
Deprecated. use ViewUtil#setStructuralFeatureValue(View, EStructuralFeature, Object} instead

Sets the property with the given id if possible on the passed view to the passed value.

Parameters:
view - the view to set the value on
id - the id of the property being set
value - the value of the property being set

getPropertyValue

public static final java.lang.Object getPropertyValue(
View view,
                                                      java.lang.Object id)
Deprecated. use getStructuralFeatureValue(View, EStructuralFeature) instead

Returns the value of the property with the given id inside the passed view

Parameters:
view - the view to use to get the value
id - the id of the property to get
Returns:
the value of the property, or null

getViewContainer

public 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

Parameters:
obj - the EObject
Returns:
the first found View container of the object

getAllRelatedEdgesForView

public 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

Parameters:
view -
allEdges -

getAllRelatedEdgesFromViews

public 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

Parameters:
views -
allEdges -

getAllInnerEdges

public static java.util.Set<
Edge> getAllInnerEdges(
View view)

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