/** * Each derived class must call this method in its constructor * to build up its contents. */ protected void makeBuddySystem(CMNamedNodeMap original) { Iterator i = original.iterator(); if (i == null) return; while (i.hasNext()) { CMNode org = (CMNode) i.next(); String key = getKeyName(org); CMNode newNode = createBuddySystem(org); put(key, newNode); } }
private List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
private void addSSIDecls() { CMDocument ssi = SSICMDocumentFactory.getCMDocument(); if (ssi == null) return; CMNamedNodeMap elements = ssi.getElements(); Iterator i = elements.iterator(); while (i.hasNext()) { CMElementDeclaration decl = (CMElementDeclaration) i.next(); if (decl == null) continue; put(decl.getElementName(), decl); } } }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; } }
protected void addBlockMarkers(CMDocument doc) { if (doc.getElements().getLength() > 0) { Iterator elements = doc.getElements().iterator(); CMNode node = null; while (elements.hasNext()) { node = (CMNode) elements.next(); getBlockMarkers().add(new BlockMarker(node.getNodeName(), null, DOMJSPRegionContexts.JSP_CONTENT, true)); } } }
for (Iterator i = elements.iterator(); i.hasNext(); )
protected void addBlockMarkers(String prefix, CMDocument doc) { if (doc.getElements().getLength() > 0) { Iterator elements = doc.getElements().iterator(); CMNode node = null; while (elements.hasNext()) { node = (CMNode) elements.next(); if (node instanceof TLDElementDeclaration && ((TLDElementDeclaration) node).getBodycontent().equals(JSP12TLDNames.CONTENT_TAGDEPENDENT)) getBlockMarkers().add(new BlockMarker(prefix + node.getNodeName(), null, DOMRegionContext.BLOCK_TEXT, true)); else getBlockMarkers().add(new BlockMarker(prefix + node.getNodeName(), null, DOMJSPRegionContexts.JSP_CONTENT, true)); } } }
@Override protected void doCollect(IDOMElement target, String name, IFile file, INgBindingCollector collector) { String tagName = target.getTagName(); int index = name.lastIndexOf('.'); if (index != -1) { String part = name.substring(0, index); if (ATTR_PROP.equals(part)) { // completion for attributes CMElementDeclaration eltDecl = CMNodeUtil.getElementDeclaration(target); if (eltDecl != null) { Iterator it = eltDecl.getAttributes().iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); collector.collect(name, part + "." + attr.getAttrName(), null, this); } } } } else { DomElementSchemaRegistry.INSTANCE.collectProperty(tagName, DomElementSchemaRegistry.INSTANCE.getMappedPropName(name), this, collector); collector.collect(name, ATTR_PROP, formatAttr(ATTR_PROP), this); collector.collect(name, CLASS_PROP, formatAttr(CLASS_PROP), this); } // style already exists } }
/** * Add required attributes and default values, if set, to the created tag element * * To customize the attributes that get added, use TagCreationInfo metadata * * This method is provided as a utility for clients. It is not used by default * * @param element * @param creationData */ protected final void ensureRequiredAttrs(final Element element, final CreationData creationData) { CMElementDeclaration ed = CMUtil.getTLDElementDeclaration(creationData.getUri(), creationData.getTagName(), creationData.getModel().getDocument().getStructuredDocument()); if (ed != null) { for (Iterator it=ed.getAttributes().iterator();it.hasNext();){ CMAttributeDeclaration attr = (CMAttributeDeclaration)it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED && element.getAttribute(attr.getAttrName()) == null) { element.setAttribute(attr.getAttrName(), attr.getDefaultValue()); } } } }
private void checkRequiredAttributes(IDOMElement element, CMNamedNodeMap attrMap, IReporter reporter, IFile file, IStructuredDocument document, IStructuredDocumentRegion documentRegion) { Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { Attr a = element.getAttributeNode(attr.getAttrName()); if (a == null) { String msgText = NLS.bind(JSPCoreMessages.JSPDirectiveValidator_5, attr.getAttrName()); LocalizedMessage message = new LocalizedMessage(fSeverityMissingRequiredAttribute, msgText, file); int start = element.getStartOffset(); int length = element.getStartEndOffset() - start; int lineNo = document.getLineOfOffset(start); message.setLineNo(lineNo); message.setOffset(start); message.setLength(length); reporter.addMessage(fMessageOriginator, message); } } } }
while (it.hasNext()) { doc = (CMDocument) it.next(); elements = doc.getElements().iterator(); while (elements.hasNext()) { node = (CMNode) elements.next();