diff options
author | Thomas Schindl | 2010-06-03 17:08:12 +0000 |
---|---|---|
committer | Thomas Schindl | 2010-06-03 17:08:12 +0000 |
commit | 708974f00311d38a84403f7a7c66f9c7338e1477 (patch) | |
tree | b6e8790445b1e017ced8788bd4a4913811b79134 | |
parent | 859c339d7b39d1f7b04bed8151a35e39bac18ce1 (diff) | |
download | org.eclipse.e4.tools-708974f00311d38a84403f7a7c66f9c7338e1477.tar.gz org.eclipse.e4.tools-708974f00311d38a84403f7a7c66f9c7338e1477.tar.xz org.eclipse.e4.tools-708974f00311d38a84403f7a7c66f9c7338e1477.zip |
Bug 304584 - [Tooling] Implement Workbench-Model-Tooling
* setting up styling engine
-rw-r--r-- | bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java index 480448e4..fa33b020 100644 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java @@ -15,9 +15,14 @@ import org.eclipse.core.runtime.RegistryFactory; import org.eclipse.e4.core.contexts.EclipseContextFactory; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.services.contributions.IContributionFactory; +import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; +import org.eclipse.e4.ui.css.swt.theme.IThemeManager; import org.eclipse.e4.ui.services.IServiceConstants; +import org.eclipse.e4.ui.services.IStylingEngine; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Widget; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.ISelectionService; import org.eclipse.ui.IWorkbenchPart; @@ -63,6 +68,27 @@ public class ContextServiceFactory extends AbstractServiceFactory { ReflectionContributionFactory contributionFactory = new ReflectionContributionFactory(registry); appContext.set(IContributionFactory.class.getName(),contributionFactory); + IThemeManager manager = serviceContext.get(IThemeManager.class); + final IThemeEngine engine = manager.getEngineForDisplay(Display.getCurrent()); + + appContext.set(IStylingEngine.class, new IStylingEngine() { + + public void setClassname(Object widget, String classname) { + ((Widget) widget).setData( + "org.eclipse.e4.ui.css.CssClassName", classname); //$NON-NLS-1$ + engine.applyStyles((Widget) widget, true); + } + + public void setId(Object widget, String id) { + ((Widget) widget).setData("org.eclipse.e4.ui.css.id", id); //$NON-NLS-1$ + engine.applyStyles((Widget) widget, true); + } + + public void style(Object widget) { + engine.applyStyles((Widget) widget, true); + } + }); + return appContext; } else if( o != null && site == null ) { final IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); |