Bug 568400: [Model2Doc] NPE creating a DocumentPrototype from a DocumentTemplate
- fix create prototype menu
Change-Id: I157ed4f6593b6e8bc24d346753244b0670149a4b
Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
diff --git a/plugins/dev/org.eclipse.papyrus.model2doc.dev.tools/src/org/eclipse/papyrus/model2doc/dev/tools/dialog/NewDocumentPrototypeDialog.java b/plugins/dev/org.eclipse.papyrus.model2doc.dev.tools/src/org/eclipse/papyrus/model2doc/dev/tools/dialog/NewDocumentPrototypeDialog.java
index 6a08cf4..22fb4a3 100755
--- a/plugins/dev/org.eclipse.papyrus.model2doc.dev.tools/src/org/eclipse/papyrus/model2doc/dev/tools/dialog/NewDocumentPrototypeDialog.java
+++ b/plugins/dev/org.eclipse.papyrus.model2doc.dev.tools/src/org/eclipse/papyrus/model2doc/dev/tools/dialog/NewDocumentPrototypeDialog.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2019 CEA LIST and others.
+ * Copyright (c) 2019, 2020 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,7 +10,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
+ * Pauline Deville (CEA LIST) pauline.deville@cea.fr - Bug 568400
*****************************************************************************/
package org.eclipse.papyrus.model2doc.dev.tools.dialog;
@@ -149,7 +149,9 @@
documentPrototypeIconPath = new Text(grp, SWT.BORDER);
data = new GridData(SWT.FILL, SWT.BEGINNING, true, true);
documentPrototypeIconPath.setLayoutData(data);
- documentPrototypeIconPath.setText(this.editedPrototype.getIconPath());
+ if (this.editedPrototype.getIconPath() != null) {
+ documentPrototypeIconPath.setText(this.editedPrototype.getIconPath());
+ }
// prototype description
final Label descriptionLabel = new Label(grp, SWT.None);
diff --git a/plugins/dev/org.eclipse.papyrus.model2doc.dev.tools/src/org/eclipse/papyrus/model2doc/dev/tools/handlers/CreatePrototypeFromTemplateHandler.java b/plugins/dev/org.eclipse.papyrus.model2doc.dev.tools/src/org/eclipse/papyrus/model2doc/dev/tools/handlers/CreatePrototypeFromTemplateHandler.java
index 9bf6ee2..6eaf0bc 100755
--- a/plugins/dev/org.eclipse.papyrus.model2doc.dev.tools/src/org/eclipse/papyrus/model2doc/dev/tools/handlers/CreatePrototypeFromTemplateHandler.java
+++ b/plugins/dev/org.eclipse.papyrus.model2doc.dev.tools/src/org/eclipse/papyrus/model2doc/dev/tools/handlers/CreatePrototypeFromTemplateHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2019 CEA LIST and others.
+ * Copyright (c) 2019, 2020 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -10,7 +10,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
+ * Pauline Deville (CEA LIST) pauline.deville@cea.fr - Bug 568400
*****************************************************************************/
@@ -65,7 +65,7 @@
prototype.setDocumentTemplate(copy);
copy.setDocumentTemplatePrototype(prototype);
- final NewDocumentPrototypeDialog d = new NewDocumentPrototypeDialog(Display.getDefault().getActiveShell(), prototype);
+ final NewDocumentPrototypeDialog d = new NewDocumentPrototypeDialog(Display.getCurrent().getActiveShell(), prototype);
if (d.open() == Dialog.OK) {