public void drop(DropTargetEvent event) {
IType type = null;
AspectManagerNode targetManager = (AspectManagerNode) getTarget(event);
Object source = SelectionUtil.getSingleElement(LocalSelectionTransfer.getInstance().getSelection());
if (source instanceof AspectNode) {
AspectNode aspect = (AspectNode) source;
// Since there is no classpath information in an AspectSurrogate, we
// have to seek the aspect class.
IJavaProject[] projects = getJavaProjects();
for (int i = 0; i < projects.length; i++) {
try {
type = projects[i].findType(aspect.getAspect().getAspectClassName());
if (type != null)
break;
} catch (JavaModelException e) {
ProsePlugin.log(e.getStatus());
break;
}
}
if (type == null) {
ProsePlugin.openErrorDialog("No aspect found", "No project contains an aspect named "
+ aspect.getAspect().getAspectClassName() + '.');
event.detail = DND.DROP_NONE;
return;
}
} else if (source instanceof ICompilationUnit){
type = ((ICompilationUnit) source).findPrimaryType();