use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IOrderableTreeObject in project convertigo by convertigo.
the class TreeDropAdapter method dragOver.
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ViewerDropAdapter#dragOver(org.eclipse.swt.dnd.DropTargetEvent)
*/
@Override
public void dragOver(DropTargetEvent event) {
super.dragOver(event);
// Overrides feedback: by default is DND.FEEDBACK_SELECT
feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
boolean shouldFeedBack = true;
if (PaletteSourceTransfer.getInstance().isSupportedType(event.currentDataType)) {
shouldFeedBack = false;
}
// Handles feedback for objects that can be ordered
if (shouldFeedBack && getCurrentOperation() == DND.DROP_MOVE) {
Object targetObject = getCurrentTarget();
Object sourceObject = getSelectedObject();
if ((sourceObject != null) && (targetObject != null)) {
// Source and target objects must be different
if (!sourceObject.equals(targetObject)) {
if ((sourceObject instanceof TreeObject) && (targetObject instanceof TreeObject)) {
// Source and target objects can be ordered
if ((sourceObject instanceof IOrderableTreeObject) && (targetObject instanceof IOrderableTreeObject)) {
// Source and target objects must have the same parent
if (((TreeObject) sourceObject).getParent().equals(((TreeObject) targetObject).getParent())) {
boolean srcInherited = false;
if (sourceObject instanceof DatabaseObjectTreeObject)
srcInherited = ((DatabaseObjectTreeObject) sourceObject).isInherited;
else if (sourceObject instanceof IPropertyTreeObject)
srcInherited = ((IPropertyTreeObject) sourceObject).isInherited();
// Source object musn't be inherited
if (!srcInherited) {
int currentLocation = getCurrentLocation();
switch(currentLocation) {
case LOCATION_BEFORE:
feedback = DND.FEEDBACK_INSERT_BEFORE;
break;
case LOCATION_AFTER:
feedback = DND.FEEDBACK_INSERT_AFTER;
break;
case LOCATION_ON:
default:
feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
break;
}
}
}
}
}
}
}
}
// Set feedback
event.feedback = feedback;
}
Aggregations