Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2014-10-23 23:11:06 +0000
committerTom Schindl2014-10-23 23:11:06 +0000
commit57f56abc4f0525ddb0012f107a4dbc9a80542c7a (patch)
treed50438bca1a59e7caeec495fdbc9c923bec0b08d
parented3efb4215fada01b967f958cbabfe78f386c8a2 (diff)
downloadorg.eclipse.efxclipse-57f56abc4f0525ddb0012f107a4dbc9a80542c7a.tar.gz
org.eclipse.efxclipse-57f56abc4f0525ddb0012f107a4dbc9a80542c7a.tar.xz
org.eclipse.efxclipse-57f56abc4f0525ddb0012f107a4dbc9a80542c7a.zip
Bug 448499 - Changing locale at runtime not working for shared parts
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.base/.project5
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.base/META-INF/MANIFEST.MF1
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.base/OSGI-INF/services/localechangeservice.xml10
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.base/build.properties11
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/internal/FixedLocaleChangeService.java131
-rw-r--r--bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/internal/FixedLocaleChangeServiceCF.java25
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BasePlaceholderRenderer.java76
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BaseRenderer.java108
8 files changed, 309 insertions, 58 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.base/.project b/bundles/runtime/org.eclipse.fx.ui.workbench.base/.project
index 2388c92c9..22db8cfcb 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.base/.project
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.base/.project
@@ -20,6 +20,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.base/META-INF/MANIFEST.MF b/bundles/runtime/org.eclipse.fx.ui.workbench.base/META-INF/MANIFEST.MF
index e46809489..c18b0d510 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.base/META-INF/MANIFEST.MF
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.base/META-INF/MANIFEST.MF
@@ -29,3 +29,4 @@ Import-Package: javax.annotation;version="1.2.0",
javax.inject;version="1.0.0"
Bundle-Activator: org.eclipse.fx.ui.workbench.base.internal.Activator
Bundle-ActivationPolicy: lazy
+Service-Component: OSGI-INF/services/localechangeservice.xml
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.base/OSGI-INF/services/localechangeservice.xml b/bundles/runtime/org.eclipse.fx.ui.workbench.base/OSGI-INF/services/localechangeservice.xml
new file mode 100644
index 000000000..4dccc5c27
--- /dev/null
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.base/OSGI-INF/services/localechangeservice.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.fx.ui.workbench.base.localechangeservice">
+ <implementation class="org.eclipse.fx.ui.workbench.base.internal.FixedLocaleChangeServiceCF"/>
+ <property name="service.ranking" type="Integer" value="1"/>
+ <property name="service.context.key" type="String" value="org.eclipse.e4.core.services.nls.ILocaleChangeService"/>
+
+ <service>
+ <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
+ </service>
+</scr:component>
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.base/build.properties b/bundles/runtime/org.eclipse.fx.ui.workbench.base/build.properties
index 17daa5b49..1e68d6ddd 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.base/build.properties
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.base/build.properties
@@ -1,5 +1,6 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ OSGI-INF/
+source.. = src/
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/internal/FixedLocaleChangeService.java b/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/internal/FixedLocaleChangeService.java
new file mode 100644
index 000000000..e15607348
--- /dev/null
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/internal/FixedLocaleChangeService.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Dirk Fauth and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Dirk Fauth <dirk.fauth@googlemail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.ui.workbench.base.internal;
+
+import java.util.List;
+import java.util.Locale;
+import javax.inject.Inject;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.internal.services.ResourceBundleHelper;
+import org.eclipse.e4.core.internal.services.ServicesActivator;
+import org.eclipse.e4.core.services.events.IEventBroker;
+import org.eclipse.e4.core.services.nls.ILocaleChangeService;
+import org.eclipse.e4.core.services.translation.TranslationService;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.MElementContainer;
+import org.eclipse.e4.ui.model.application.ui.MLocalizable;
+import org.eclipse.e4.ui.model.application.ui.MUIElement;
+import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar;
+import org.eclipse.e4.ui.model.application.ui.basic.MTrimmedWindow;
+import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
+import org.osgi.service.log.LogService;
+
+/**
+ * Default implementation of {@link ILocaleChangeService} that changes the {@link Locale} in the
+ * specified {@link IEclipseContext} and additionally fires an event on the event bus.
+ *
+ * @author Dirk Fauth
+ *
+ */
+@SuppressWarnings("restriction")
+public class FixedLocaleChangeService implements ILocaleChangeService {
+
+ private static LogService logService = ServicesActivator.getDefault().getLogService();
+
+ MApplication application;
+
+ @Inject
+ IEventBroker broker;
+
+ /**
+ * Create a new {@link FixedLocaleChangeService} for the given {@link IEclipseContext}.
+ *
+ * @param application
+ * The application to retrieve the context from.
+ */
+ @Inject
+ public FixedLocaleChangeService(MApplication application) {
+ this.application = application;
+ }
+
+ @Override
+ public void changeApplicationLocale(Locale locale) {
+
+ // the TranslationService.LOCALE context parameter is specified as String
+ // so we put the String representation of the given Locale to the context
+ this.application.getContext().set(TranslationService.LOCALE, locale.toString());
+
+ // update model
+ updateLocalization(this.application.getChildren());
+
+ // fire event
+ this.broker.post(LOCALE_CHANGE, locale);
+ }
+
+ @Override
+ public void changeApplicationLocale(String localeString) {
+ try {
+ Locale locale = ResourceBundleHelper.toLocale(localeString);
+
+ // set the locale to the application context
+ // use the resolved locale instead of the given locale string to avoid invalid locales
+ // in context
+ this.application.getContext().set(TranslationService.LOCALE, locale.toString());
+
+ // update model
+ updateLocalization(this.application.getChildren());
+
+ // fire event
+ this.broker.post(LOCALE_CHANGE, locale);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // performing a locale update failed
+ // there is no locale change performed
+ if (logService != null)
+ logService.log(LogService.LOG_ERROR, e.getMessage()
+ + " - No Locale change will be performed."); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Will iterate over the given list of {@link MUIElement}s and inform them about the Locale
+ * change if necessary.
+ *
+ * @param children
+ * The list of {@link MUIElement}s that should be checked for Locale updates.
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ protected void updateLocalization(List<? extends MUIElement> children) {
+ for (MUIElement element : children) {
+ if (element instanceof MElementContainer) {
+ updateLocalization(((MElementContainer) element).getChildren());
+ }
+
+ if (element instanceof MWindow) {
+ if( ((MWindow) element).getMainMenu() != null ) {
+ ((MWindow) element).getMainMenu().updateLocalization();
+ updateLocalization(((MWindow) element).getMainMenu().getChildren());
+ }
+ updateLocalization(((MWindow) element).getSharedElements());
+ }
+
+ if (element instanceof MTrimmedWindow) {
+ for (MTrimBar trimBar : ((MTrimmedWindow) element).getTrimBars()) {
+ trimBar.updateLocalization();
+ updateLocalization(trimBar.getChildren());
+ }
+ }
+
+ ((MLocalizable) element).updateLocalization();
+ }
+ }
+
+}
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/internal/FixedLocaleChangeServiceCF.java b/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/internal/FixedLocaleChangeServiceCF.java
new file mode 100644
index 000000000..fa0614fc3
--- /dev/null
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/internal/FixedLocaleChangeServiceCF.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2014 BestSolution.at and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tom Schindl<tom.schindl@bestsolution.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.fx.ui.workbench.base.internal;
+
+import org.eclipse.e4.core.contexts.ContextFunction;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+
+/**
+ * A context function creating a fixed up locale change
+ */
+public class FixedLocaleChangeServiceCF extends ContextFunction {
+ @Override
+ public Object compute(IEclipseContext context) {
+ return ContextInjectionFactory.make(FixedLocaleChangeService.class, context);
+ }
+}
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BasePlaceholderRenderer.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BasePlaceholderRenderer.java
index 46c29059b..0538370a9 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BasePlaceholderRenderer.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BasePlaceholderRenderer.java
@@ -15,20 +15,26 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.workbench.UIEvents;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.fx.ui.workbench.renderers.base.widget.WLayoutedWidget;
import org.eclipse.fx.ui.workbench.renderers.base.widget.WPlaceholderWidget;
+import org.eclipse.jdt.annotation.NonNull;
+import org.osgi.service.event.Event;
/**
* Base renderer for {@link MPlaceholder}
- *
+ *
* @param <N>
* the native widget type
*/
@@ -36,18 +42,74 @@ public abstract class BasePlaceholderRenderer<N> extends BaseRenderer<MPlacehold
@Inject
@Named(BaseWorkbenchRendererFactory.SHARED_ELEMENTS_MAP)
- private Map<MUIElement, Set<MPlaceholder>> renderedMap;
+ private Map<MUIElement, Set<@NonNull MPlaceholder>> renderedMap;
- private Set<MPlaceholder> getRenderedPlaceholders(MUIElement element) {
- Set<MPlaceholder> set = this.renderedMap.get(element);
+ private Set<@NonNull MPlaceholder> getRenderedPlaceholders(MUIElement element) {
+ Set<@NonNull MPlaceholder> set = this.renderedMap.get(element);
if (set == null) {
- set = new HashSet<MPlaceholder>();
+ set = new HashSet<@NonNull MPlaceholder>();
this.renderedMap.put(element, set);
}
return set;
}
+ @PostConstruct
+ void init(@NonNull IEventBroker eventBroker) {
+ eventBroker.subscribe(UIEvents.UILabel.TOPIC_ICONURI,this::handleRefEvent);
+
+ eventBroker.subscribe(UIEvents.UILabel.TOPIC_LABEL,this::handleRefEvent);
+ eventBroker.subscribe(UIEvents.UILabel.TOPIC_LOCALIZED_LABEL,this::handleRefEvent);
+
+ eventBroker.subscribe(UIEvents.UILabel.TOPIC_TOOLTIP,this::handleRefEvent);
+ eventBroker.subscribe(UIEvents.UILabel.TOPIC_LOCALIZED_TOOLTIP,this::handleRefEvent);
+
+ eventBroker.subscribe(UIEvents.Dirtyable.TOPIC_DIRTY,this::handleRefEvent);
+ }
+
+ @Override
+ protected void initContext(@NonNull EObject eo, @NonNull IEclipseContext context) {
+ super.initContext(eo, context);
+ if( eo instanceof MPlaceholder ) {
+ MPlaceholder element = (MPlaceholder) eo;
+ Set<MPlaceholder> set = getRenderedPlaceholders(element.getRef());
+ if (!set.contains(element)) {
+ set.add(element);
+ }
+ }
+ }
+
+ private void handleRefEvent(Event event) {
+ Object changedObj = event.getProperty(UIEvents.EventTags.ELEMENT);
+
+ MUIElement e = (MUIElement) changedObj;
+
+ if( e == null ) {
+ return;
+ }
+
+ if (inContextModification(e)) {
+ return;
+ }
+
+ String attributeName = event.getProperty(UIEvents.EventTags.ATTNAME).toString();
+ Object newValue = event.getProperty(UIEvents.EventTags.NEW_VALUE);
+
+ for( MPlaceholder p : getRenderedPlaceholders(e) ) {
+ try {
+ BasePlaceholderRenderer.this.contextModification.put(p, Boolean.TRUE);
+ if( isRenderer(p) ) {
+ IEclipseContext ctx = getRenderingContext(p);
+ if (ctx != null) {
+ ctx.set(attributeName, newValue);
+ }
+ }
+ } finally {
+ BasePlaceholderRenderer.this.contextModification.put(p, Boolean.FALSE);
+ }
+ }
+ }
+
@Override
protected void initWidget(MPlaceholder element, WPlaceholderWidget widget) {
super.initWidget(element, widget);
@@ -66,11 +128,11 @@ public abstract class BasePlaceholderRenderer<N> extends BaseRenderer<MPlacehold
ref.setToBeRendered(true);
IEclipseContext contextForParent = getContextForParent(ref);
if( contextForParent != null ) {
- refWidget = engineCreateWidget(ref, contextForParent);
+ refWidget = engineCreateWidget(ref, contextForParent);
} else {
getLogger().error("Could not find context for reference '"+ref+"'"); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
}
widget.setContent(refWidget);
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BaseRenderer.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BaseRenderer.java
index cde93889b..507682108 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BaseRenderer.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BaseRenderer.java
@@ -56,7 +56,7 @@ import org.osgi.service.event.Event;
/**
* Base class foe all renderers
- *
+ *
* @param <M>
* the model type
* @param <W>
@@ -71,14 +71,16 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
*/
public static final String CONTEXT_DOM_ELEMENT = "fx.rendering.domElement"; //$NON-NLS-1$
-// /**
-// * Key used to store the localized label in the context
-// */
-// public static final String ATTRIBUTE_localizedLabel = "localizedLabel"; //$NON-NLS-1$
-// /**
-// * Key used to store the localized tooltip in the context
-// */
-// public static final String ATTRIBUTE_localizedTooltip = "localizedTooltip"; //$NON-NLS-1$
+ private static final String RENDER_KEY = "_renderer"; //$NON-NLS-1$
+
+ // /**
+ // * Key used to store the localized label in the context
+ // */
+ // public static final String ATTRIBUTE_localizedLabel = "localizedLabel"; //$NON-NLS-1$
+ // /**
+ // * Key used to store the localized tooltip in the context
+ // */
+ // public static final String ATTRIBUTE_localizedTooltip = "localizedTooltip"; //$NON-NLS-1$
@Inject
IEclipseContext _context; // The
@@ -135,7 +137,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Check if we are currently processing this element
- *
+ *
* @param element
* the element to check
* @return <code>true</code> if element is currently processed
@@ -146,7 +148,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Check if we are currently modifying the context of this element
- *
+ *
* @param element
* the element to check
* @return <code>true</code> if the elements context is currently modified
@@ -157,7 +159,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Check if we are currently modifying the UI of the given element
- *
+ *
* @param element
* the element to check
* @return <code>true</code> if the elements ui is currently modified
@@ -199,7 +201,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Run code without informing the UI about updates
- *
+ *
* @param element
* the element the code is executed on
* @param codeBlock
@@ -284,11 +286,32 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
}
}
+ /**
+ * Check if this renderer is the one responsible for this class
+ *
+ * @param element
+ * the element
+ * @return <code>true</code> if renderer is the one associated with this
+ * element
+ */
+ protected boolean isRenderer(@NonNull MUIElement element) {
+ if (element.getRenderer() != null) {
+ return element.getRenderer() == this;
+ }
+ @Nullable
+ IEclipseContext renderingContext = getRenderingContext(element);
+ if (renderingContext != null) {
+ return renderingContext.get(RENDER_KEY) == this;
+ }
+ return false;
+ }
+
@Override
public final IEclipseContext setupRenderingContext(@NonNull M element) {
IEclipseContext context = (IEclipseContext) element.getTransientData().get(RENDERING_CONTEXT_KEY);
if (context == null) {
context = this._context.createChild("Element RenderingContext"); //$NON-NLS-1$
+ context.set(RENDER_KEY, this);
element.getTransientData().put(RENDERING_CONTEXT_KEY, context);
context.set(CONTEXT_DOM_ELEMENT, element);
initRenderingContext(element, context);
@@ -320,7 +343,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Initialize the context
- *
+ *
* @param eo
* the object the context should be populated with
* @param context
@@ -339,18 +362,18 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
}
}
-// // Localized Label/Tooltip treatment
-// if (eo instanceof MUILabel) {
-// MUILabel l = (MUILabel) eo;
-// context.set(ATTRIBUTE_localizedLabel, l.getLocalizedLabel());
-// context.set(ATTRIBUTE_localizedTooltip, l.getLocalizedTooltip());
-// }
+ // // Localized Label/Tooltip treatment
+ // if (eo instanceof MUILabel) {
+ // MUILabel l = (MUILabel) eo;
+ // context.set(ATTRIBUTE_localizedLabel, l.getLocalizedLabel());
+ // context.set(ATTRIBUTE_localizedTooltip, l.getLocalizedTooltip());
+ // }
}
/**
* Register an event listener for the give topic and translate it into
* context informations
- *
+ *
* @param broker
* the event broker
* @param topic
@@ -362,7 +385,8 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
@SuppressWarnings("null")
void handleEvent(Event event) {
-// System.err.println("EVENT: " + event + " - " + event.getProperty(UIEvents.EventTags.ATTNAME));
+ // System.err.println("EVENT: " + event + " - " +
+ // event.getProperty(UIEvents.EventTags.ATTNAME));
Object changedObj = event.getProperty(UIEvents.EventTags.ELEMENT);
if (!(changedObj instanceof MUIElement)) {
return;
@@ -387,8 +411,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
BaseRenderer.this.contextModification.put(e, Boolean.TRUE);
if (changedObj instanceof MUIElement) {
- if (e.getRenderer() == BaseRenderer.this) {
-
+ if ( isRenderer(e) ) {
if (attributeName.equals(UIEvents.ApplicationElement.TAGS)) {
MUIElement m = (MUIElement) changedObj;
if (m.getWidget() != null) {
@@ -411,14 +434,6 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
+ entry.getKey(), entry.getValue());
} else {
ctx.set(attributeName, newValue);
-// if (e instanceof MUILabel) {
-// MUILabel l = (MUILabel) e;
-// if (event.getProperty(UIEvents.EventTags.ATTNAME).equals(UIEvents.UILabel.LABEL)) {
-// ctx.set(ATTRIBUTE_localizedLabel, l.getLocalizedLabel());
-// } else if (event.getProperty(UIEvents.EventTags.ATTNAME).equals(UIEvents.UILabel.TOOLTIP)) {
-// ctx.set(ATTRIBUTE_localizedTooltip, l.getLocalizedTooltip());
-// }
-// }
}
}
}
@@ -430,7 +445,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Initialize the rendering context
- *
+ *
* @param element
* the element
* @param context
@@ -442,7 +457,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Initialize the widget
- *
+ *
* @param element
* the model element
* @param widget
@@ -526,7 +541,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Get the widgets class
- *
+ *
* @param element
* the widget class
* @return the widget class
@@ -537,7 +552,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Create a widget for the model element through the
* {@link IPresentationEngine#createGui(MUIElement)}
- *
+ *
* @param pm
* the model element
* @param <LW>
@@ -555,7 +570,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Create a widget for the model element through
* {@link IPresentationEngine#createGui(MUIElement, Object, IEclipseContext)}
- *
+ *
* @param pm
* the model element
* @param context
@@ -574,20 +589,21 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Get the rendering context of the element
- *
+ *
* @param element
* the element
* @return the context
*/
+ @SuppressWarnings("static-method")
@Nullable
- protected IEclipseContext getRenderingContext(@NonNull M element) {
+ protected IEclipseContext getRenderingContext(@NonNull MUIElement element) {
return (IEclipseContext) element.getTransientData().get(RENDERING_CONTEXT_KEY);
}
/**
* Get the context for the parent using
* {@link EModelService#getContainingContext(MUIElement)}
- *
+ *
* @param element
* the element
* @return the context
@@ -609,7 +625,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Activate the given part using
* {@link EPartService#activate(MPart, boolean)}
- *
+ *
* @param element
* the element
* @param requiresFocus
@@ -636,7 +652,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Check the visible when expression
- *
+ *
* @param item
* the item
* @param context
@@ -656,7 +672,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Get the last calculated visible when state or calculates one
- *
+ *
* @param item
* the item
* @param context
@@ -675,7 +691,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Get the rendering index of the element
- *
+ *
* @param parent
* the parent
* @param element
@@ -702,7 +718,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Check if the item is visible and to be rendered
- *
+ *
* @param u
* the element
* @return <code>true</code> if item is to be shown
@@ -713,7 +729,7 @@ public abstract class BaseRenderer<M extends MUIElement, W extends WWidget<M>> i
/**
* Process the content of an element
- *
+ *
* @param element
* the element
*/

Back to the top