Examples of CMNamedNodeMap


Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

      return null;
    try {
      if (fDefaultValueLookups == null)
        fDefaultValueLookups = new Stack();
      fDefaultValueLookups.push(name);
      CMNamedNodeMap map = ((DocumentImpl) getOwnerDocument()).getCMAttributes(this);
      if (map != null) {
        CMNode attribute = map.getNamedItem(name);
        if (attribute instanceof CMAttributeDeclaration)
          return ((CMAttributeDeclaration) attribute).getAttrType().getImpliedValue();
      }
      return unknownDefault;
    }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

   */
  private IContextInformation[] getInfoForElement(IDOMNode node) {
    IContextInformation[] results = EMPTY_CONTEXT_INFO;
    CMElementDeclaration decl = fModelUtil.getModelQuery().getCMElementDeclaration((Element) node);
    if (decl != null) {
      CMNamedNodeMap attributes = decl.getAttributes();

      CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl(attributes);
      List nodes = ModelQueryUtil.getModelQuery(node.getOwnerDocument()).getAvailableContent((Element) node, decl, ModelQuery.INCLUDE_ATTRIBUTES);
      for (int k = 0; k < nodes.size(); k++) {
        CMNode cmnode = (CMNode) nodes.get(k);
        if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION) {
          allAttributes.put(cmnode);
        }
      }
      attributes = allAttributes;
     
      String attrContextString = node.getNodeName();
      StringBuffer attrInfo = new StringBuffer(" "); //$NON-NLS-1$
      String name = ""; //$NON-NLS-1$
      HashMap attrPosMap = new HashMap();
      int pos = 0;
      int length = 0;
      int numPerLine = 8;

      CMAttributeDeclaration[] sortedAttrs = getSortedAttributes(attributes);

      for (int i = 0; i < sortedAttrs.length; i++) {
        name = sortedAttrs[i].getAttrName();
        length = name.length();
        pos = attrInfo.length();

        attrInfo.append(name);

        if (sortedAttrs[i].getUsage() == CMAttributeDeclaration.REQUIRED) {
          attrInfo.append("*"); //$NON-NLS-1$
          length++;
        }
        if (i < attributes.getLength() - 1) {
          attrInfo.append(" "); //$NON-NLS-1$
          if ((i != 0) && (i % numPerLine == 0)) {
            attrInfo.append("\n "); //$NON-NLS-1$
          }
        }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

                childConstraints.setIsWhitespaceStrategyAHint(true);
                childConstraints.setIsIndentStrategyAHint(true);
              }
              else {
                // look for xml:space in content model
                CMNamedNodeMap cmAttributes = elementDeclaration.getAttributes();

                // Not needed - we're looking for xml:space
                //CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl(cmAttributes);
                //List nodes = ModelQueryUtil.getModelQuery(currentNode.getOwnerDocument()).getAvailableContent((Element) currentNode, elementDeclaration, ModelQuery.INCLUDE_ATTRIBUTES);
                //for (int k = 0; k < nodes.size(); k++) {
                //  CMNode cmnode = (CMNode) nodes.get(k);
                //  if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION) {
                //    allAttributes.put(cmnode);
                //  }
                //}
                //cmAttributes = allAttributes;

                // Check implied values from the DTD way.
                CMAttributeDeclaration attributeDeclaration = (CMAttributeDeclaration) cmAttributes.getNamedItem(XML_SPACE);
                if (attributeDeclaration != null) {
                  // CMAttributeDeclaration found, check
                  // it
                  // out.
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

    ModelQuery modelQuery = getModelQuery(node);
    if (modelQuery != null) {
      CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node);
      if (elementDecl != null) {
        CMNamedNodeMap attrMap = elementDecl.getAttributes();

        CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl(attrMap);
        List nodes = ModelQueryUtil.getModelQuery(node.getOwnerDocument()).getAvailableContent((Element) node, elementDecl, ModelQuery.INCLUDE_ATTRIBUTES);
        for (int k = 0; k < nodes.size(); k++) {
          CMNode cmnode = (CMNode) nodes.get(k);
          if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION) {
            allAttributes.put(cmnode);
          }
        }
        attrMap = allAttributes;
       
        Iterator it = attrMap.iterator();
        CMAttributeDeclaration attr = null;
        while (it.hasNext()) {
          attr = (CMAttributeDeclaration) it.next();
          if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) {
            result.add(attr);
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

  }

  public abstract void generateAttribute(CMAttributeDeclaration attrDecl, StringBuffer buffer);

  protected void generateAttributes(CMElementDeclaration elementDecl, StringBuffer buffer) {
    CMNamedNodeMap attributes = elementDecl.getAttributes();
    if (attributes == null) {
      return;
    }
    for (int i = 0; i < attributes.getLength(); i++) {
      generateAttribute((CMAttributeDeclaration) attributes.item(i), buffer);
    }
    return;
  }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

  }

  public abstract String getStartTagClose(Node parentNode, CMElementDeclaration elementDecl);

  protected boolean requiresAttributes(CMElementDeclaration ed) {
    CMNamedNodeMap attributes = ed.getAttributes();
    if (attributes == null) {
      return false;
    }
    for (int i = 0; i < attributes.getLength(); i++) {
      if (((CMAttributeDeclaration) attributes.item(i)).getUsage() == CMAttributeDeclaration.REQUIRED) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

        return IXMLCharEntity.APOS_VALUE;
    }

    CMDocument cm = getCMDocument();
    if (cm != null) {
      CMNamedNodeMap map = cm.getEntities();
      if (map != null) {
        CMEntityDeclaration decl = (CMEntityDeclaration) map.getNamedItem(name);
        if (decl != null) {
          String value = decl.getValue();
          if (value == null)
            return null;
          int valueLength = value.length();
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

   * Provides an element's attribute declarations
   * @param element the element to retrieve the attribute map of
   * @return a <code>CMNamedNodeMap</code> of attributes if the declaration exists; null otherwise.
   */
  CMNamedNodeMap getCMAttributes(Element element) {
    CMNamedNodeMap map = (CMNamedNodeMap) fCMCache.get(element);
    if (map == null) {
      ModelQuery modelQuery = ModelQueryUtil.getModelQuery(this);
      CMElementDeclaration decl = modelQuery != null ? modelQuery.getCMElementDeclaration(element) : null;
      if (decl != null) {
        map = decl.getAttributes();
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

        // get entity proposals, passing in the appropriate start
        // string
        ModelQuery mq = ModelQueryUtil.getModelQuery(((Node) treeNode).getOwnerDocument());
        if (mq != null) {
          CMDocument xmlDoc = mq.getCorrespondingCMDocument(treeNode);
          CMNamedNodeMap cmmap = null;
          Properties entities = null;
          if (xmlDoc != null) {
            cmmap = xmlDoc.getEntities();
          }
          if (cmmap != null) {
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

   * @param cmdoc
   */
  private void loadFromCMDocument(final TaglibPaletteDrawer category,
      final CMDocument cmdoc) {

    final CMNamedNodeMap nodeMap = cmdoc.getElements();
    for (int i = 0, size = nodeMap.getLength(); i < size; i++) {
      final CMElementDeclaration eledecl = (CMElementDeclaration) nodeMap
          .item(i);
      final String tagName = eledecl.getElementName();
      TagToolPaletteEntry item;
      if (tagName.equalsIgnoreCase(IHTMLConstants.TAG_INPUT)) {// TODO:
                                    // fix
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.