Community
Participate
Working Groups
Created attachment 242952 [details] Stacktrace If I use the cloneSnippet method in a model processor I get a NPE because EPlaceholderResolver is null at this point in time. Example: @Execute public void notWorkingexecute(EPartService partService, EModelService modelService, MApplication app) { // looking for the main window MWindow window = app.getChildren().get(0); // Cloning the snippet modelService.cloneSnippet(app, "test", window); // clonedPart.setParent((MElementContainer<MUIElement>) target); } With I do the same with EMF functionality it works @Execute public void workingExecute(EPartService partService, EModelService modelService, MApplication app) { // cloning the snippet manualy using EMF MUIElement sourceSnippet = modelService.findSnippet(app, "com.intel.test.application.snippet.part.toput"); MUIElement clonedPart = (MUIElement) EcoreUtil.copy((EObject) sourceSnippet); MUIElement target = modelService.find("test", app); clonedPart.setParent((MElementContainer<MUIElement>) target); }
EPlaceholderResolver is not null, it is the application.getContext() which is null.
(In reply to Lars Vogel from comment #1) > EPlaceholderResolver is not null, it is the application.getContext() which > is null. ((MApplication) appElement).getContext() returns null EPlaceholderResolver resolver = ((MApplication) appElement).getContext().get( EPlaceholderResolver.class);
https://git.eclipse.org/r/26349
Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=4ced8ee491c0c700fe143db6bf57977c59cc20c2 PW
Verified in Build id: I20140515-1230