Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorashatalin2006-09-01 08:39:03 -0400
committerashatalin2006-09-01 08:39:03 -0400
commitea95ae2ad329fb65bce945c36241716f5562ced4 (patch)
treefc28b7f4609c19eed37df23851072396f6d6d37a
parent4b6bd1e8a0556e69b61e9ed117466b2c25257037 (diff)
downloadorg.eclipse.gmf-tooling-ea95ae2ad329fb65bce945c36241716f5562ced4.tar.gz
org.eclipse.gmf-tooling-ea95ae2ad329fb65bce945c36241716f5562ced4.tar.xz
org.eclipse.gmf-tooling-ea95ae2ad329fb65bce945c36241716f5562ced4.zip
[155966] - No valid diagram root in "Initialize ... diagram file" wizard on XSD generated models
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreElementChooserDialog.java5
-rw-r--r--examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreNewDiagramFileWizard.java17
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/editor/ElementChooser.javajet3
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet13
4 files changed, 34 insertions, 4 deletions
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreElementChooserDialog.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreElementChooserDialog.java
index 451f49146..877794639 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreElementChooserDialog.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreElementChooserDialog.java
@@ -50,6 +50,8 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.emf.ecore.util.FeatureMap;
+
import org.eclipse.emf.edit.provider.IWrapperItemProvider;
/**
@@ -332,6 +334,9 @@ public class EcoreElementChooserDialog extends Dialog {
if (selectedElement instanceof IWrapperItemProvider) {
selectedElement = ((IWrapperItemProvider) selectedElement).getValue();
}
+ if (selectedElement instanceof FeatureMap.Entry) {
+ selectedElement = ((FeatureMap.Entry) selectedElement).getValue();
+ }
if (selectedElement instanceof EObject) {
mySelectedModelElement = (EObject) selectedElement;
setOkButtonEnabled(ViewService.getInstance().provides(Node.class, new EObjectAdapter(mySelectedModelElement), myView, null, ViewUtil.APPEND, true,
diff --git a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreNewDiagramFileWizard.java b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreNewDiagramFileWizard.java
index 343aa5811..217b031aa 100644
--- a/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreNewDiagramFileWizard.java
+++ b/examples/org.eclipse.gmf.ecore.editor/src/org/eclipse/gmf/ecore/part/EcoreNewDiagramFileWizard.java
@@ -36,6 +36,10 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.FeatureMap;
+
+import org.eclipse.emf.edit.provider.IWrapperItemProvider;
+
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
@@ -263,8 +267,17 @@ public class EcoreNewDiagramFileWizard extends Wizard {
myDiagramRoot = null;
if (event.getSelection() instanceof IStructuredSelection) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- if (selection.size() == 1 && selection.getFirstElement() instanceof EObject) {
- myDiagramRoot = (EObject) selection.getFirstElement();
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof IWrapperItemProvider) {
+ selectedElement = ((IWrapperItemProvider) selectedElement).getValue();
+ }
+ if (selectedElement instanceof FeatureMap.Entry) {
+ selectedElement = ((FeatureMap.Entry) selectedElement).getValue();
+ }
+ if (selectedElement instanceof EObject) {
+ myDiagramRoot = (EObject) selectedElement;
+ }
}
}
setPageComplete(validatePage());
diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/ElementChooser.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/ElementChooser.javajet
index 57a9ff27c..d64a92b2e 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/editor/ElementChooser.javajet
+++ b/plugins/org.eclipse.gmf.codegen/templates/editor/ElementChooser.javajet
@@ -336,6 +336,9 @@ for (Iterator it = genDiagram.getContainsShortcutsTo().iterator(); it.hasNext();
if (selectedElement instanceof <%=importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider")%>) {
selectedElement = ((<%=importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider")%>) selectedElement).getValue();
}
+ if (selectedElement instanceof <%=importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Entry) {
+ selectedElement = ((<%=importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Entry) selectedElement).getValue();
+ }
if (selectedElement instanceof EObject) {
mySelectedModelElement = (EObject) selectedElement;
setOkButtonEnabled(ViewService.getInstance().provides(Node.class, new EObjectAdapter(mySelectedModelElement), myView, null, ViewUtil.APPEND, true, <%=importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())%>.DIAGRAM_PREFERENCES_HINT));
diff --git a/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet b/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet
index dec4d547a..d0d4107e9 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet
+++ b/plugins/org.eclipse.gmf.codegen/templates/editor/NewDiagramFileWizard.javajet
@@ -238,8 +238,17 @@ if (!genDiagram.isSynchronized()) {
myDiagramRoot = null;
if (event.getSelection() instanceof <%=importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")%>) {
<%=importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")%> selection = (<%=importManager.getImportedName("org.eclipse.jface.viewers.IStructuredSelection")%>) event.getSelection();
- if (selection.size() == 1 && selection.getFirstElement() instanceof EObject) {
- myDiagramRoot = (EObject) selection.getFirstElement();
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof <%=importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider")%>) {
+ selectedElement = ((<%=importManager.getImportedName("org.eclipse.emf.edit.provider.IWrapperItemProvider")%>) selectedElement).getValue();
+ }
+ if (selectedElement instanceof <%=importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Entry) {
+ selectedElement = ((<%=importManager.getImportedName("org.eclipse.emf.ecore.util.FeatureMap")%>.Entry) selectedElement).getValue();
+ }
+ if (selectedElement instanceof EObject) {
+ myDiagramRoot = (EObject) selectedElement;
+ }
}
}
setPageComplete(validatePage());

Back to the top