Examples of IDOMModel


Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

    // once we know the embedded content type, we need to set it in the
    // 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)
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

    // once we know the embedded content type, we need to set it in the
    // 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);
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

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

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

  protected void preLoadAdapt(IStructuredModel structuredModel) {
    // DMW: just added this preload on 8/16/2002
    // I noticed the ProagatingAdapterFactory was being added,
    // that that the ProagatingAdapterAdapter was not being
    // preload adapted -- I'm assuing it ALWAYS has to be.
    IDOMModel domModel = (IDOMModel) structuredModel;
    // if there is a model in the adapter, this will adapt it to
    // first node. After that the PropagatingAdater spreads over the
    // children being
    // created. Each time that happends, a side effect is to
    // also "spread" sprecific registered adapters,
    // they two can propigate is needed.
    ((INodeNotifier) domModel.getDocument()).getAdapterFor(PropagatingAdapter.class);
  }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

  public IDocumentLoader newInstance() {
    return new JSPDocumentLoader();
  }

  protected void preLoadAdapt(IStructuredModel structuredModel) {
    IDOMModel domModel = (IDOMModel) structuredModel;
    //
    // document must have already been set for this to
    // work.
    Document document = domModel.getDocument();
    Assert.isNotNull(document, JSPCoreMessages.JSPDocumentLoader_1);
    // if there is a model in the adapter, this will adapt it to
    // first node. After that the PropagatingAdater spreads over the
    // children being
    // created. Each time that happends, a side effect is to
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

    if (this.element == null)
      return;
    if (isRuntimeContainer())
      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;
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

public class CSSTextNodeCleanupHandler extends AbstractNodeCleanupHandler {

  public Node cleanup(Node node) {
    if (node == null)
      return node;
    IDOMModel model = ((IDOMNode) node).getModel();
    if (model == null)
      return node;
    IStructuredDocument structuredDocument = model.getStructuredDocument();
    if (structuredDocument == null)
      return node;
    if ( !getCleanupPreferences().getFormatSource())
      return node;
   
    String content = getCSSContent(node);
    if (content == null)
      return node;

    int offset = ((IDOMNode) node).getStartOffset();
    int length = ((IDOMNode) node).getEndOffset() - offset;
    replaceSource(model, this, offset, length, content);
    return (IDOMNode) model.getIndexedRegion(offset);
  }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

  void performValidation(IFile f, IReporter reporter, IStructuredModel model) {
    for (int i = 0; i < DEPEND_ONs.length; i++) {
      addDependsOn(f.getProject().getFile(DEPEND_ONs[i]))
    }
    if (model instanceof IDOMModel) {
      IDOMModel domModel = (IDOMModel) model;
      ModelHandlerForJSP.ensureTranslationAdapterFactory(domModel);

      IDOMDocument xmlDoc = domModel.getDocument();
      JSPTranslationAdapter translationAdapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
      IJSPTranslation translation = translationAdapter.getJSPTranslation();

      if (!reporter.isCancelled()) {
        loadPreferences(f);

        // only update task markers if the model is the same as what's on disk
        boolean updateJavaTasks = UPDATE_JAVA_TASKS && !domModel.isDirty() && f != null && f.isAccessible();
        if (updateJavaTasks) {
          // remove old Java task markers
          try {
            IMarker[] foundMarkers = f.findMarkers(JAVA_TASK_MARKER_TYPE, true, IResource.DEPTH_ONE);
            for (int i = 0; i < foundMarkers.length; i++) {
              foundMarkers[i].delete();
            }
          }
          catch (CoreException e) {
            Logger.logException(e);
          }
        }

        translation.setProblemCollectingActive(true);
        translation.reconcileCompilationUnit();
        List problems = translation.getProblems();
        // add new messages
        for (int i = 0; i < problems.size() && !reporter.isCancelled(); i++) {
          IProblem problem = (IProblem) problems.get(i);
          /*
           * Possible error in problem collection; EL translation is
           * extensible, so we must be paranoid about this.
           */
          if (problem == null)
            continue;
          IMessage m = createMessageFromProblem(problem, f, translation, domModel.getStructuredDocument());
          if (m != null) {
            if (problem.getID() == IProblem.Task) {
              if (updateJavaTasks) {
                // add new Java task marker
                try {
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

  }

  protected void addPropagatingAdapters(IStructuredModel structuredModel) {

    if (structuredModel instanceof IDOMModel) {
      IDOMModel xmlModel = (IDOMModel) structuredModel;
      IDOMDocument document = xmlModel.getDocument();
      PropagatingAdapter propagatingAdapter = (PropagatingAdapter) document.getAdapterFor(PropagatingAdapter.class);
      if (propagatingAdapter != null) {
        // what to do?
      }
    }
View Full Code Here

Examples of org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel

  protected INodeAdapter createAdapter(INodeNotifier target) {
    if (target instanceof IDOMNode && fAdapter == null) {
      /* attempt to load externalized translator and create adapter from it
       * else create new adapter */
      IDOMModel model = ((IDOMNode) target).getModel();
     
      JSPTranslator translator = JSPTranslatorPersister.getPersistedTranslator(model);
      if(translator != null) {
        fAdapter = new JSPTranslationAdapter(model, translator);
      } else {
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.