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 that the user is currently seeing
|
static int |
BELOW
Insert the new element below the existing one
|
static int |
GLOBAL
Searches for elements in the UI that the user is currently seeing that are OUTSIDE the
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_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. returns
null if no snippet can be found. |
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.
|
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(MUIElement searchRoot,
String id,
Class<T> clazz,
List<String> tagsToMatch)
Return a list of any elements that match the given search criteria.
|
<T> List<T> |
findElements(MUIElement searchRoot,
String id,
Class<T> clazz,
List<String> tagsToMatch,
int searchFlags)
Return a list of any elements that match the given search criteria.
|
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. |
void |
move(MUIElement element,
MElementContainer<MUIElement> newParent)
Move the element to a new location.
|
void |
move(MUIElement element,
MElementContainer<MUIElement> newParent,
boolean leavePlaceholder)
Move the element to a new location.
|
void |
move(MUIElement element,
MElementContainer<MUIElement> newParent,
int index)
Move the element to a new location.
|
void |
move(MUIElement element,
MElementContainer<MUIElement> 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 PRESENTATION
static final int ANYWHERE
static final int GLOBAL
<T extends MApplicationElement> T createModelElement(Class<T> elementType)
MAddon
MApplication
MArea
MBindingContext
MBindingTable
MCategory
MCommand
MCommandParameter
MCoreExpression
MDirectMenuItem
MDirectToolItem
MDynamicMenuContribution
MHandledMenuItem
MHandledToolItem
MHandler
MInputPart
MKeyBinding
MMenu
MMenuContribution
MMenuSeparator
MParameter
MPart
MPartDescriptor
MPartSashContainer
MPartStack
MPerspective
MPerspectiveStack
MPlaceholder
MPopupMenu
MToolBar
MToolBarContribution
MToolBarSeparator
MToolControl
MTrimBar
MTrimContribution
MTrimmedWindow
MWindow
elementType
- the class to instantiatenull
IllegalArgumentException
- if the passed class is not supported.<T> List<T> findElements(MUIElement searchRoot, String id, Class<T> clazz, List<String> tagsToMatch, int searchFlags)
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 but may safely be assigned to List<MUIElement>.
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.id
- The ID of the element. May be null to omit the test for this field.clazz
- The class specifier determining the 'instanceof' type of the elements to be found.
If specified then the returned List will be generically specified as being of this
type.tagsToMatch
- The list of tags to match. All the tags specified in this list must be defined in
the search element's tags in order to be a match.searchFlags
- A bitwise combination of the following constants:
<T> List<T> findElements(MUIElement searchRoot, String id, Class<T> clazz, List<String> tagsToMatch)
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 but may safely be assigned to List<MUIElement>.
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.id
- The ID of the element. May be null to omit the test for this field.clazz
- The class specifier determining the 'instanceof' type of the elements to be found.
If specified then the returned List will be generically specified as being of this
type.tagsToMatch
- The list of tags to match. All the tags specified in this list must be defined in
the search element's tags in order to be a match.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 forvoid move(MUIElement element, MElementContainer<MUIElement> newParent)
element
- The element to movenewParent
- The new parent for the element.void move(MUIElement element, MElementContainer<MUIElement> newParent, boolean leavePlaceholder)
element
- The element to movenewParent
- The new parent for the element.leavePlaceholder
- true if a placeholder for the element should be addedvoid move(MUIElement element, MElementContainer<MUIElement> 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 endvoid move(MUIElement element, MElementContainer<MUIElement> 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
- An SWT constant indicating where the inserted element should be placedratio
- The percentage of the area to be occupied by the inserted elementvoid 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 existsvoid 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, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.