Search in sources :

Example 1 with DTDNode

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

the class ReplaceEmptyContentModelWithGroupAction method run.

public void run() {
    DTDNode node = getFirstNodeSelected();
    if (node instanceof Element) {
        CMNode contentModel = ((Element) node).getContentModel();
        if (CMNode.EMPTY.equals(contentModel.getType())) {
            getModel().beginRecording(this, getText());
            // $NON-NLS-1$
            ((Element) node).replaceContentModel(this, "()");
            getModel().endRecording(this);
        }
    }
}
Also used : DTDNode(org.eclipse.wst.dtd.core.internal.DTDNode) Element(org.eclipse.wst.dtd.core.internal.Element) CMNode(org.eclipse.wst.dtd.core.internal.CMNode)

Example 2 with DTDNode

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

the class ReplaceEmptyContentModelWithGroupAction method updateSelection.

protected boolean updateSelection(IStructuredSelection selection) {
    boolean rc = super.updateSelection(selection);
    DTDNode node = getFirstNodeSelected(selection);
    setEnabled(node instanceof Element);
    return rc;
}
Also used : DTDNode(org.eclipse.wst.dtd.core.internal.DTDNode) Element(org.eclipse.wst.dtd.core.internal.Element)

Example 3 with DTDNode

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

the class AddElementAction method run.

public void run() {
    DTDNode selectedNode = getFirstNodeSelected();
    DTDFile dtdFile = getModel().getDTDFile();
    String elementName = DTDUniqueNameHelper.getUniqueElementName(dtdFile);
    // $NON-NLS-1$
    dtdFile.createElement(selectedNode, elementName, true);
}
Also used : DTDNode(org.eclipse.wst.dtd.core.internal.DTDNode) DTDFile(org.eclipse.wst.dtd.core.internal.DTDFile)

Example 4 with DTDNode

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

the class AddEntityAction method run.

public void run() {
    DTDNode selectedNode = getFirstNodeSelected();
    // $NON-NLS-1$
    getModel().getDTDFile().createEntity(selectedNode, "NewEntity", true);
// newElement.setName(DTDUniqueNameHelper.getUniqueElementName(dtdFile));
}
Also used : DTDNode(org.eclipse.wst.dtd.core.internal.DTDNode)

Example 5 with DTDNode

use of org.eclipse.wst.dtd.core.internal.DTDNode 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)

Aggregations

DTDNode (org.eclipse.wst.dtd.core.internal.DTDNode)32 DTDFile (org.eclipse.wst.dtd.core.internal.DTDFile)13 Element (org.eclipse.wst.dtd.core.internal.Element)13 Iterator (java.util.Iterator)9 AttributeList (org.eclipse.wst.dtd.core.internal.AttributeList)8 NodeList (org.eclipse.wst.dtd.core.internal.NodeList)6 CMGroupNode (org.eclipse.wst.dtd.core.internal.CMGroupNode)5 CMNode (org.eclipse.wst.dtd.core.internal.CMNode)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 Attribute (org.eclipse.wst.dtd.core.internal.Attribute)4 CMBasicNode (org.eclipse.wst.dtd.core.internal.CMBasicNode)3 Comment (org.eclipse.wst.dtd.core.internal.Comment)3 Entity (org.eclipse.wst.dtd.core.internal.Entity)3 Image (org.eclipse.swt.graphics.Image)2 ParameterEntityReference (org.eclipse.wst.dtd.core.internal.ParameterEntityReference)2 TopLevelNode (org.eclipse.wst.dtd.core.internal.TopLevelNode)2 DTDModelImpl (org.eclipse.wst.dtd.core.internal.document.DTDModelImpl)2 Separator (org.eclipse.jface.action.Separator)1