diff options
author | Tom Schindl | 2014-07-25 13:33:31 +0000 |
---|---|---|
committer | Tom Schindl | 2014-07-25 13:33:31 +0000 |
commit | c64bd8a586be0742b074b9b8315e20a35c8d8c6f (patch) | |
tree | b991f60d32fad391d051153ef5377b1b3544b5dc | |
parent | 6eada321acc625a82b84d5ed799d995a45f447fd (diff) | |
download | org.eclipse.efxclipse-c64bd8a586be0742b074b9b8315e20a35c8d8c6f.tar.gz org.eclipse.efxclipse-c64bd8a586be0742b074b9b8315e20a35c8d8c6f.tar.xz org.eclipse.efxclipse-c64bd8a586be0742b074b9b8315e20a35c8d8c6f.zip |
Bug 440434 - Tag modifications do not update widget styleclasses
3 files changed, 29 insertions, 21 deletions
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 c889a5167..d41609c56 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 @@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.e4.core.contexts;bundle-version="1.1.0", org.eclipse.core.runtime;bundle-version="3.10.0", org.eclipse.fx.osgi.util;bundle-version="1.0.0", org.eclipse.e4.core.di.extensions, - org.eclipse.fx.ui.services;bundle-version="1.0.0" + org.eclipse.fx.ui.services;bundle-version="1.0.0", + org.eclipse.fx.ui.workbench.services;bundle-version="1.0.0" Export-Package: org.eclipse.fx.ui.workbench.base, org.eclipse.fx.ui.workbench.base.rendering Import-Package: javax.annotation;version="1.2.0", diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/AbstractE4Application.java b/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/AbstractE4Application.java index 8f1f0a8ad..77575a162 100644 --- a/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/AbstractE4Application.java +++ b/bundles/runtime/org.eclipse.fx.ui.workbench.base/src/org/eclipse/fx/ui/workbench/base/AbstractE4Application.java @@ -20,6 +20,8 @@ import java.util.List; import java.util.Locale; import java.util.Properties; import java.util.concurrent.Callable; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.eclipse.core.databinding.observable.Realm; import org.eclipse.core.runtime.Assert; @@ -50,6 +52,7 @@ import org.eclipse.e4.ui.internal.workbench.SelectionAggregator; import org.eclipse.e4.ui.internal.workbench.SelectionServiceImpl; import org.eclipse.e4.ui.model.application.MAddon; import org.eclipse.e4.ui.model.application.MApplication; +import org.eclipse.e4.ui.model.application.ui.MUIElement; import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; @@ -79,6 +82,7 @@ import org.eclipse.fx.ui.workbench.base.internal.Activator; import org.eclipse.fx.ui.workbench.base.internal.LoggerProviderImpl; import org.eclipse.fx.ui.workbench.base.restart.RestartPreferenceUtil; import org.eclipse.fx.ui.workbench.base.restart.RestartServiceImpl; +import org.eclipse.fx.ui.workbench.services.EModelStylingService; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.osgi.service.datalocation.Location; @@ -170,6 +174,26 @@ public abstract class AbstractE4Application implements IApplication { appContext.set(UISynchronize.class, uiSync); appContext.set(Realm.class, createRealm(appContext)); appContext.set(IApplicationContext.class, applicationContext); + appContext.set(EModelStylingService.class, new EModelStylingService() { + private static final String PREFIX = "efx_styleclass:"; //$NON-NLS-1$ + @Override + public void addModelTag(MUIElement element, String... tags) { + List<String> cssTags = Stream.of(tags).map(t -> PREFIX + t).collect(Collectors.toList()); + element.getTags().remove(cssTags); + element.getTags().addAll(cssTags); + } + + @Override + public void removeModelTag(MUIElement element, String... tags) { + List<String> cssTags = Stream.of(tags).map(t -> PREFIX + t).collect(Collectors.toList()); + element.getTags().removeAll(cssTags); + } + + @Override + public List<String> getModelTags(MUIElement element) { + return element.getTags().stream().filter((t) -> t.startsWith(PREFIX)).collect(Collectors.toList()); + } + }); appContext.set(IResourceUtilities.class, createResourceUtility(appContext)); // Check if DS is running diff --git a/org.eclipse.fx.ui.workbench.services/src/org/eclipse/fx/ui/workbench/services/EModelStylingService.java b/org.eclipse.fx.ui.workbench.services/src/org/eclipse/fx/ui/workbench/services/EModelStylingService.java index c73d3af75..50ba67066 100644 --- a/org.eclipse.fx.ui.workbench.services/src/org/eclipse/fx/ui/workbench/services/EModelStylingService.java +++ b/org.eclipse.fx.ui.workbench.services/src/org/eclipse/fx/ui/workbench/services/EModelStylingService.java @@ -1,28 +1,11 @@ package org.eclipse.fx.ui.workbench.services; import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; import org.eclipse.e4.ui.model.application.ui.MUIElement; public interface EModelStylingService { - public static void addModelTag(MUIElement element, String... tags) { - List<String> cssTags = Stream.of(tags).map(t -> "efx_styleclass:" + t).collect(Collectors.toList()); - element.getTags().remove(cssTags); - element.getTags().addAll(cssTags); - } - - public static void removeModelTag(MUIElement element, String... tags) { - List<String> cssTags = Stream.of(tags).map(t -> "efx_styleclass:" + t).collect(Collectors.toList()); - element.getTags().removeAll(cssTags); - } - - public static List<String> getModelTags(MUIElement element) { - return element.getTags().stream().filter((t) -> t.startsWith("efx_styleclass:")).collect(Collectors.toList()); - } - - public void addModelTag(String... tags); - public void removeModelTag(String... tags); - public List<String> getModelTags(List<String> tagList); + public void addModelTag(MUIElement element, String... tags); + public void removeModelTag(MUIElement element, String... tags); + public List<String> getModelTags(MUIElement element); } |