Package org.eclipse.gef.tools
Class ToolUtilities
- java.lang.Object
-
- org.eclipse.gef.tools.ToolUtilities
-
public class ToolUtilities extends java.lang.Object
Utilities forTools
.
-
-
Constructor Summary
Constructors Constructor Description ToolUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
filterEditPartsUnderstanding(java.util.List list, Request request)
Filters the given list of EditParts so that the list only contains the EditParts that understand the given request (i.e. returntrue
fromEditPart.understandsRequest(Request)
when passed the given request).static EditPart
findCommonAncestor(EditPart ll, EditPart rr)
Returns the common parent editpart for given pair of EditParts.static java.util.List
getSelectionWithoutDependants(java.util.List selectedParts)
Returns a list containing the top level selected edit parts based on the passed in list of selection.static java.util.List
getSelectionWithoutDependants(EditPartViewer viewer)
Returns a list containing the top level selected edit parts based on the viewer's selection.static boolean
isAncestorContainedIn(java.util.Collection c, EditPart ep)
Checks if collection contains any ancestor of editpartep
-
-
-
Method Detail
-
getSelectionWithoutDependants
public static java.util.List getSelectionWithoutDependants(EditPartViewer viewer)
Returns a list containing the top level selected edit parts based on the viewer's selection.- Parameters:
viewer
- the viewer- Returns:
- the selection excluding dependants
-
getSelectionWithoutDependants
public static java.util.List getSelectionWithoutDependants(java.util.List selectedParts)
Returns a list containing the top level selected edit parts based on the passed in list of selection.- Parameters:
selectedParts
- the complete selection- Returns:
- the selection excluding dependants
-
filterEditPartsUnderstanding
public static void filterEditPartsUnderstanding(java.util.List list, Request request)
Filters the given list of EditParts so that the list only contains the EditParts that understand the given request (i.e. returntrue
fromEditPart.understandsRequest(Request)
when passed the given request).- Parameters:
list
- the list of edit parts to filterrequest
- the request
-
isAncestorContainedIn
public static boolean isAncestorContainedIn(java.util.Collection c, EditPart ep)
Checks if collection contains any ancestor of editpartep
- Parameters:
c
- - collection of editpartsep
- - the editparts to check ancestors for- Returns:
true
if collection contains any ancestor(s) of the editpartep
- Since:
- 3.6
-
findCommonAncestor
public static EditPart findCommonAncestor(EditPart ll, EditPart rr)
Returns the common parent editpart for given pair of EditParts. If the two parts are identical, the result is that part. If the two parts do not have a common ancestor, some form of RuntimeException will be thrown.- Parameters:
ll
- the first editpartrr
- the second editpart- Returns:
- the editpart which is the common ancestor.
- Since:
- 3.1
-
-