catch up with development
Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/org.eclipse.osbp.vaaclipse.addons.app/META-INF/MANIFEST.MF b/org.eclipse.osbp.vaaclipse.addons.app/META-INF/MANIFEST.MF
index c3b2e24..90e6e28 100644
--- a/org.eclipse.osbp.vaaclipse.addons.app/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.vaaclipse.addons.app/META-INF/MANIFEST.MF
@@ -48,6 +48,7 @@
javax.servlet.http;version="2.6.0",
org.apache.commons.lang,
org.eclipse.equinox.http.servlet;version="1.1.0",
+ org.eclipse.osbp.runtime.web.vaadin.components.converter;version="0.9.0",
org.eclipse.osbp.ui.api.perspective;version="0.9.0",
org.eclipse.osbp.ui.api.user,
org.osgi.util.promise;version="1.0.0"
diff --git a/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/converter/VaaclipseByteArrayConverter.java b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/converter/VaaclipseByteArrayConverter.java
new file mode 100644
index 0000000..6932a6a
--- /dev/null
+++ b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/converter/VaaclipseByteArrayConverter.java
@@ -0,0 +1,74 @@
+package org.eclipse.osbp.vaaclipse.addons.app.converter;
+
+import java.util.Base64;
+import java.util.Locale;
+
+import com.vaadin.data.util.converter.Converter;
+
+@SuppressWarnings("serial")
+public class VaaclipseByteArrayConverter implements Converter<String, byte[]> {
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.data.util.converter.Converter#convertToModel(java.lang.Object,
+ * java.lang.Class, java.util.Locale)
+ */
+ @Override
+ public byte[] convertToModel(String value, Class<? extends byte[]> targetType, Locale locale)
+ throws com.vaadin.data.util.converter.Converter.ConversionException {
+ if (targetType != getModelType()) {
+ throw new ConversionException("Converter only supports " + getModelType().getName() + " (targetType was "
+ + targetType.getName() + ")");
+ }
+
+ if (value == null) {
+ return null;
+ }
+
+ // Remove leading and trailing white space
+ value = value.trim();
+
+ return Base64.getEncoder().encode(value.getBytes());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.data.util.converter.Converter#convertToPresentation(java.lang
+ * .Object, java.lang.Class, java.util.Locale)
+ */
+ @Override
+ public String convertToPresentation(byte[] value, Class<? extends String> targetType, Locale locale)
+ throws com.vaadin.data.util.converter.Converter.ConversionException {
+ if (value == null) {
+ return null;
+ }
+
+ return new String(Base64.getDecoder().decode(value));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.util.converter.Converter#getModelType()
+ */
+ @Override
+ public Class<byte[]> getModelType() {
+ return byte[].class;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.data.util.converter.Converter#getPresentationType()
+ */
+ @Override
+ public Class<String> getPresentationType() {
+ return String.class;
+ }
+
+}
diff --git a/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/converter/VaaclipseConverterFactory.java b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/converter/VaaclipseConverterFactory.java
index 3c19404..4032e5f 100644
--- a/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/converter/VaaclipseConverterFactory.java
+++ b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/converter/VaaclipseConverterFactory.java
@@ -1,5 +1,8 @@
package org.eclipse.osbp.vaaclipse.addons.app.converter;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalDoubleConverter;
+import org.eclipse.osbp.runtime.web.vaadin.components.converter.DecimalFloatConverter;
+
import com.vaadin.data.util.converter.Converter;
import com.vaadin.data.util.converter.DefaultConverterFactory;
@@ -10,12 +13,22 @@
@Override
public <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL> createConverter(Class<PRESENTATION> presentationType,
Class<MODEL> modelType) {
- if (String.class == presentationType && (
- java.util.Date.class == modelType||
- java.sql.Date.class == modelType||
- java.sql.Timestamp.class == modelType)) {
+ if (String.class == presentationType) {
+ if (java.util.Date.class.isAssignableFrom(modelType)||
+ java.sql.Date.class.isAssignableFrom(modelType)||
+ java.sql.Timestamp.class.isAssignableFrom(modelType)) {
return (Converter<PRESENTATION, MODEL>) new VaaclipseDateConverter();
+ }
+ if (modelType.isArray() && modelType.getComponentType().getSimpleName().equals("byte")){
+ return (Converter<PRESENTATION, MODEL>) new VaaclipseByteArrayConverter();
+ }
+ if (Double.class.isAssignableFrom(modelType)) {
+ return (Converter<PRESENTATION, MODEL>) new DecimalDoubleConverter();
+ } else if (Float.class.isAssignableFrom(modelType)) {
+ return (Converter<PRESENTATION, MODEL>) new DecimalFloatConverter();
+ }
}
+
return super.createConverter(presentationType, modelType);
}
diff --git a/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/resources/StaticResources.java b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/resources/StaticResources.java
index 099ccf7..61e71a1 100644
--- a/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/resources/StaticResources.java
+++ b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/resources/StaticResources.java
@@ -247,7 +247,7 @@
if (path.startsWith("/themes")) {
themeId = path.split("/")[2];
}
- if (themeId == null || themeId.isEmpty()) {
+ if (themeId == null || themeId.isEmpty() || "common".equals(themeId)) {
themeId = resourceInfoProvider.getCssTheme();
}
InputStream in = getInputStream(resourcePath, themeEngine.getTheme(themeId),
@@ -346,7 +346,7 @@
} else if (segments[1].equals("themes")) {
String themeName = segments[2];
- if (theme.getWebId().equals(themeName)) {
+ if (theme.getWebId().equals(themeName) || "common".equals(themeName)) {
if ("styles.css".equals(segments[3])) {
return theme.getCssAsStream();
} else if ("original_styles.css".equals(segments[3])) {
@@ -358,7 +358,7 @@
String bundleName = segments[4];
path = "platform:/plugin/" + bundleName + "/" + buildSegments(segments, 5);
} else {// this is relative theme path
- if (url.endsWith("css")) {
+ if (url.endsWith("css") && !"common".equals(themeName)) {
String cssFileName = url.substring(url.lastIndexOf('/') + 1);
cssFileName = cssFileName.substring(0, cssFileName.lastIndexOf('.'));
ThemeContribution themeContribution = themeEngine.getThemeContributionByWebId(cssFileName);
diff --git a/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/webapp/VaadinUI.java b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/webapp/VaadinUI.java
index 369cba4..839cf42 100644
--- a/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/webapp/VaadinUI.java
+++ b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/webapp/VaadinUI.java
@@ -350,6 +350,8 @@
!user.getPerspective().isEmpty() &&
dslMetadataService.isPerspectiveAuthorized(user.getPerspective(), userAccessService)) {
perspectiveProvider.openPerspective(user.getPerspective());
+ } else {
+ perspectiveProvider.openPerspective("welcomeScreen", "Welcome", WelcomeView.class);
}
}
}
diff --git a/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/webapp/WelcomeView.java b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/webapp/WelcomeView.java
new file mode 100644
index 0000000..0355534
--- /dev/null
+++ b/org.eclipse.osbp.vaaclipse.addons.app/src/org/eclipse/osbp/vaaclipse/addons/app/webapp/WelcomeView.java
@@ -0,0 +1,87 @@
+/**
+ *
+ * Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
+ *
+ */
+package org.eclipse.osbp.vaaclipse.addons.app.webapp;
+
+import java.util.Locale;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.osbp.ui.api.themes.IThemeResourceService;
+import org.eclipse.osbp.ui.api.user.IUser;
+
+import com.vaadin.server.ClientConnector;
+import com.vaadin.server.ClientConnector.AttachEvent;
+import com.vaadin.server.ClientConnector.DetachEvent;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.AbstractComponent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.VerticalLayout;
+
+public class WelcomeView implements IUser.UserLocaleListener, ClientConnector.DetachListener, ClientConnector.AttachListener {
+
+ private static final long serialVersionUID = 1L;
+ private AbstractComponent label = null;
+ private VerticalLayout parent;
+ private transient IThemeResourceService themeResourceService;
+ private transient IUser user;
+ private Locale locale;
+
+ @Inject
+ public WelcomeView(VerticalLayout parent, IEclipseContext context, MApplication app) {
+ this.parent = parent;
+ this.themeResourceService = context.get(IThemeResourceService.class);
+ this.user = context.get(IUser.class);
+ locale = user.getLocale();
+ parent.addStyleName("os-welcome");
+ parent.addAttachListener(this);
+ parent.addDetachListener(this);
+ }
+
+ @PostConstruct
+ public void render() {
+ renderView();
+ }
+
+ private void renderView() {
+ if (label != null) {
+ parent.removeComponent(label);
+ }
+ label = new Label(themeResourceService.getThemeResourceHTML("WelcomeTRANSLATABLE", locale), ContentMode.HTML);
+ label.setSizeFull();
+ parent.addComponent(label);
+ parent.setMargin(true);
+ }
+
+ @Override
+ public void attach(AttachEvent event) {
+ user.addUserLocaleListener(this);
+ }
+
+ @Override
+ public void detach(DetachEvent event) {
+ user.removeUserLocaleListener(this);
+ }
+
+ @Override
+ public void localeChanged(Locale locale) {
+ this.locale = locale;
+ parent.removeAllComponents();
+ renderView();
+ }
+}
diff --git a/org.eclipse.osbp.vaaclipse.addons.common/src/org/eclipse/osbp/vaaclipse/addons/common/resource/ResourceHandler.java b/org.eclipse.osbp.vaaclipse.addons.common/src/org/eclipse/osbp/vaaclipse/addons/common/resource/ResourceHandler.java
index 62ae946..f9e348f 100644
--- a/org.eclipse.osbp.vaaclipse.addons.common/src/org/eclipse/osbp/vaaclipse/addons/common/resource/ResourceHandler.java
+++ b/org.eclipse.osbp.vaaclipse.addons.common/src/org/eclipse/osbp/vaaclipse/addons/common/resource/ResourceHandler.java
@@ -50,6 +50,9 @@
import org.eclipse.e4.ui.model.application.MApplicationElement;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement;
import org.eclipse.e4.ui.workbench.IWorkbench;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
@@ -62,8 +65,8 @@
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osbp.vaaclipse.addons.common.api.resource.ICustomizedModelResourceHandler;
+import org.eclipse.osgi.service.datalocation.Location;
import org.osgi.framework.Bundle;
/**
@@ -646,9 +649,6 @@
* @return a resource with a proper save path with the model as contents
*/
protected Resource createResourceForSave(MPerspective perspective) {
- E4XMIResource originalResource = (E4XMIResource) ((EObject) perspective)
- .eResource();
-
// create a new resource with the copied application model and same URI
//
URI saveLocation = URI
@@ -667,6 +667,9 @@
// Removes all transient objects
//
removeTransientObjects(copyPerspective);
+
+ // remove dangling refs
+ removeDanglingRefs((MPerspective) copyPerspective);
// set the copy to the new resource
//
@@ -699,4 +702,36 @@
return toSaveResource;
}
+
+ private void removeDanglingRefs(MPerspective perspective) {
+ perspective.setParent(null);
+ for(MUIElement child:perspective.getChildren()) {
+ if(child instanceof MPartSashContainer) {
+ iterateSash((MPartSashContainer)child);
+ }
+ if(child instanceof MPart) {
+ clearPart((MPart)child);
+ }
+ }
+ }
+
+ private void iterateSash(MPartSashContainer sash) {
+ for(MPartSashContainerElement element:((MPartSashContainer)sash).getChildren()) {
+ if(element instanceof MPart) {
+ clearPart((MPart)element);
+ }
+ if(element instanceof MPartSashContainer) {
+ iterateSash((MPartSashContainer) element);
+ }
+ }
+ }
+
+ private void clearPart(MPart part) {
+ if(part.getBindingContexts() != null) {
+ part.getBindingContexts().clear();
+ }
+ if(part.getToolbar() != null) {
+ part.setToolbar(null);
+ }
+ }
}
diff --git a/org.eclipse.osbp.vaaclipse.addons.ecview.lib/.classpath b/org.eclipse.osbp.vaaclipse.addons.ecview.lib/.classpath
index 630e6c5..ac37352 100644
--- a/org.eclipse.osbp.vaaclipse.addons.ecview.lib/.classpath
+++ b/org.eclipse.osbp.vaaclipse.addons.ecview.lib/.classpath
@@ -3,6 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
- <classpathentry kind="src" path="model"/>
+ <classpathentry kind="src" path="model/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.osbp.vaaclipse.addons.ecview/.classpath b/org.eclipse.osbp.vaaclipse.addons.ecview/.classpath
index 630e6c5..ac37352 100644
--- a/org.eclipse.osbp.vaaclipse.addons.ecview/.classpath
+++ b/org.eclipse.osbp.vaaclipse.addons.ecview/.classpath
@@ -3,6 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
- <classpathentry kind="src" path="model"/>
+ <classpathentry kind="src" path="model/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
diff --git a/org.eclipse.osbp.vaaclipse.addons.login/.project b/org.eclipse.osbp.vaaclipse.addons.login/.project
index c9ad268..0a866d1 100644
--- a/org.eclipse.osbp.vaaclipse.addons.login/.project
+++ b/org.eclipse.osbp.vaaclipse.addons.login/.project
@@ -26,11 +26,6 @@
</arguments>
</buildCommand>
<buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
<name>com.vaadin.integration.eclipse.addonStylesBuilder</name>
<arguments>
</arguments>
@@ -40,6 +35,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
diff --git a/org.eclipse.osbp.vaaclipse.addons.login/.settings/org.eclipse.xtend.core.Xtend.prefs b/org.eclipse.osbp.vaaclipse.addons.login/.settings/org.eclipse.xtend.core.Xtend.prefs
index 6155a21..f6a7c78 100644
--- a/org.eclipse.osbp.vaaclipse.addons.login/.settings/org.eclipse.xtend.core.Xtend.prefs
+++ b/org.eclipse.osbp.vaaclipse.addons.login/.settings/org.eclipse.xtend.core.Xtend.prefs
@@ -1,4 +1,5 @@
//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend
+BuilderConfiguration.is_project_specific=true
eclipse.preferences.version=1
is_project_specific=true
outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true