From 139afa00d97aa113d416b8ada89cd3b8c6f377fb Mon Sep 17 00:00:00 2001 From: gwendal Date: Tue, 10 Jan 2017 18:44:43 +0100 Subject: [PATCH] add a try .. catch to avoid editor error when using Dynamic API (refs #52) --- .../atlanmod/neoemf/eclipse/ui/editor/NeoEditor.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/eclipse/ui/src/main/java/fr/inria/atlanmod/neoemf/eclipse/ui/editor/NeoEditor.java b/plugins/eclipse/ui/src/main/java/fr/inria/atlanmod/neoemf/eclipse/ui/editor/NeoEditor.java index 8c1f05918c..ce2f244497 100644 --- a/plugins/eclipse/ui/src/main/java/fr/inria/atlanmod/neoemf/eclipse/ui/editor/NeoEditor.java +++ b/plugins/eclipse/ui/src/main/java/fr/inria/atlanmod/neoemf/eclipse/ui/editor/NeoEditor.java @@ -27,6 +27,7 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; import org.eclipse.emf.edit.ui.util.EditUIUtil; +import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ControlAdapter; @@ -152,6 +153,15 @@ public void controlResized(ControlEvent event) { NeoLogger.info("NeoEMF Editor Opened in {0}", Duration.between(begin, end)); } + + @Override + public void setSelection(ISelection selection) { + try { + super.setSelection(selection); + } catch(NoSuchMethodError e) { + NeoLogger.warn("Captured aNoSuchMethod error when changing the selection, please check this is not related to Dynamic EMF, which is not supported for now in the editor."); + } + } @Override public void dispose() {