improve displayUI Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml index d264ab3..0cd3d81 100644 --- a/jenkins.build.config.xml +++ b/jenkins.build.config.xml
@@ -25,6 +25,7 @@ <jenkins.build.dependency>org.eclipse.osbp.utils.themes.ui</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.vaaclipse</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.vaaclipse.addons</jenkins.build.dependency> + <jenkins.build.dependency>org.eclipse.osbp.vaaclipse.addons.softwarefactory</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.vaadin.emf</jenkins.build.dependency> <jenkins.build.dependency>org.eclipse.osbp.xtext.dialog</jenkins.build.dependency> </jenkins.build.dependencies>
diff --git a/org.eclipse.osbp.display.feature/feature.xml b/org.eclipse.osbp.display.feature/feature.xml index ede708b..27efb62 100644 --- a/org.eclipse.osbp.display.feature/feature.xml +++ b/org.eclipse.osbp.display.feature/feature.xml
@@ -3,7 +3,8 @@ id="org.eclipse.osbp.display.feature" label="%featureName" version="0.9.0.qualifier" - provider-name="%providerName"> + provider-name="%providerName" + plugin="org.eclipse.osbp.license"> <description> %description
diff --git a/org.eclipse.osbp.display/META-INF/MANIFEST.MF b/org.eclipse.osbp.display/META-INF/MANIFEST.MF index 130ddc8..6518536 100644 --- a/org.eclipse.osbp.display/META-INF/MANIFEST.MF +++ b/org.eclipse.osbp.display/META-INF/MANIFEST.MF
@@ -41,7 +41,8 @@ org.eclipse.osbp.vaaclipse.publicapi, org.eclipse.emf.ecore, org.eclipse.osbp.vaadin.emf.api, - org.eclipse.emf.edit;bundle-version="2.12.0" + org.eclipse.emf.edit;bundle-version="2.12.0", + org.eclipse.osbp.vaaclipse.addons.softwarefactory Bundle-ActivationPolicy: lazy Service-Component: OSGI-INF/*.xml Bundle-Activator: org.eclipse.osbp.display.servlet.Activator
diff --git a/org.eclipse.osbp.display/src/org/eclipse/osbp/display/servlet/DisplayUI.java b/org.eclipse.osbp.display/src/org/eclipse/osbp/display/servlet/DisplayUI.java index 47eb284..a2c4469 100644 --- a/org.eclipse.osbp.display/src/org/eclipse/osbp/display/servlet/DisplayUI.java +++ b/org.eclipse.osbp.display/src/org/eclipse/osbp/display/servlet/DisplayUI.java
@@ -16,15 +16,16 @@ import java.net.UnknownHostException; import java.util.Dictionary; import java.util.Hashtable; +import java.util.Locale; import java.util.Map; import java.util.UUID; +import java.util.regex.Pattern; import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.RegistryFactory; import org.eclipse.e4.core.contexts.ContextInjectionFactory; import org.eclipse.e4.core.contexts.EclipseContextFactory; import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.translation.TranslationProviderFactory; import org.eclipse.e4.core.services.translation.TranslationService; import org.eclipse.e4.ui.di.UISynchronize; import org.eclipse.e4.ui.internal.workbench.WorkbenchLogger; @@ -37,9 +38,12 @@ import org.eclipse.osbp.display.api.IDisplayUiParticipant; import org.eclipse.osbp.display.api.IDisplayUiParticipantHandle; import org.eclipse.osbp.runtime.common.session.ISession; +import org.eclipse.osbp.runtime.common.session.SessionUtil; +import org.eclipse.osbp.runtime.common.session.SessionUtil.Info; import org.eclipse.osbp.runtime.web.vaadin.databinding.VaadinObservables; import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService; import org.eclipse.osbp.ui.api.themes.IThemeResourceService; +import org.eclipse.osbp.vaaclipse.addons.softwarefactory.service.OSBPTranslationService; import org.eclipse.osbp.vaaclipse.publicapi.events.IWidgetModelAssociations; import org.eclipse.osbp.vaadin.emf.api.IModelingContext; import org.osgi.framework.BundleContext; @@ -78,9 +82,7 @@ private transient IEclipseContext appContext; - private String masterId; - - private String displayId; + private transient Info info; @Override public boolean equals(Object obj) { @@ -99,15 +101,13 @@ */ @Override protected void init(VaadinRequest request) { - // fragment has pattern #{master-host}§{displayName} NOSONAR + // fragment has pattern #{master-host}?{display=displayName}&{locale=languageTag} NOSONAR String fragment = getPage().getUriFragment(); - String[] tokens = fragment.split(ISession.DTO_SEPARATOR); - masterId = tokens[0]; - displayId = tokens[1]; - + + info = SessionUtil.getFragmentInfo(fragment); createEnvironment(); - LOGGER.error("*** init display master:{} display:{} ***", masterId, displayId); + LOGGER.error("*** init display master:{} display:{} locale:{} ***", info.host, info.ui, info.languageTag); setTheme("osbp"); VaadinObservables.getRealm(getUI()); @@ -117,7 +117,7 @@ setContent(layout); // initialize the UI - ServiceReference<IDisplayUiParticipant> reference = Activator.getServiceReference(tokens[1]); + ServiceReference<IDisplayUiParticipant> reference = Activator.getServiceReference(info.ui); if (reference != null) { IDisplayUiParticipant participant = Activator.getContext().getService(reference); if (uiHandle != null) { @@ -127,7 +127,7 @@ uiHandle = null; } } - uiHandle = participant.createHandle(this, tokens[1]); + uiHandle = participant.createHandle(this, info.ui); ContextInjectionFactory.inject(uiHandle, appContext); if (uiHandle != null) { uiHandle.handle(layout, appContext); @@ -150,7 +150,7 @@ Dictionary<String, Object> dictionary = new Hashtable<>(); // NOSONAR dictionary.put("vaadinUIId", Integer.toString(getUIId())); - dictionary.put("masterId", masterId); + dictionary.put("masterId", info.host); try { InetAddress netAddress = InetAddress.getByName(getPage().getWebBrowser().getAddress()); @@ -174,7 +174,7 @@ appContext.set("e4ApplicationInstanceId", UUID.randomUUID().toString()); appContext.set("vaadinUI", this); appContext.set(UI.class, this); - appContext.set("displayName", displayId); + appContext.set("displayName", info.ui); appContext.set(ISession.Type.class, ISession.Type.SLAVE); appContext.set(UISynchronize.class, new UISynchronize() { public void syncExec(Runnable runnable) { @@ -211,10 +211,8 @@ displayContext.set(MApplication.class, dummyApplication); // translation - serviceContext.set(TranslationService.LOCALE, getLocale()); - TranslationService bundleTranslationProvider = TranslationProviderFactory - .bundleTranslationService(serviceContext); - serviceContext.set(TranslationService.class, bundleTranslationProvider); + serviceContext.set(TranslationService.LOCALE, Locale.forLanguageTag(info.languageTag)); + serviceContext.set(TranslationService.class, ContextInjectionFactory.make(OSBPTranslationService.class, serviceContext)); displayContext.set(IExtensionRegistry.class.getName(), RegistryFactory.getRegistry()); displayContext.set(IWidgetModelAssociations.class, new DummyIWidgetModelAssociations());