Search in sources :

Example 1 with TopLevelNode

use of org.eclipse.wst.dtd.core.internal.TopLevelNode in project webtools.sourceediting by eclipse.

the class DTDDragAndDropManager method createCommand.

public DragAndDropCommand createCommand(Object target, float location, int operations, int operation, Collection source) {
    if (target instanceof DTDNode) {
        DTDNode node = (DTDNode) target;
        source = mergeSource(source);
        if (node instanceof TopLevelNode) {
            return new DragTopLevelNodesCommand(target, location, operations, operation, source);
        }
        if (node instanceof Attribute) {
            return new DragAttributeCommand(target, location, operations, operation, source);
        }
        if (node instanceof CMNode) {
            return new DragContentModelCommand(target, location, operations, operation, source);
        }
    }
    return null;
}
Also used : DTDNode(org.eclipse.wst.dtd.core.internal.DTDNode) Attribute(org.eclipse.wst.dtd.core.internal.Attribute) CMNode(org.eclipse.wst.dtd.core.internal.CMNode) TopLevelNode(org.eclipse.wst.dtd.core.internal.TopLevelNode)

Example 2 with TopLevelNode

use of org.eclipse.wst.dtd.core.internal.TopLevelNode in project webtools.sourceediting by eclipse.

the class DragTopLevelNodesCommand method execute.

public void execute() {
    DTDNode referenceNode = (DTDNode) target;
    DTDFile dtdFile = referenceNode.getDTDFile();
    dtdFile.getDTDModel().beginRecording(this, sources.size() > 1 ? moveNodes : moveNode);
    Iterator iter = sources.iterator();
    while (iter.hasNext()) {
        DTDNode node = (DTDNode) iter.next();
        if (node instanceof TopLevelNode) {
            dtdFile.moveNode(this, referenceNode, node, isAfter());
        }
    }
    dtdFile.getDTDModel().endRecording(this);
}
Also used : DTDNode(org.eclipse.wst.dtd.core.internal.DTDNode) Iterator(java.util.Iterator) TopLevelNode(org.eclipse.wst.dtd.core.internal.TopLevelNode) DTDFile(org.eclipse.wst.dtd.core.internal.DTDFile)

Aggregations

DTDNode (org.eclipse.wst.dtd.core.internal.DTDNode)2 TopLevelNode (org.eclipse.wst.dtd.core.internal.TopLevelNode)2 Iterator (java.util.Iterator)1 Attribute (org.eclipse.wst.dtd.core.internal.Attribute)1 CMNode (org.eclipse.wst.dtd.core.internal.CMNode)1 DTDFile (org.eclipse.wst.dtd.core.internal.DTDFile)1