Examples of IStructuredDocument


Examples of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

    if (element == null)
      return;
    ICSSModel model = getExistingModel();
    if (model == null)
      return;
    IStructuredDocument structuredDocument = model.getStructuredDocument();
    if (structuredDocument == null)
      return;

    String value = null;
    IStructuredDocumentRegionList flatNodes = structuredDocument.getRegionList();
    if (flatNodes != null) {
      int count = flatNodes.getLength();
      if (count > 0) {
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < count; i++) {
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

    }

    ICSSModel model = getExistingModel();
    if (model == null)
      return; // defer
    IStructuredDocument structuredDocument = model.getStructuredDocument();
    if (structuredDocument == null)
      return; // error

    String value = null;
    Attr attr = element.getAttributeNode(org.eclipse.wst.html.core.internal.provisional.HTML40Namespace.ATTR_NAME_STYLE);
    if (attr != null)
      value = ((IDOMNode) attr).getValueSource();
    structuredDocument.setText(this, value);

    notifyStyleChanged(element);
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

   * If the parser is to handle tag libraries, it must have a TaglibSupport
   * object with a valid URIResolver and this IStructuredDocument attached
   * to it before the contents are set on the IStructuredDocument.
   */
  public IStructuredDocument newStructuredDocument() {
    IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser());
    ((BasicStructuredDocument) structuredDocument).setReParser(new JSPReParser());
    // 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.provisional.text.IStructuredDocument

    // PageDirectiveAdapter ... the order of initialization is
    // critical here, the doc must have been created, but its contents not
    // set yet,
    // and all factories must have been set up also.
    IDOMModel domModel = (IDOMModel) model;
    IStructuredDocument structuredDocument = model.getStructuredDocument();
    IDOMDocument document = domModel.getDocument();
    PageDirectiveAdapter pageDirectiveAdapter = (PageDirectiveAdapter) document.getExistingAdapter(PageDirectiveAdapter.class);
    // ==> // PropagatingAdapter propagatingAdapter = (PropagatingAdapter)
    // ((INodeNotifier)
    // document).getExistingAdapter(PropagatingAdapter.class);
    // ==> // ModelQueryAdapter modelQueryAdapter = (ModelQueryAdapter)
    // ((INodeNotifier)
    // document).getExistingAdapter(ModelQueryAdapter.class);
    oldEmbeddedContentType.uninitializeFactoryRegistry(model.getFactoryRegistry());
    oldEmbeddedContentType.uninitializeParser(structuredDocument.getParser());
    // since 'document' is not recreated in this
    // reinit path, we need to remove all adapters,
    // except for the propagated adapters (including page
    // directive adapter, and model query adapter).
    // to accomplish this, we'll just remove all, then
    // add back with a call to pre-load adapt.
    // let clients decide to unload adapters from document
    // Collection oldAdapters = document.getAdapters();
    // Iterator oldAdaptersIterator = oldAdapters.iterator();
    // while (oldAdaptersIterator.hasNext()) {
    // INodeAdapter oldAdapter = (INodeAdapter)
    // oldAdaptersIterator.next();
    // if (oldAdapter != pageDirectiveAdapter && oldAdapter !=
    // propagatingAdapter && oldAdapter != modelQueryAdapter) {
    // // DO NOT remove directly!
    // // can change contents while in notifity loop!
    // //oldAdaptersIterator.remove();
    // document.removeAdapter(oldAdapter);
    // }
    // }
    // DMW: I believe something like the following is needed,
    // since releases cached adapters
    // if (document instanceof DocumentImpl) {
    // ((DocumentImpl) document).releaseDocumentType();
    // ((DocumentImpl) document).releaseStyleSheets();
    // }
    // remember, embedded type factories are automatically cleared when
    // embededType changed
    pageDirectiveAdapter.setEmbeddedType(newEmbeddedContentType);
    // // but still need to clear the page directive watchers, and let
    // them be rediscovered (with new, accurate node as target)
    // pageDirectiveAdapter.clearPageWatchers();
    if (newEmbeddedContentType != null) {

      // need to null out or else ModelParserAdapter
      // won't get reinitialized
      ((DOMModelImpl) model).setModelParser(null);

      newEmbeddedContentType.initializeFactoryRegistry(model.getFactoryRegistry());
      newEmbeddedContentType.initializeParser(structuredDocument.getParser());

      // partitioner setup is the responsibility of this loader
      IDocumentPartitioner documentPartitioner = structuredDocument.getDocumentPartitioner();
      // ISSUE: this logic is flawed, not sure of original intent, but
      // added null/type checks for safety.
      if (documentPartitioner != null && documentPartitioner instanceof StructuredTextPartitionerForJSP) {
        if (newEmbeddedContentType.getFamilyId().equals(ContentTypeIdForXML.ContentTypeID_XML)) {
          ((StructuredTextPartitionerForJSP) documentPartitioner).setEmbeddedPartitioner(new StructuredTextPartitionerForXML());
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

    // PageDirectiveAdapter ... the order of initialization is
    // critical here, the doc must have been created, but its contents not
    // set yet,
    // and all factories must have been set up also.
    IDOMModel domModel = (IDOMModel) model;
    IStructuredDocument structuredDocument = model.getStructuredDocument();
    IDOMDocument document = domModel.getDocument();
    PageDirectiveAdapter pageDirectiveAdapter = (PageDirectiveAdapter) document.getAdapterFor(PageDirectiveAdapter.class);
    // ==> // PropagatingAdapter propagatingAdapter = (PropagatingAdapter)
    // ((INodeNotifier) document).getAdapterFor(PropagatingAdapter.class);
    // ==> // ModelQueryAdapter modelQueryAdapter = (ModelQueryAdapter)
    // ((INodeNotifier) document).getAdapterFor(ModelQueryAdapter.class);
    // because, even in the clone case, the model has been paritally
    // intialized with
    // the old embedded type (during createModel), we need to unitialize
    // parts of it, based on the old (or default) ones
    oldEmbeddedContentType.uninitializeFactoryRegistry(model.getFactoryRegistry());
    oldEmbeddedContentType.uninitializeParser(structuredDocument.getParser());
    // remember, embedded type factories are automatically cleared when
    // embededType changed
    pageDirectiveAdapter.setEmbeddedType(newEmbeddedContentType);
    if (newEmbeddedContentType != null) {
      newEmbeddedContentType.initializeFactoryRegistry(model.getFactoryRegistry());
      newEmbeddedContentType.initializeParser(structuredDocument.getParser());
    }
    // adding language here, in this convienent central
    // location, but some obvious renaming or refactoring
    // wouldn't hurt, in future.
    // I needed to add this language setting for JSP Fragment support
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

  /*
   * @see AbstractLoader#createNewStructuredDocument()
   */
  protected IEncodedDocument newEncodedDocument() {
    IStructuredDocument structuredDocument = StructuredDocumentFactory.getNewStructuredDocumentInstance(getParser());
    ((BasicStructuredDocument) structuredDocument).setReParser(new XMLStructuredDocumentReParser());

    return structuredDocument;
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

    TagMarker bm = new TagMarker(tagName);
    parser.addNestablePrefix(bm);
  }

  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.provisional.text.IStructuredDocument

    }
    return structuredDocument;
  }

  private IStructuredDocument createCodedDocument(IFile iFile) throws CoreException, UnsupportedEncodingException, IOException {
    IStructuredDocument structuredDocument = (IStructuredDocument) createNewStructuredDocument();

    getCodedReaderCreator().set(iFile);

    fFullPreparedReader = getCodedReaderCreator().getCodedReader();
    fEncodingMemento = getCodedReaderCreator().getEncodingMemento();

    structuredDocument.setEncodingMemento(getCodedReaderCreator().getEncodingMemento());

    return structuredDocument;
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

  /**
   */
  private String getDelimiter(IDOMModel model) {
    String delim = null;
    if (model != null) {
      IStructuredDocument structuredDocument = model.getStructuredDocument();
      if (structuredDocument != null)
        delim = structuredDocument.getLineDelimiter();
    }
    if (delim == null)
      delim = "\r\n";//$NON-NLS-1$
    return delim;
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument

      return;

    IDOMModel model = this.element.getModel();
    if (model == null)
      return;
    IStructuredDocument structuredDocument = model.getStructuredDocument();
    if (structuredDocument == null)
      return;
    int offset = this.element.getStartEndOffset();
    int end = this.element.getEndStartOffset();
    int length = end - offset;
    structuredDocument.replaceText(model, offset, length, source);
  }
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.