Examples of CMElementDeclaration


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

  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
                                    // this
                                    // nonsense!
View Full Code Here

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

      return false;
    Node node = (Node) host.getModel();
    if (node.getNodeType() == Node.ELEMENT_NODE) {
      ModelQuery modelQuery = getModelQuery(node);
      if (modelQuery != null) {
        CMElementDeclaration elementDecl = modelQuery
            .getCMElementDeclaration((Element) node);
        if (elementDecl == null) {
          return true;
        }
        if (elementDecl.getContentType() == CMElementDeclaration.EMPTY)
          return false;
      }
    }
    return true;
  }
View Full Code Here

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

   *
   * @param ele
   * @return the style class attribute name or null if none applies
   */
  public static String getStyleClassAttributeName(IDOMElement ele) {
    CMElementDeclaration decl = CMUtil.getElementDeclaration(ele);
    if (decl == null) {
      return null;
    }
    String taguri = CMUtil.getTagURI(decl);
    if (taguri == null || ITLDConstants.URI_HTML.equals(taguri)) {
      if (decl.getAttributes().getNamedItem("class") != null) { //$NON-NLS-1$
        return "class"; //$NON-NLS-1$
      }
            return null;
    } else if (decl.getAttributes().getNamedItem("styleClass") != null) { //$NON-NLS-1$
      return "styleClass"; //$NON-NLS-1$
    } else if (decl.getAttributes().getNamedItem("class") != null) { //$NON-NLS-1$
      return "class"; //$NON-NLS-1$
    } else {
      return null;
    }
  }
View Full Code Here

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

      menu.appendToGroup(PageDesignerActionConstants.GROUP_STYLE, action);
    }
  }

  private static boolean hasStyleAttribute(IDOMElement ele) {
    CMElementDeclaration decl = CMUtil.getElementDeclaration(ele);
    if (decl == null) {
      return false;
    }
    if (decl.getAttributes().getNamedItem("style") != null) { //$NON-NLS-1$
      return true;
    }
    return false;
  }
View Full Code Here

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

    }
    IElementEdit edit = this.getElementEdit();
    if (edit != null) {
      return edit.isResizable(this._elementNode);
    }
        CMElementDeclaration decl = CMUtil
            .getElementDeclaration(this._elementNode);
        if (decl != null) {
          // XXX: default implementation, if this element support "style"
          // attribute,
          // then we think it support resize.
          return decl.getAttributes().getNamedItem("style") != null; //$NON-NLS-1$
        }
        return true;
  }
View Full Code Here

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

      structModel = ((IDOMNode) fNode).getModel();
    }
    if (null == structModel) {
      return null;
    }
    CMElementDeclaration cmde = null;
    CMNamedNodeMap cmnnm = null;
    if (fNode == null || fNode.getNodeType() != Node.ELEMENT_NODE) {
      cmde = null;
    }
    ModelQuery modelQuery = ModelQueryUtil.getModelQuery(fNode
        .getOwnerDocument());
    if (modelQuery != null) {
      cmde = modelQuery.getCMElementDeclaration((Element) fNode);
    }
    if (cmde != null) {
      cmnnm = cmde.getAttributes();
    }
    return cmnnm;
  }
View Full Code Here

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

            }

            // basically, for HTML or non JSP tag, directly renders it.
            return new DumTagConverter(ele);
        }
        final CMElementDeclaration decl = CMUtil.getElementDeclaration(ele);
        if (decl == null)
        {
            if (PageDesignerTraceOptions.TRACE_CONVERTERSELECT)
            {
                PageDesignerTraceOptions
                        .log("ConverterFactoryRegistry: factory and decl not found, " //$NON-NLS-1$
                                + String
                                        .format(
                                                "Selected DumTagConverter for uri=%s, tagname=%s", //$NON-NLS-1$
                                                uri, ele.getLocalName()));
            }
            return new DumTagConverter(ele);
        }
        final int contentType = decl.getContentType();
        if (contentType == CMElementDeclaration.EMPTY)
        {
            if (PageDesignerTraceOptions.TRACE_CONVERTERSELECT)
            {
                PageDesignerTraceOptions
View Full Code Here

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

   * override this method, they should also use different command.
   *
   * @see org.eclipse.jst.pagedesigner.editpolicies.ElementResizableEditPolicy#getResizeCommand(org.eclipse.gef.requests.ChangeBoundsRequest)
   */
  public boolean isResizable(Element ele) {
    CMElementDeclaration decl = CMUtil.getElementDeclaration(ele);
    if (decl != null) {
      // XXX: default implementation, if this element support "style"
      // attribute,
      // then we think it support resize.
      return decl.getAttributes().getNamedItem("style") != null; //$NON-NLS-1$
    }
    return true;
  }
View Full Code Here

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

  /**
   * @param ele
   * @return true if supports the style attribute
   */
  public static boolean supportStyleAttribute(IDOMElement ele) {
    CMElementDeclaration decl = CMUtil.getElementDeclaration(ele);
    if (decl != null && decl.getAttributes().getNamedItem("style") != null) { //$NON-NLS-1$
      return true;
    }
        return false;
  }
View Full Code Here

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

     */
    @SuppressWarnings("deprecation")
    protected final void ensureRequiredAttrs(final Element element,
            final CreationData creationData)
    {
        final CMElementDeclaration ed = CMUtil.getTLDElementDeclaration(creationData
                .getUri(), creationData.getTagName(), creationData.getModel()
                .getDocument().getStructuredDocument());

        if (ed != null)
        {
            for (final Iterator it = ed.getAttributes().iterator(); it.hasNext();)
            {
                final CMAttributeDeclaration attr = (CMAttributeDeclaration) it
                        .next();
                if (attr.getUsage() == CMAttributeDeclaration.REQUIRED
                        && element.getAttribute(attr.getAttrName()) == null)
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.