Examples of CMDocument


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

      } else {
        mqAdapter = (ModelQueryAdapter) ((IDOMNode) node.getOwnerDocument()).getAdapterFor(ModelQueryAdapter.class);
      }

      if (mqAdapter != null) {
        CMDocument doc = mqAdapter.getModelQuery().getCorrespondingCMDocument(node);
        if (doc != null) {
          CMDocument jcmdoc = getDefaultJSPCMDocument(node);
          CMNamedNodeMap jspelements = jcmdoc.getElements();

          /* For a built-in JSP action the content model is properly
           * set up, so don't just blindly add the rest--unless this
           * will be a direct child of the document
           */
          if (jspelements != null && (!(doc instanceof JSPCMDocument) || node.getNodeType() == Node.DOCUMENT_NODE)) {
            List rejectElements = new ArrayList();

            // determine if the document is in XML form
            Document domDoc = null;
            if (node.getNodeType() == Node.DOCUMENT_NODE) {
              domDoc = (Document) node;
            } else {
              domDoc = node.getOwnerDocument();
            }

            // Show XML tag forms of JSP markers if jsp:root is
            // the document element OR it's HTML but
            // isn't really in the text.
            // If the document isn't strictly XML, pull out the
            // XML tag forms it is xml format
            rejectElements.add(JSP12Namespace.ElementName.SCRIPTLET);
            rejectElements.add(JSP12Namespace.ElementName.EXPRESSION);
            rejectElements.add(JSP12Namespace.ElementName.DECLARATION);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_INCLUDE);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_PAGE);
            rejectElements.add(JSP12Namespace.ElementName.TEXT);
            rejectElements.add(JSP12Namespace.ElementName.DIRECTIVE_TAGLIB);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_TAG);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_ATTRIBUTE);
            rejectElements.add(JSP20Namespace.ElementName.DIRECTIVE_VARIABLE);
            if (isXMLFormat(domDoc)) {
              // jsp actions
              rejectElements.add(JSP12Namespace.ElementName.FALLBACK);
              rejectElements.add(JSP12Namespace.ElementName.USEBEAN);
              rejectElements.add(JSP12Namespace.ElementName.GETPROPERTY);
              rejectElements.add(JSP12Namespace.ElementName.SETPROPERTY);
              rejectElements.add(JSP12Namespace.ElementName.INCLUDE);
              rejectElements.add(JSP12Namespace.ElementName.FORWARD);
              rejectElements.add(JSP12Namespace.ElementName.PLUGIN);
              rejectElements.add(JSP12Namespace.ElementName.FALLBACK);
              rejectElements.add(JSP12Namespace.ElementName.PARAM);
              rejectElements.add(JSP12Namespace.ElementName.PARAMS);
            }


            // don't show jsp:root if a document element already
            // exists
            Element docElement = domDoc.getDocumentElement();
            if (docElement != null &&((docElement.getNodeName().equals(TAG_JSP_ROOT)) ||
                ((((IDOMNode) docElement).getStartStructuredDocumentRegion() != null ||
                    ((IDOMNode) docElement).getEndStructuredDocumentRegion() != null)))) {
             
              rejectElements.add(JSP12Namespace.ElementName.ROOT);
            }
            //Add JSP elements into autocomplete menu
            for (int j = 0; j < jspelements.getLength(); j++) {
              CMElementDeclaration ed = (CMElementDeclaration) jspelements.item(j);
              if (!rejectElements.contains(ed.getNodeName())) {
                nodeList.add(ed);
              }
            }
           
           
            //Add Tapestry components into autocomplete menu
            ElemDecl temp = null;
            jcmdoc = getDefaultTapestryCMDocument();
            CMNamedNodeMap tapestryelements = jcmdoc.getElements();
            for (int j = 0; j < tapestryelements.getLength(); j++) {
              if(j == 0) temp =  (ElemDecl) tapestryelements.item(j);
              CMElementDeclaration ed = (CMElementDeclaration) tapestryelements.item(j);
              if (!rejectElements.contains(ed.getNodeName())) {
                nodeList.add(ed);
View Full Code Here

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

   *
   * @return the default non-embedded CMDocument for the document being
   *         edited.
   */
  private CMDocument getDefaultJSPCMDocument(IDOMNode node) {
    CMDocument jcmdoc = null;
   
    // handle tag files here
    String contentType = node.getModel().getContentTypeIdentifier();
    if (ContentTypeIdForJSP.ContentTypeID_JSPTAG.equals(contentType)) {
      jcmdoc =  JSPCMDocumentFactory.getCMDocument(CMDocType.TAG20_DOC_TYPE);
View Full Code Here

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

    return jcmdoc;
  }
 
  private CMDocument getDefaultTapestryCMDocument() {
    CMDocument jcmdoc = JSPCMDocumentFactory.getTapestryCMDocument();
    return jcmdoc;
  }
View Full Code Here

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

    return false;
  }
 
  public void translate(final IMetaDataModelMergeAssistant assistant) {
    setAssistant(assistant);
    CMDocument doc = getSourceModel();
    if (doc instanceof JSPCMDocument){
      doTranslate(doc);     
    }
    if (doc instanceof TapestryCMDocument){
      doTranslate(doc);     
View Full Code Here

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

  /* (non-Javadoc)
   * @see org.eclipse.jst.jsf.common.metadata.internal.AbstractTagLibDomainContentModelMetaDataTranslator#getURIDescription()
   */
  protected String getURIDescription() {   
    CMDocument doc = getSourceModel();
    if (doc !=null && doc instanceof TapestryCMDocument) return Messages.TapestryContentModelMetaDataTranslator_Desc;
    else return Messages.JSPContentModelMetaDataTranslator_Desc;
  }
View Full Code Here

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

    else return Messages.JSPContentModelMetaDataTranslator_Desc;
  }

  @Override
  protected String getURIDisplayLabel() {
    CMDocument doc = getSourceModel();
    if (doc !=null && doc instanceof TapestryCMDocument){
      return Messages.TapestryContentModelMetaDataTranslator_Label;
    }else return Messages.JSPContentModelMetaDataTranslator_Label;
  }
View Full Code Here

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

  /*
   * @see ModelQuery#getCorrespondingCMDocument(Node)
   */
  public CMDocument getCorrespondingCMDocument(Node node) {
    CMDocument doc = super.getCorrespondingCMDocument(node);
    if (doc == null) {
      ModelQuery query = getEmbeddedModelQuery(node);
      if (query != null) {
        doc = query.getCorrespondingCMDocument(node);
      }
View Full Code Here

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

   * @see CMDocument#getElements()
   */
  public CMNamedNodeMap getElements() {
    if (elements != null)
      return elements;
    CMDocument cmdoc = getSelf();
    if (cmdoc == null)
      return null;
    elements = new Elements(cmdoc.getElements(), isXHTML);
    return elements;
  }
View Full Code Here

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

  /*
   * @see CMDocument#getEntities()
   */
  public CMNamedNodeMap getEntities() {
    CMDocument cmdoc = getSelf();
    if (cmdoc == null)
      return null;
    return cmdoc.getEntities();
  }
View Full Code Here

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

  /*
   * @see CMDocument#getNamespace()
   */
  public CMNamespace getNamespace() {
    CMDocument cmdoc = getSelf();
    if (cmdoc == null)
      return null;
    return cmdoc.getNamespace();
  }
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.