Package org.eclipse.wst.xml.core.internal.contentmodel

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


                //  }
                //}
                //cmAttributes = allAttributes;

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

                  //BUG214516/196544 - Fixed NPE that was caused by an attr having
                  // a null attr type
                  String defaultValue = null;
                  CMDataType attrType = attributeDeclaration.getAttrType();
                  if (attrType != null) {
                    if ((attrType.getImpliedValueKind() != CMDataType.IMPLIED_VALUE_NONE) && attrType.getImpliedValue() != null)
                      defaultValue = attrType.getImpliedValue();
                    else if ((attrType.getEnumeratedValues() != null) && (attrType.getEnumeratedValues().length > 0)) {
                      defaultValue = attrType.getEnumeratedValues()[0];
View Full Code Here


            lastRegion = startStructuredDocumentRegion.getRegionAtCharacterOffset(index - 1);
          }
          MultiTextEdit multiTextEdit = new MultiTextEdit();
          try {
            for (int i = insertAttrs.size() - 1; i >= 0; i--) {
              CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) insertAttrs.get(i);
              String requiredAttributeName = attrDecl.getAttrName();
              String defaultValue = attrDecl.getDefaultValue();
              if (defaultValue == null)
                defaultValue = ""; //$NON-NLS-1$
              String nameAndDefaultValue = " "; //$NON-NLS-1$
              if (i == 0 && lastRegion.getLength() > lastRegion.getTextLength())
                nameAndDefaultValue = ""; //$NON-NLS-1$
View Full Code Here

    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);
          }
        }
      }
    }
View Full Code Here

    //
    List availableAttributeList = modelQuery.getAvailableContent(parent, ed, ModelQuery.INCLUDE_ATTRIBUTES);

    for (Iterator i = availableAttributeList.iterator(); i.hasNext(); )
    {
      CMAttributeDeclaration ad = (CMAttributeDeclaration)i.next();
      if (modelQuery.canInsert(parent, ed, ad, 0, validityChecking))
      {
        Action action = new Action(ModelQueryAction.INSERT, parent, ad);
        actionList.add(action);
      }
View Full Code Here

        else if ((nodeName.equals(JSP11TLDNames.INFO) || nodeName.equals(JSP12TLDNames.DESCRIPTION)) && child.hasChildNodes()) {
          ed.setDescription(getContainedText(child));
        }
        // attributes
        else if (nodeName.equals(JSP11TLDNames.ATTRIBUTE)) {
          CMAttributeDeclaration attr = createAttributeDeclaration(document, child);
          ed.fAttributes.setNamedItem(attr.getAttrName(), attr);
        }
        // variables
        else if (nodeName.equals(JSP12TLDNames.VARIABLE)) {
          ed.getVariables().add(createVariable(child));
        }
View Full Code Here

    return false;
  }

  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) {
          // Attribute may be defined using a jsp:attribute action
          if (!checkJSPAttributeAction(element, attr)) {
            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);
View Full Code Here

    }

    NamedNodeMap attrs = element.getAttributes();
    for (int i = 0; i < attrs.getLength(); i++) {
      Attr a = (Attr) attrs.item(i);
      CMAttributeDeclaration adec = (CMAttributeDeclaration) cmAttrs.getNamedItem(a.getName());
      if (adec == null) {
        /*
         * No attr declaration was found. That is, the attr name is
         * undefined. Disregard it includes JSP structure or this
         * element supports dynamic attributes
View Full Code Here

    {
        if (_isInitialized.compareAndSet(false, true))
        {
            for (final Iterator it = _tldElement.getAttributes().iterator(); it.hasNext();)
            {
                final CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) it.next();
                getOrCreateAttribute(attrDecl.getAttrName());
            }
        }
    }
View Full Code Here

      visitCMNode(rootElementDeclaration);
     
      if ((includeOptions & INCLUDE_ATTRIBUTES) != 0)
      {
        v.addAll(attributeTable.values());
        CMAttributeDeclaration nillableAttribute = (CMAttributeDeclaration)rootElementDeclaration.getProperty("http://org.eclipse.wst/cm/properties/nillable"); //$NON-NLS-1$
        if (nillableAttribute != null)
        {
          v.add(nillableAttribute);
        }
      } 
View Full Code Here

      //                                                     
      CMNamedNodeMap map = ed.getAttributes();
      int mapLength = map.getLength();
      for (int i = 0; i < mapLength; i++)
      {                                                          
        CMAttributeDeclaration ad = (CMAttributeDeclaration)map.item(i);
        String attributeName = DOMNamespaceHelper.computeName(ad, element, null);
        if (ad.getUsage() == CMAttributeDeclaration.REQUIRED)
        {              
           Attr attr = element.getAttributeNode(attributeName);
           if (attr == null)
           {
             result = false;
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration

Copyright © 2018 www.massapicom. 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.