Examples of EmbeddedTypeHandler


Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

  private ModelQuery getEmbeddedModelQuery(Node node) {
    if (fEmbeddedModelQuery == null) {
      String embeddedMimeType = getEmbeddedMimeType(node);
      if (embeddedMimeType != null) {
        EmbeddedTypeHandler embeddedContentTypeHandler = ModelHandlerUtility.getEmbeddedContentTypeFor(embeddedMimeType);
        if (embeddedContentTypeHandler != null) {
          List adapterFactories = embeddedContentTypeHandler.getAdapterFactories();
          for (int i = 0; i < adapterFactories.size(); i++) {
            INodeAdapterFactory factory = (INodeAdapterFactory) adapterFactories.get(i);
            if (factory.isFactoryForType(ModelQueryAdapter.class)) {
              INodeAdapter adapter = factory.adapt((INodeNotifier) node.getOwnerDocument());
              if (adapter instanceof ModelQueryAdapter) {
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

    // structuredDocument.setDocumentPartitioner(new
    // JSPJavaDocumentPartioner());
    // even though this is an "empty model" ... we want it to have at
    // least the
    // default embeddeded content type handler
    EmbeddedTypeHandler embeddedType = getJSPDefaultEmbeddedType(null);
    embeddedType.initializeParser(structuredDocument.getParser());
    return structuredDocument;
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

  }

  private EmbeddedTypeHandler getEmbeddedType(IStructuredModel model) {
    Document doc = ((IDOMModel) model).getDocument();
    PageDirectiveAdapter pageDirectiveAdapter = (PageDirectiveAdapter) ((INodeNotifier) doc).getAdapterFor(PageDirectiveAdapter.class);
    EmbeddedTypeHandler embeddedHandler = pageDirectiveAdapter.getEmbeddedType();
    return embeddedHandler;
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

  }

  protected void initEmbeddedTypePre(IStructuredModel model, IStructuredDocument structuredDocument) {

    // note: this will currently only work for models backed by files
    EmbeddedTypeHandler embeddedContentType = null;
    IDOMModel domModel = (IDOMModel) model;

    if (embeddedContentType == null) {
      IContentDescription desc = getContentDescription(structuredDocument);
      if (desc != null) {
        Object prop = null;

        prop = desc.getProperty(IContentDescriptionForJSP.CONTENT_FAMILY_ATTRIBUTE);
        if (prop != null) {
          if (ContentTypeFamilyForHTML.HTML_FAMILY.equals(prop)) {
            embeddedContentType = EmbeddedTypeRegistryImpl.getInstance().getTypeFor("text/html");
          }
        }

        if (embeddedContentType == null) {

          prop = desc.getProperty(IContentDescriptionForJSP.CONTENT_TYPE_ATTRIBUTE);
          if (prop != null) {
            embeddedContentType = EmbeddedTypeRegistryImpl.getInstance().getTypeFor((String) prop);
          }
        }
      }
    }

    IDOMDocument document = domModel.getDocument();
    PageDirectiveAdapter pageDirectiveAdapter = (PageDirectiveAdapter) document.getAdapterFor(PageDirectiveAdapter.class);

    if (embeddedContentType != null) {
      pageDirectiveAdapter.setEmbeddedType(embeddedContentType);
      embeddedContentType.initializeFactoryRegistry(model.getFactoryRegistry());
    }
    else {
      // use default embeddedType if it couldn't determine one
      embeddedContentType = getJSPDefaultEmbeddedType(model);
      pageDirectiveAdapter.setEmbeddedType(embeddedContentType);
      embeddedContentType.initializeFactoryRegistry(model.getFactoryRegistry());
    }
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

   * As part of the model cloning process, ensure that the new model has the
   * same embedded content type handler as the old model, and that it is
   * properly initialized
   */
  protected void initEmbeddedType(IStructuredModel oldModel, IStructuredModel newModel) {
    EmbeddedTypeHandler existingEmbeddedType = getEmbeddedType(oldModel);
    if (existingEmbeddedType == null) {
      initEmbeddedTypePre(newModel, newModel.getStructuredDocument());
      initEmbeddedTypePost(newModel);
    }
    else {
      EmbeddedTypeHandler newEmbeddedContentType = existingEmbeddedType.newInstance();
      // initEmbeddedType(newModel);
      initCloneOfEmbeddedType(newModel, existingEmbeddedType, newEmbeddedContentType);
      setLanguageInPageDirective(newModel);
    }
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

      pageDirectiveAdapter.setLanguage(language);
    }
  }

  public IStructuredModel reinitialize(IStructuredModel model) {
    EmbeddedTypeHandler oldHandler = null;
    EmbeddedTypeHandler newHandler = null;
    Object reinitStateData = model.getReinitializeStateData();
    if (reinitStateData instanceof EmbeddedTypeStateData) {
      EmbeddedTypeStateData oldStateData = (EmbeddedTypeStateData) reinitStateData;
      oldHandler = oldStateData.getOldHandler();
      newHandler = oldStateData.getNewHandler();
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

  synchronized public IEncodedDocument createNewStructuredDocument(IFile iFile) throws IOException, CoreException {
    IStructuredDocument structuredDocument = null;
    try {
      structuredDocument = createCodedDocument(iFile);

      EmbeddedTypeHandler embeddedType = getEmbeddedType(iFile);
      if (embeddedType != null)
        embeddedType.initializeParser(structuredDocument.getParser());

      fFullPreparedReader.reset();
      setDocumentContentsFromReader(structuredDocument, fFullPreparedReader);

    }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

      fFullPreparedReader = codedReaderCreator.getCodedReader();
      fEncodingMemento = codedReaderCreator.getEncodingMemento();
      structuredDocument.setEncodingMemento(fEncodingMemento);
      // the fact that file is null means this method/code path is no
      // good for JSP fragments
      EmbeddedTypeHandler embeddedType = getEmbeddedType((IFile) null);
      fFullPreparedReader.reset();
      if (embeddedType != null)
        embeddedType.initializeParser(((IStructuredDocument) structuredDocument).getParser());
      setDocumentContentsFromReader(structuredDocument, fFullPreparedReader);
    }
    catch (CoreException e) {
      // impossible in this context
      throw new Error(e);
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

   * Determine the MIME content type specified in a page directive. This
   * should appear "as early as possible in the JSP page" according to the
   * JSP v1.2 specification.
   */
  private EmbeddedTypeHandler getEmbeddedType(IFile file) throws UnsupportedEncodingException, CoreException, IOException {
    EmbeddedTypeHandler handler = null;
    if (fFullPreparedReader == null) {
      handler = getJSPDefaultEmbeddedType();
    }
    else {
      String mimeType = null;
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.ltk.modelhandler.EmbeddedTypeHandler

    // JSPJavaDocumentPartioner());
    // even though this is an "empty model" ... we want it to have at
    // least
    // the
    // default embeddeded content type handler
    EmbeddedTypeHandler embeddedType = getJSPDefaultEmbeddedType();
    embeddedType.initializeParser(structuredDocument.getParser());
    return structuredDocument;
  }
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.