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

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


  {
    List list = new ArrayList();                           
                              
    if (cmNode != null)
    {      
      CMDataType dataType = null;
      if (cmNode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION)
      {
        dataType = ((CMAttributeDeclaration)cmNode).getAttrType();
      }
      else if (cmNode.getNodeType() == CMNode.ELEMENT_DECLARATION)
      {
        dataType = ((CMElementDeclaration)cmNode).getDataType();
      }        
    
      String[] enumeratedValues = dataType != null ? dataType.getEnumeratedValues() : null;     
      if (enumeratedValues != null)
      {
        for (int i = 0; i < enumeratedValues.length; i++)
        {
          list.add(enumeratedValues[i]);
View Full Code Here


    if (parent.getNodeType() == Node.ELEMENT_NODE) {
      CMElementDeclaration parentDecl = getCMElementDeclaration(parent);
      if (parentDecl != null) {
        // XSD-specific ability - no filtering
        CMDataType childType = parentDecl.getDataType();
        if (childType != null) {
          String[] childStrings = childType.getEnumeratedValues();
          String defaultValue = childType.getImpliedValue();
          if (childStrings != null || defaultValue != null) {
            // the content string is the sole valid child...so
            // replace the rest
            int begin = contentAssistRequest.getReplacementBeginPosition();
            int length = contentAssistRequest.getReplacementLength();
View Full Code Here

    }
  }

  protected void contributeTextNodeActions(IMenuManager menu, Element parentElement, CMElementDeclaration parentEd, int index) {
    if ((parentEd == null) || isTextAllowed(parentEd)) {
      CMDataType dataType = parentEd != null ? parentEd.getDataType() : null;
      contributeAction(menu, createAddPCDataAction(parentElement, dataType, index));
      contributeAction(menu, createAddCDataSectionAction(parentElement, index));
    }
  }
View Full Code Here

  public void insertDefaultAttributes(IDOMElement element) {
    List<CMAttributeDeclaration> decls = getAttributeDeclarations(element);
    for (CMAttributeDeclaration decl : decls) {
      if (decl.getUsage() == CMAttributeDeclaration.REQUIRED) {
        String attrName = decl.getAttrName();
        CMDataType attrType = decl.getAttrType();
        String attrValue = element.getAttribute(attrName);
        // We don't want to overwrite an existing value.
        if (attrValue == null || attrValue.trim().length() == 0) {
          if (attrType != null) {
            if (attrType.getImpliedValueKind() != CMDataType.IMPLIED_VALUE_NONE
                && attrType.getImpliedValue() != null) {
              attrValue = attrType.getImpliedValue();
            }
            else if (attrType.getEnumeratedValues() != null && attrType.getEnumeratedValues().length > 0) {
              attrValue = attrType.getEnumeratedValues()[0];
            }
          }
          element.setAttribute(attrName, attrValue);
        }
      }
View Full Code Here

TOP

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

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.