// now remove the selected element
removeGui(selectedElement);
}
if (element instanceof MContribution) {
MContribution contribution = (MContribution) element;
Object client = contribution.getObject();
IEclipseContext parentContext = renderer.getModelContext(element);
if (parentContext != null && client != null) {
try {
ContextInjectionFactory.invoke(client,
PersistState.class, parentContext, null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
renderer.destroyWidget(element);
if (element instanceof MContribution) {
MContribution contribution = (MContribution) element;
Object client = contribution.getObject();
IEclipseContext parentContext = renderer.getModelContext(element);
if (parentContext != null && client != null) {
try {
ContextInjectionFactory.uninject(client, parentContext);
} catch (Exception e) {
e.printStackTrace();
}
}
contribution.setObject(null);
}
// dispose the context
if (element instanceof MContext) {
clearContext((MContext) element);