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);
}
}
}
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;
}
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);
}
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));
}
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;
}
Aggregations