List<DescriptionElementBase> descriptionElements = new ArrayList<DescriptionElementBase>();
for (Object object : selection.toList()){
if(object instanceof DescriptionBase){
- descriptionElements.addAll(((DescriptionBase) object).getElements());
+ if (!((DescriptionBase) object).getElements().isEmpty()){
+ descriptionElements.addAll(((DescriptionBase) object).getElements());
+ }
description = HibernateProxyHelper.deproxy(object, DescriptionBase.class);
}else if(object instanceof FeatureNodeContainer){
}
if (DescriptionElementTransfer.getInstance().isSupportedType(
event.dataType)) {
- event.data = descriptionElements.toArray(new DescriptionElementBase[descriptionElements.size()]);
+ if (!descriptionElements.isEmpty()){
+ event.data = descriptionElements.toArray(new DescriptionElementBase[descriptionElements.size()]);
+ }
}
boolean isCopy = getCurrentOperation() == DND.DROP_COPY ? true : false;
// cannot drop a feature node onto itself
- for (Object droppedElement : droppedElements) {
- if (droppedElement == null){
- MessagingUtils.warningDialog("Operation not supported yet", this, "We are currently unable to drag and drop a newly created element. Please save the editor to make this work.");
- return false;
- }
- if(! (droppedElement instanceof DescriptionElementBase)){
- return false;
- }else{
- DescriptionElementBase descriptionElement = (DescriptionElementBase) droppedElement;
-
- if (descriptionElement.getInDescription().equals(target)) {
+ if (droppedElements != null){
+ for (Object droppedElement : droppedElements) {
+ if (droppedElement == null){
+ MessagingUtils.warningDialog("Operation not supported yet", this, "We are currently unable to drag and drop a newly created element. Please save the editor to make this work.");
return false;
}
-
- descriptionElements.add(descriptionElement);
- }
+ if(! (droppedElement instanceof DescriptionElementBase)){
+ return false;
+ }else{
+ DescriptionElementBase descriptionElement = (DescriptionElementBase) droppedElement;
+
+ if (descriptionElement.getInDescription().equals(target)) {
+ return false;
+ }
+
+ descriptionElements.add(descriptionElement);
+ }
+ }
+
+ AbstractPostOperation operation = new MoveDescriptionElementsOperation("Move Descriptions", EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null);
+
+ EditorUtil.executeOperation(operation);
+ return true;
}
+ MessagingUtils.warningDialog("Operation not supported yet", this, "We are unable to drag and drop empty descriptions");
+
+ return false;
- AbstractPostOperation operation = new MoveDescriptionElementsOperation("Move Descriptions", EditorUtil.getUndoContext(), target, descriptionElements, isCopy, null);
-
- EditorUtil.executeOperation(operation);
-
-
- return true;
}
/* (non-Javadoc)