use of org.eclipse.wst.dtd.core.internal.Attribute 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;
}
use of org.eclipse.wst.dtd.core.internal.Attribute in project webtools.sourceediting by eclipse.
the class TypeSection method widgetSelected.
/**
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent)
*/
public void widgetSelected(SelectionEvent e) {
if (e.widget == typeCombo) {
Object input = getInput();
if (input instanceof Attribute) {
Attribute attribute = (Attribute) input;
attribute.setType(typeCombo.getText());
}
}
}
use of org.eclipse.wst.dtd.core.internal.Attribute in project webtools.sourceediting by eclipse.
the class DTDTreeContentProvider method getParents.
/**
* @param element get the tree parents of this element
* @return {@link List} of parents of the given element
*/
private List getParents(Object element) {
List parents = new ArrayList();
Object parent = null;
if (element instanceof DTDNode) {
DTDNode node = (DTDNode) element;
if (element instanceof Attribute) {
parent = node.getParentNode();
if (parent != null && parent instanceof AttributeList) {
parents.addAll(getElementParentsOfAttributeList((AttributeList) parent));
}
} else if (element instanceof AttributeList) {
parents.addAll(getElementParentsOfAttributeList((AttributeList) element));
}
// acting as a parent in the tree
if (isShowLogicalOrder()) {
Object[] indexedNodeLists = getChildren(((DTDModelImpl) fInputObject).getDTDFile());
for (int i = 0; i < indexedNodeLists.length && parent == null; i++) {
if (indexedNodeLists[i] instanceof NodeList) {
if (((NodeList) indexedNodeLists[i]).getNodes().contains(element)) {
parents.add(indexedNodeLists[i]);
}
}
}
}
// try and get the simple parent
parent = ((DTDNode) element).getParentNode();
if (parent != null) {
parents.add(parent);
}
// if no parents found must be new nodes so refresh from root
if (parents.size() == 0) {
parents.add(((DTDModelImpl) fInputObject).getDTDFile());
}
} else if (element instanceof NodeList && fInputObject instanceof DTDModelImpl) {
parents.add(((DTDModelImpl) fInputObject).getDTDFile());
}
return parents;
}
use of org.eclipse.wst.dtd.core.internal.Attribute in project webtools.sourceediting by eclipse.
the class DTDVisitor method visitAttributes.
public void visitAttributes(List attributes) {
int size = attributes.size();
for (int i = 0; i < size; i++) {
Attribute attr = (Attribute) attributes.get(i);
visitAttribute(attr);
}
}
use of org.eclipse.wst.dtd.core.internal.Attribute in project webtools.sourceediting by eclipse.
the class AttributeDefaultSection method widgetSelected.
public void widgetSelected(SelectionEvent e) {
if (e.widget == usageCombo) {
Object input = getInput();
if (input instanceof Attribute) {
String usage = usageCombo.getText();
Attribute attribute = (Attribute) input;
if (usage.equals(DTDPropertiesMessages._UI_DEFAULT))
// $NON-NLS-1$
attribute.setDefaultKind("");
else
attribute.setDefaultKind(usage);
if (DTDPropertiesMessages._UI_DEFAULT.equals(usage) || FIXED.equals(usage)) {
defaultValueLabel.setVisible(true);
defaultValueText.setVisible(true);
defaultValueText.setEnabled(true);
} else {
defaultValueLabel.setVisible(false);
defaultValueText.setVisible(false);
defaultValueText.setEnabled(false);
}
}
}
}
Aggregations