use of org.eclipse.vorto.perspective.view.ModelProjectTreeViewer in project vorto by eclipse.
the class ModelDropListener method performDrop.
@SuppressWarnings("unchecked")
public boolean performDrop(Object data) {
Object target = getTarget();
if (data instanceof IStructuredSelection) {
Object droppedResource = ((IStructuredSelection) data).getFirstElement();
IModelElement result = null;
for (DropSourceValidatorAndAction dropActor : dropActors) {
if (dropActor.validator.allow(target, droppedResource)) {
result = dropActor.action.performDrop(target, droppedResource);
break;
}
}
if (target != null) {
ModelProjectTreeViewer viewer = (ModelProjectTreeViewer) this.getViewer();
viewer.getLocalModelWorkspace().refreshCurrent();
if (target instanceof IModelElement) {
IModelElement targetModelElement = findTarget((IModelElement) target, (Collection<IModelElement>) viewer.getInput());
if (targetModelElement != null) {
viewer.expandToLevel(targetModelElement, 1);
}
}
return true;
}
}
return false;
}
Aggregations