M
- the model typeW
- the abstracted widget typepublic abstract class BaseRenderer<M extends org.eclipse.e4.ui.model.application.ui.MUIElement,W extends WWidget<M>> extends java.lang.Object implements ElementRenderer<M,W>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTRIBUTE_localizedLabel
Key used to store the localized label in the context
|
static java.lang.String |
ATTRIBUTE_localizedTooltip
Key used to store the localized tooltip in the context
|
static java.lang.String |
CALCULATED_VISIBILITY
Transient data key used to remember the calculated visibility which is
built from
MUIElement.getVisibleWhen()
MUIElement.isVisible()
|
static java.lang.String |
CONTEXT_DOM_ELEMENT
Key used to store the dom element in the context
|
static java.lang.String |
CURRENT_VISIBLE_WHEN
Constant used to remember the current state of the visible when expression
|
Constructor and Description |
---|
BaseRenderer() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate(@NonNull org.eclipse.e4.ui.model.application.ui.basic.MPart element,
boolean requiresFocus)
Activate the given part using
EPartService.activate(MPart, boolean) |
void |
bindWidget(M me,
W widget)
Bind the widget and the element together
|
static boolean |
checkVisibleWhen(org.eclipse.e4.ui.model.application.ui.MUIElement item,
org.eclipse.e4.core.contexts.IEclipseContext context)
Check the visible when expression
|
W |
createWidget(M element)
Create the widget for the given model element
|
void |
destroyWidget(M element)
Destroy the widget associated with the element
|
protected abstract void |
doProcessContent(M element)
Process the content of an element
|
protected <LW extends WWidget<PM>,PM extends org.eclipse.e4.ui.model.application.ui.MUIElement> |
engineCreateWidget(PM pm)
Create a widget for the model element through the
IPresentationEngine.createGui(MUIElement) |
protected <LW extends WWidget<PM>,PM extends org.eclipse.e4.ui.model.application.ui.MUIElement> |
engineCreateWidget(PM pm,
@NonNull org.eclipse.e4.core.contexts.IEclipseContext context)
Create a widget for the model element through
IPresentationEngine.createGui(MUIElement, Object, IEclipseContext) |
void |
focus(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
Focus the given element
|
protected @Nullable org.eclipse.e4.core.contexts.IEclipseContext |
getContextForParent(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
Get the context for the parent using
EModelService.getContainingContext(MUIElement) |
protected Logger |
getLogger() |
@Nullable org.eclipse.e4.core.contexts.IEclipseContext |
getModelContext(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
Retrieve the model context for the given element
|
protected @NonNull org.eclipse.e4.ui.workbench.IPresentationEngine |
getPresentationEngine() |
protected int |
getRenderedIndex(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement parent,
@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
Get the rendering index of the element
|
protected @Nullable org.eclipse.e4.core.contexts.IEclipseContext |
getRenderingContext(M element)
Get the rendering context of the element
|
static boolean |
getVisibleWhen(org.eclipse.e4.ui.model.application.ui.MUIElement item,
org.eclipse.e4.core.contexts.IEclipseContext context)
Get the last calculated visible when state or calculates one
|
W |
getWidget(M element)
Get the widget for the given elemenet
|
protected abstract @NonNull java.lang.Class<? extends W> |
getWidgetClass(M element)
Get the widgets class
|
protected boolean |
inContentProcessing(org.eclipse.e4.ui.model.application.ui.MUIElement element)
Check if we are currently processing this element
|
protected boolean |
inContextModification(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
Check if we are currently modifying the context of this element
|
protected void |
initContext(@NonNull org.eclipse.emf.ecore.EObject eo,
@NonNull org.eclipse.e4.core.contexts.IEclipseContext context)
Initialize the context
|
protected void |
initRenderingContext(M element,
@NonNull org.eclipse.e4.core.contexts.IEclipseContext context)
Initialize the rendering context
|
protected void |
initWidget(M element,
W widget)
Initialize the widget
|
protected boolean |
inUIModification(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
Check if we are currently modifying the UI of the given element
|
protected boolean |
isChildAndRenderedVisible(org.eclipse.e4.ui.model.application.ui.MUIElement u)
Check if the item is visible and to be rendered
|
void |
postProcess(M element)
Post process the element
|
void |
preDestroy(M element)
Inform about destruction of the element
|
void |
processContent(M element)
Process the elements content
|
protected void |
registerEventListener(@NonNull org.eclipse.e4.core.services.events.IEventBroker broker,
@NonNull java.lang.String topic)
Register an event listener for the give topic and translate it into
context informations
|
org.eclipse.e4.core.contexts.IEclipseContext |
setupRenderingContext(M element)
Setup the context for rendering the element
|
void |
syncUIModifications(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element,
@NonNull java.lang.Runnable codeBlock)
Run code without informing the UI about updates
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
childRendered, hideChild
public static final java.lang.String CONTEXT_DOM_ELEMENT
public static final java.lang.String ATTRIBUTE_localizedLabel
public static final java.lang.String ATTRIBUTE_localizedTooltip
public static final java.lang.String CALCULATED_VISIBILITY
MUIElement.getVisibleWhen()
MUIElement.isVisible()
public static final java.lang.String CURRENT_VISIBLE_WHEN
protected Logger getLogger()
protected boolean inContentProcessing(org.eclipse.e4.ui.model.application.ui.MUIElement element)
element
- the element to checktrue
if element is currently processedprotected boolean inContextModification(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
element
- the element to checktrue
if the elements context is currently modifiedprotected boolean inUIModification(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
element
- the element to checktrue
if the elements ui is currently modifiedpublic final W createWidget(M element)
ElementRenderer
createWidget
in interface ElementRenderer<M extends org.eclipse.e4.ui.model.application.ui.MUIElement,W extends WWidget<M>>
element
- the model elementpublic void syncUIModifications(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element, @NonNull java.lang.Runnable codeBlock)
element
- the element the code is executed oncodeBlock
- the code to runpublic final org.eclipse.e4.core.contexts.IEclipseContext setupRenderingContext(M element)
ElementRenderer
setupRenderingContext
in interface ElementRenderer<M extends org.eclipse.e4.ui.model.application.ui.MUIElement,W extends WWidget<M>>
element
- the elementprotected void initContext(@NonNull org.eclipse.emf.ecore.EObject eo, @NonNull org.eclipse.e4.core.contexts.IEclipseContext context)
eo
- the object the context should be populated withcontext
- the contextprotected void registerEventListener(@NonNull org.eclipse.e4.core.services.events.IEventBroker broker, @NonNull java.lang.String topic)
broker
- the event brokertopic
- the topicprotected void initRenderingContext(M element, @NonNull org.eclipse.e4.core.contexts.IEclipseContext context)
element
- the elementcontext
- the contextprotected void initWidget(M element, W widget)
element
- the model elementwidget
- the widgetpublic void destroyWidget(M element)
ElementRenderer
destroyWidget
in interface ElementRenderer<M extends org.eclipse.e4.ui.model.application.ui.MUIElement,W extends WWidget<M>>
element
- the elementpublic void bindWidget(M me, W widget)
ElementRenderer
bindWidget
in interface ElementRenderer<M extends org.eclipse.e4.ui.model.application.ui.MUIElement,W extends WWidget<M>>
me
- the elementwidget
- the widgetpublic void postProcess(M element)
ElementRenderer
postProcess
in interface ElementRenderer<M extends org.eclipse.e4.ui.model.application.ui.MUIElement,W extends WWidget<M>>
element
- the elementpublic void preDestroy(M element)
ElementRenderer
preDestroy
in interface ElementRenderer<M extends org.eclipse.e4.ui.model.application.ui.MUIElement,W extends WWidget<M>>
element
- the elementprotected @NonNull org.eclipse.e4.ui.workbench.IPresentationEngine getPresentationEngine()
protected abstract @NonNull java.lang.Class<? extends W> getWidgetClass(M element)
element
- the widget classprotected <LW extends WWidget<PM>,PM extends org.eclipse.e4.ui.model.application.ui.MUIElement> LW engineCreateWidget(PM pm)
IPresentationEngine.createGui(MUIElement)
pm
- the model elementprotected <LW extends WWidget<PM>,PM extends org.eclipse.e4.ui.model.application.ui.MUIElement> LW engineCreateWidget(PM pm, @NonNull org.eclipse.e4.core.contexts.IEclipseContext context)
IPresentationEngine.createGui(MUIElement, Object, IEclipseContext)
pm
- the model elementcontext
- the contextprotected @Nullable org.eclipse.e4.core.contexts.IEclipseContext getRenderingContext(M element)
element
- the elementprotected @Nullable org.eclipse.e4.core.contexts.IEclipseContext getContextForParent(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
EModelService.getContainingContext(MUIElement)
element
- the elementpublic @Nullable org.eclipse.e4.core.contexts.IEclipseContext getModelContext(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
ElementRenderer
getModelContext
in interface ElementRenderer<M extends org.eclipse.e4.ui.model.application.ui.MUIElement,W extends WWidget<M>>
element
- the elementprotected void activate(@NonNull org.eclipse.e4.ui.model.application.ui.basic.MPart element, boolean requiresFocus)
EPartService.activate(MPart, boolean)
element
- the elementrequiresFocus
- true of focus is requiredpublic final void processContent(M element)
ElementRenderer
processContent
in interface ElementRenderer<M extends org.eclipse.e4.ui.model.application.ui.MUIElement,W extends WWidget<M>>
element
- the elementpublic static boolean checkVisibleWhen(org.eclipse.e4.ui.model.application.ui.MUIElement item, org.eclipse.e4.core.contexts.IEclipseContext context)
item
- the itemcontext
- the contexttrue
if visiblepublic static boolean getVisibleWhen(org.eclipse.e4.ui.model.application.ui.MUIElement item, org.eclipse.e4.core.contexts.IEclipseContext context)
item
- the itemcontext
- the contextprotected final int getRenderedIndex(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement parent, @NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
parent
- the parentelement
- the element-1
protected boolean isChildAndRenderedVisible(org.eclipse.e4.ui.model.application.ui.MUIElement u)
u
- the elementtrue
if item is to be shownprotected abstract void doProcessContent(M element)
element
- the elementpublic void focus(@NonNull org.eclipse.e4.ui.model.application.ui.MUIElement element)
ElementRenderer
public W getWidget(M element)
ElementRenderer