use of org.eclipse.wst.xsd.ui.internal.actions.MoveXSDAttributeAction in project webtools.sourceediting by eclipse.
the class XSDAttributeDragAndDropCommand method doDrop.
protected void doDrop(List siblings, GraphicalEditPart movingEditPart) {
commonSetup(siblings, movingEditPart);
if ((previousRefComponent instanceof XSDAttributeDeclaration || previousRefComponent instanceof XSDWildcard) && (nextRefComponent instanceof XSDAttributeDeclaration || nextRefComponent instanceof XSDWildcard)) {
XSDConcreteComponent parent = previousRefComponent.getContainer().getContainer();
if (closerSibling == BELOW_IS_CLOSER) {
parent = nextRefComponent.getContainer().getContainer();
}
action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
} else if (previousRefComponent == null && (nextRefComponent instanceof XSDAttributeDeclaration || nextRefComponent instanceof XSDWildcard)) {
XSDConcreteComponent parent = nextRefComponent.getContainer().getContainer();
if (closerSibling == ABOVE_IS_CLOSER) {
if (leftSiblingEditPart == null) {
action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
} else if (parentEditPart != null) {
action = new MoveXSDAttributeAction(parentEditPart.getXSDConcreteComponent(), xsdComponentToDrag, previousRefComponent, nextRefComponent);
}
} else {
action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
}
} else if (previousRefComponent instanceof XSDAttributeDeclaration && nextRefComponent == null) {
XSDConcreteComponent parent = previousRefComponent.getContainer().getContainer();
if (closerSibling == ABOVE_IS_CLOSER) {
action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
} else {
if (rightSiblingEditPart == null) {
action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
} else {
action = new MoveXSDAttributeAction(parent, xsdComponentToDrag, previousRefComponent, nextRefComponent);
}
}
}
if (action != null)
canExecute = action.canMove();
}
use of org.eclipse.wst.xsd.ui.internal.actions.MoveXSDAttributeAction in project webtools.sourceediting by eclipse.
the class XSDAttributeDragAndDropCommand method setup.
protected void setup() {
canExecute = false;
// Drop target is attribute group ref
if (target instanceof AttributeGroupDefinitionEditPart) {
parentEditPart = (AttributeGroupDefinitionEditPart) target;
if (((GenericGroupFigure) parentEditPart.getFigure()).getIconFigure().getBounds().contains(location)) {
xsdComponentToDrag = (XSDConcreteComponent) ((XSDAttributeDeclarationAdapter) itemToDrag.getModel()).getTarget();
action = new MoveXSDAttributeAction(((AttributeGroupDefinitionEditPart) parentEditPart).getXSDAttributeGroupDefinition(), xsdComponentToDrag, null, null);
canExecute = action.canMove();
}
} else if (target instanceof BaseFieldEditPart) {
targetSpacesList = new ArrayList();
// Calculate the list of all sibling field edit parts;
List targetEditPartSiblings = calculateFieldEditParts();
calculateAttributeGroupList();
// Get 'left' and 'right' siblings
doDrop(targetEditPartSiblings, itemToDrag);
}
}
Aggregations