public interface EModelService
Modifier and Type | Field and Description |
---|---|
static int |
ABOVE
Insert the new element above the existing one
|
static int |
ANYWHERE
Searches for elements in the UI presentation, including all perspectives
|
static int |
BELOW
Insert the new element below the existing one
|
static String |
CLONED_FROM_KEY
When invoking the 'cloneElement' method the newly cloned element's 'transientData' map will
contain a reference to the original element using this as a key.
|
static int |
GLOBAL
Searches for elements in the UI that the user is currently seeing that are OUTSIDE the
perspective (i.e. visible regardless of the current perspective)
|
static int |
IN_ACTIVE_PERSPECTIVE
Returned Location if the element is in the currently active perspective
|
static int |
IN_ANY_PERSPECTIVE
Returned Location if the element is in a non-active perspective
|
static int |
IN_MAIN_MENU
Returned Location if the element is in a main menu of an MWindow
|
static int |
IN_PART
Returned Location if the element is in an MPart
|
static int |
IN_SHARED_AREA
Returned Location if the element is contained in an MArea
|
static int |
IN_TRIM
Returned Location if the element is in an MTrimBar
|
static int |
LEFT_OF
Insert the new element to the left of the existing one
|
static int |
NOT_IN_UI
Returned Location if the element's parent chain does not relate to the MApplication's model
|
static int |
OUTSIDE_PERSPECTIVE
Returned Location if the element is in the UI but not in an MPerspective
|
static int |
PRESENTATION
Searches for elements in the UI that the user is currently seeing (excluding trim)
|
static int |
RIGHT_OF
Insert the new element to the right of the existing one
|
Modifier and Type | Method and Description |
---|---|
void |
bringToTop(MUIElement element)
Brings the specified element to the top of its containment structure.
|
MUIElement |
cloneElement(MUIElement element,
MSnippetContainer snippetContainer)
Clones the element, creating a deep copy of its structure.
|
MUIElement |
cloneSnippet(MSnippetContainer snippetContainer,
String snippetId,
MWindow refWin)
If a snippet with the given id exists a clone is created and returned.
|
int |
countRenderableChildren(MUIElement element)
Return the count of the children whose 'toBeRendered' flag is true
|
<T extends MApplicationElement> |
createModelElement(Class<T> elementType)
Creates instances of model elements.
|
MPart |
createPart(MPartDescriptor descriptor)
Creates a new part from the given descriptor.
|
void |
detach(MPartSashContainerElement mPartSashContainerElement,
int x,
int y,
int width,
int height)
Created a separate (detached) window containing the given element.
|
MUIElement |
find(String id,
MUIElement searchRoot)
Returns the first element, recursively searching under the specified search
root (inclusive)
|
<T> List<T> |
findElements(MApplicationElement searchRoot,
Class<T> clazz,
int searchFlags,
Selector matcher)
Return a list of any elements that match the given search criteria.
|
<T> List<T> |
findElements(MUIElement searchRoot,
String id,
Class<T> clazz)
This is a convenience method that forwards the parameters on to
findElements(MUIElement, String, Class, List) , passing
null as 'tagsToMatch'. |
<T> List<T> |
findElements(MUIElement searchRoot,
String id,
Class<T> clazz,
List<String> tagsToMatch)
This is a convenience method that forwards the parameters on to
findElements(MUIElement, String, Class, List, int) , passing
ANYWHERE as the 'searchFlags'. |
<T> List<T> |
findElements(MUIElement searchRoot,
String id,
Class<T> clazz,
List<String> tagsToMatch,
int searchFlags)
This is a convenience method that constructs a new Selector based on
ElementMatcher and forwards the call on to the base API
findElements(MApplicationElement, Class, int, Selector) . |
MPlaceholder |
findPlaceholderFor(MWindow window,
MUIElement element)
Given a containing MWindow find the MPlaceholder that is currently being used
to host the given element (if any)
|
MUIElement |
findSnippet(MSnippetContainer snippetContainer,
String id)
Convenience method to find a snippet by id in a particular container
|
MPerspective |
getActivePerspective(MWindow window)
Return the active perspective for the given window.
|
MUIElement |
getContainer(MUIElement element)
Get the container of the given element.
|
IEclipseContext |
getContainingContext(MUIElement element)
Locate the context that is closest to the given element in the parent
hierarchy.
|
int |
getElementLocation(MUIElement element)
Given an element this method responds with information about where the element exists within
the current UI Model.
|
MPartDescriptor |
getPartDescriptor(String id)
Returns the descriptor for the given part id.
|
MPerspective |
getPerspectiveFor(MUIElement element) |
MWindow |
getTopLevelWindowFor(MUIElement element)
Get the top-level window containing this UI element.
|
MTrimBar |
getTrim(MTrimmedWindow window,
SideValue sv)
Returns the window's MTrimBar for the specified side.
|
void |
hideLocalPlaceholders(MWindow window,
MPerspective perspective)
This method ensures that there will never be two placeholders for the same
referenced element visible in the presentation at the same time.
|
void |
hostElement(MUIElement element,
MWindow hostWindow,
Object uiContainer,
IEclipseContext hostContext)
Allows an element to be rendered in an arbitrary UI container (I.e.
|
void |
insert(MPartSashContainerElement toInsert,
MPartSashContainerElement relTo,
int where,
float ratio)
Inserts the given element into the UI Model by either creating a new sash or
augmenting an existing sash if the orientation permits.
|
boolean |
isHostedElement(MUIElement element,
MWindow hostWindow)
Tests whether the given element is being 'hosted'.
|
boolean |
isLastEditorStack(MUIElement stack)
Returns
true iff the supplied element represents the single
visible element in the shared area. |
<T extends MUIElement> |
move(T element,
MElementContainer<? super T> newParent)
Move the element to a new location.
|
<T extends MUIElement> |
move(T element,
MElementContainer<? super T> newParent,
boolean leavePlaceholder)
Move the element to a new location.
|
<T extends MUIElement> |
move(T element,
MElementContainer<? super T> newParent,
int index)
Move the element to a new location.
|
<T extends MUIElement> |
move(T element,
MElementContainer<? super T> newParent,
int index,
boolean leavePlaceholder)
Move the element to a new location.
|
void |
removePerspectiveModel(MPerspective persp,
MWindow window)
Remove the given perspective completely from the model.
|
void |
resetPerspectiveModel(MPerspective persp,
MWindow window)
This is a convenience method that will clean the model of all traces of a
given perspective.
|
int |
toBeRenderedCount(MElementContainer<?> container)
Count the number of 'toBeRendered' children
|
static final int ABOVE
static final int BELOW
static final int LEFT_OF
static final int RIGHT_OF
static final int NOT_IN_UI
static final int OUTSIDE_PERSPECTIVE
static final int IN_ACTIVE_PERSPECTIVE
static final int IN_ANY_PERSPECTIVE
static final int IN_SHARED_AREA
static final int IN_TRIM
static final int IN_MAIN_MENU
static final int IN_PART
static final int PRESENTATION
static final int ANYWHERE
static final int GLOBAL
static final String CLONED_FROM_KEY
<T extends MApplicationElement> T createModelElement(Class<T> elementType)
MApplicationElement
, both in the standard e4 UI model and in an
extension models.
Caution: To create model element instances of extension models you
need to register them with the
the org.eclipse.e4.workbench.model.definition.enrichment
ExtensionPoint.
elementType
- the class to instantiate. Cannot be null
NullPointerException
- if the passed class is null
IllegalArgumentException
- if the passed class is not supported.<T> List<T> findElements(MUIElement searchRoot, String id, Class<T> clazz, List<String> tagsToMatch, int searchFlags)
ElementMatcher
and forwards the call on to the base API
findElements(MApplicationElement, Class, int, Selector)
.<T> List<T> findElements(MUIElement searchRoot, String id, Class<T> clazz, List<String> tagsToMatch)
findElements(MUIElement, String, Class, List, int)
, passing
ANYWHERE
as the 'searchFlags'.<T> List<T> findElements(MUIElement searchRoot, String id, Class<T> clazz)
findElements(MUIElement, String, Class, List)
, passing
null as 'tagsToMatch'.searchRoot
- The element at which to start the search. This element must
be non-null and is included in the search.id
- The id of the element search for, can be nullclazz
- The type of element to be searched for. If non-null this
also defines the return type of the List.<T> List<T> findElements(MApplicationElement searchRoot, Class<T> clazz, int searchFlags, Selector matcher)
null
in which case that field
will always 'match'.
NOTE: This is a generically typed method with the List's generic type expected to be the value of the 'clazz' parameter. If the 'clazz' parameter is null then the returned list is untyped.
T
- The generic type of the returned listsearchRoot
- The element at which to start the search. This element
must be non-null and is included in the search.clazz
- The type of element to be searched for. If non-null this
also defines the return type of the List.searchFlags
- A bitwise combination of the following constants:
matcher
- An implementation of a Selector that will return true for
elements that it wants in the returned list.MUIElement find(String id, MUIElement searchRoot)
id
- The id to search for, must not be nullsearchRoot
- The element at which to start the search, must not be nullnull
if one is
not foundIEclipseContext getContainingContext(MUIElement element)
element
- the element to locate parent context forvoid bringToTop(MUIElement element)
element
- The element to bring to the topMUIElement cloneElement(MUIElement element, MSnippetContainer snippetContainer)
element
- The element to clonesnippetContainer
- An optional MUIElement where the cloned snippet is to
be saved. null if the clone need not be savedMUIElement cloneSnippet(MSnippetContainer snippetContainer, String snippetId, MWindow refWin)
null
if no snippet can be found.snippetContainer
- The container of the snippet to clone usedsnippetId
- The element id of the snippet to clonerefWin
- The window that Placeholder references should be
resolved usingnull
if no snippet with the given
id can be foundMUIElement findSnippet(MSnippetContainer snippetContainer, String id)
snippetContainer
- The container to look inid
- The id of the root element of the snippetnull
if none is foundint countRenderableChildren(MUIElement element)
element
- The element to testMPlaceholder findPlaceholderFor(MWindow window, MUIElement element)
window
- The containing windowelement
- The element to find the MPlaceholder for<T extends MUIElement> void move(T element, MElementContainer<? super T> newParent)
element
- The element to movenewParent
- The new parent for the element.<T extends MUIElement> void move(T element, MElementContainer<? super T> newParent, boolean leavePlaceholder)
element
- The element to movenewParent
- The new parent for the element.leavePlaceholder
- true if a placeholder for the element should be added<T extends MUIElement> void move(T element, MElementContainer<? super T> newParent, int index)
element
- The element to movenewParent
- The new parent for the element.index
- The index to insert the element at; -1 means at the end<T extends MUIElement> void move(T element, MElementContainer<? super T> newParent, int index, boolean leavePlaceholder)
element
- The element to movenewParent
- The new parent for the element.index
- The index to insert the element at; -1 means at the
endleavePlaceholder
- true if a placeholder for the element should be addedvoid insert(MPartSashContainerElement toInsert, MPartSashContainerElement relTo, int where, float ratio)
toInsert
- The element to insertrelTo
- The element that the new one is to be relative towhere
- Indication of where the inserted element should be placed:
LEFT_OF
, RIGHT_OF
, ABOVE
,
BELOW
.ratio
- The percentage of the area to be occupied by the inserted
element; should be a number greater than 0 and less than 1void detach(MPartSashContainerElement mPartSashContainerElement, int x, int y, int width, int height)
mPartSashContainerElement
- The element to detachx
- The X position of the new windowy
- The Y position of the new windowwidth
- The Width of the new windowheight
- The Height of the new windowMWindow getTopLevelWindowFor(MUIElement element)
null
return value indicates that the element is not directly contained in the UI
model (but may, for example, be a model snippet hosted in a Dialog...)element
- The element to get the window fornull
return value indicates that the element is not directly contained in
the UI model (but may, for example, be a model snippet hosted in a
Dialog...)MPerspective getPerspectiveFor(MUIElement element)
element
- The element to get the perspective fornull
if the
element is not in a perspectiveMTrimBar getTrim(MTrimmedWindow window, SideValue sv)
window
- The window to get the trim bar forsv
- The value for the specified sideMPerspective getActivePerspective(MWindow window)
window
- The window to determine the active perspective for.null
if there is no
MPerspectiveStack, it's empty or has no selected element.void resetPerspectiveModel(MPerspective persp, MWindow window)
persp
- the perspective to removewindow
- the window to remove it fromvoid removePerspectiveModel(MPerspective persp, MWindow window)
persp
- the perspective to removewindow
- the window to remove it fromint toBeRenderedCount(MElementContainer<?> container)
container
- The container to checktrue
MUIElement getContainer(MUIElement element)
element
- The element to get the container fornull
if the element
being checked is a snippet unattached to the UI Model itself.int getElementLocation(MUIElement element)
element
- MPartDescriptor getPartDescriptor(String id)
NOTE: In order to support multiple instance parts there is a convention where the part's id may be in the form 'partId:secondaryId'. If the given id contains a ':' then only the substring before the ':' will be used to find the descriptor.
In order to support this convention it's required that no descriptor contain a ':' in its id
id
- The id of the descriptor to returnnull
if none existsMPart createPart(MPartDescriptor descriptor)
descriptor
- a part descriptor, must not be null
EPartService.createPart(String)
void hideLocalPlaceholders(MWindow window, MPerspective perspective)
false
.window
- The window to modifyperspective
- if non-null specifies the specific perspective to modify,
otherwise all perspectives in the window are checkedboolean isLastEditorStack(MUIElement stack)
true
iff the supplied element represents the single
visible element in the shared area. This method is used to test for this
condition since (by convention) there must be at least one stack in the
shared area at all times.stack
- The element to testtrue
iff the element is the last visible stackvoid hostElement(MUIElement element, MWindow hostWindow, Object uiContainer, IEclipseContext hostContext)
element
- The element to be rendered.hostWindow
- The MWindow the element is being hosted under. Must be
non-nulland rendered.uiContainer
- The UI container acting as the rendered element's parent.
Must be non-null.hostContext
- The IEclipseContext to use for hosting the element. Must
be non-null.boolean isHostedElement(MUIElement element, MWindow hostWindow)
element
- The element to test. Must be non-null.hostWindow
- The window to test the element against. Must be non-null.true
iff the given element or one of its ancestors is
currently being hosted in the given MWindow.
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.