Bug 315362 - [Tooling] ClassCastException in WorkbenchModel Editor in 3.x host mode
diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java
index ae09874..ba0d738 100644
--- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java
+++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/E4CompatEditorPart.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.e4.tools.emf.editor3x.compat;
import org.eclipse.core.resources.IProject;
diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java
index 8380681..875e826 100644
--- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java
+++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/IEclipseContextServiceFactory.java
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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
+ * Simon Chemouil <eclipse@mithrandir.net> - bugfix 315362
+ ******************************************************************************/
package org.eclipse.e4.tools.emf.editor3x.compat;
import org.eclipse.core.runtime.IExtensionRegistry;
@@ -64,11 +75,15 @@
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if( ! selection.isEmpty() ) {
- IStructuredSelection s = (IStructuredSelection) selection;
- if( s.size() == 1 ) {
- windowContext.set(IServiceConstants.SELECTION, s.getFirstElement());
+ if( ! (selection instanceof IStructuredSelection) ) {
+ windowContext.set(ISelection.class, selection);
} else {
- windowContext.set(IServiceConstants.SELECTION, s.toList());
+ IStructuredSelection s = (IStructuredSelection) selection;
+ if( s.size() == 1 ) {
+ windowContext.set(IServiceConstants.SELECTION, s.getFirstElement());
+ } else {
+ windowContext.set(IServiceConstants.SELECTION, s.toList());
+ }
}
}
}
diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java
index b150034..e908509 100644
--- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java
+++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/compat/SelectionProviderContextFunction.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.e4.tools.emf.editor3x.compat;
import java.util.List;