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

Examples of org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery


   */
  protected CMElementDeclaration getDeclaration() {
    Document document = getOwnerDocument();
    if (document == null)
      return null;
    ModelQuery modelQuery = ModelQueryUtil.getModelQuery(document);
    if (modelQuery == null)
      return null;
    return modelQuery.getCMElementDeclaration(this);
  }
View Full Code Here


  public IStructuredDocument getDocument() {
    return fDocument;
  }

  public ModelQuery getModelQuery() {
    ModelQuery mq = null;

    IStructuredModel xmlModel = null;
    try {
      xmlModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
      mq = ModelQueryUtil.getModelQuery(xmlModel);
View Full Code Here

  }
 
  private String getElementValueHelper(Element element) {
    String result = null;

    ModelQuery mq = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
    if ((result == null) && (mq != null)) {
      CMElementDeclaration ed = mq.getCMElementDeclaration(element);
      if ((ed != null) && !Boolean.TRUE.equals(ed.getProperty("isInferred"))) { //$NON-NLS-1$
        result = descriptionBuilder.buildDescription(ed);
      }
    }
    return result != null ? result : ""; //$NON-NLS-1$
View Full Code Here

  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    // remove our listeners to the old state
    if (oldInput != null) {
      Document domDoc = (Document) oldInput;
      ModelQuery mq = ModelQueryUtil.getModelQuery(domDoc);
      if (mq != null) {
        documentManager = mq.getCMDocumentManager();
        if (documentManager != null) {
          documentManager.removeListener(this);
        }
      }
    }

    if ((oldInput != null) && (oldInput instanceof IDOMNode)) {
      IJFaceNodeAdapterFactory factory = (IJFaceNodeAdapterFactory) ((IDOMNode) oldInput).getModel().getFactoryRegistry().getFactoryFor(IJFaceNodeAdapter.class);
      if (factory != null) {
        factory.removeListener(viewer);
      }
    }

    if (viewer instanceof StructuredViewer) {
      fViewer = null;
    }
    else {
      fViewer = (StructuredViewer) viewer;
    }

    if ((newInput != null) && (newInput instanceof IDOMNode)) {
      IJFaceNodeAdapterFactory factory = (IJFaceNodeAdapterFactory) ((IDOMNode) newInput).getModel().getFactoryRegistry().getFactoryFor(IJFaceNodeAdapter.class);
      if (factory != null) {
        factory.addListener(viewer);
      }
    }

    if (newInput != null) {
      Document domDoc = (Document) newInput;
      ModelQuery mq = ModelQueryUtil.getModelQuery(domDoc);

      if (mq != null) {
        documentManager = mq.getCMDocumentManager();
        if (documentManager != null) {
          documentManager.setPropertyEnabled(CMDocumentManager.PROPERTY_ASYNC_LOAD, true);
          documentManager.addListener(this);
        }
      }
View Full Code Here

  }

  private List getRequiredAttrs(Node node) {
    List result = new ArrayList();

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

  }

  public String getElementValueHelper(Element element) {
    String result = null;

    ModelQuery mq = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
    if ((result == null) && (mq != null)) {
      CMElementDeclaration ed = mq.getCMElementDeclaration(element);
      if ((ed != null) && !Boolean.TRUE.equals(ed.getProperty("isInferred"))) { //$NON-NLS-1$
        result = decriptionBuilder.buildDescription(ed);
      }
    }
    return result != null ? result : ""; //$NON-NLS-1$
View Full Code Here

  }

  /**
   */
  protected CMDocument getCMDocument() {
    ModelQuery modelQuery = ModelQueryUtil.getModelQuery(this);
    if (modelQuery == null)
      return null;
    return modelQuery.getCorrespondingCMDocument(this);
  }
View Full Code Here

   * @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();
        fCMCache.put(element, map);
      }
    }
View Full Code Here

      Element element = (Element) node;
      String[] dataTypeValues = null;
      // The ModelQuery may not be available if the corresponding
      // adapter
      // is absent
      ModelQuery modelQuery = ModelQueryUtil.getModelQuery(element.getOwnerDocument());
      if (modelQuery != null) {
        dataTypeValues = modelQuery.getPossibleDataTypeValues(element, ad);
      }
      else {
        if (ad.getAttrType() != null) {
          dataTypeValues = ad.getAttrType().getEnumeratedValues();
        }
View Full Code Here

      if ((regionText != null) && regionText.startsWith("&")) { //$NON-NLS-1$                
        String key = (nodeOffset > 0) ? regionText.substring(1, nodeOffset) : ""; //$NON-NLS-1$

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

TOP

Related Classes of org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery

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.