Package org.eclipse.wst.css.core.internal.provisional.adapters

Examples of org.eclipse.wst.css.core.internal.provisional.adapters.IModelProvideAdapter


        setModel(model);

        // release old model
        if (oldModel != null) {
          // get ModelProvideAdapter
          IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
          if (adapter != null)
            adapter.modelRemoved(oldModel);
        }
      }
      finally {
        if (oldModel != null)
          oldModel.releaseFromRead();
View Full Code Here


  public void released() {
    ICSSModel model = getExistingModel();
    if (model != null) {
      try {
        // get ModelProvideAdapter
        IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);

        // set element to null first, so that no document wide updates
        setElement(null);
        setModel(null);

        if (adapter != null)
          adapter.modelReleased(model);
      }
      finally {
        model.releaseFromRead();
      }
    }
View Full Code Here

    if (model != null) {
      try {
        setModel(null);

        // get ModelProvideAdapter
        IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
        if (adapter != null)
          adapter.modelRemoved(model);
      }
      finally {
        model.releaseFromRead();
      }
    }
View Full Code Here

    if (!(id instanceof String))
      return null;
    //String base = (String)id;

    // get ModelProvideAdapter
    IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(ModelProvideAdapterClass);

    URLModelProvider provider = new URLModelProvider();
    try {
      IStructuredModel newModel = provider.getModelForRead(baseModel, href);
      if (newModel == null)
        return null;
      if (!(newModel instanceof ICSSModel)) {
        newModel.releaseFromRead();
        return null;
      }

      // notify adapter
      if (adapter != null)
        adapter.modelProvided(newModel);

      return (ICSSModel) newModel;
    }
    catch (UnsupportedEncodingException e) {
    }
View Full Code Here

   */
  protected ICSSModel createModel(boolean notify) {
    ICSSModel newModel = super.createModel();
    if (notify && newModel != null) {
      // get ModelProvideAdapter
      IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
      // notify adapter
      if (adapter != null)
        adapter.modelProvided(newModel);
    }
    return newModel;
  }
View Full Code Here

   */
  public void released() {
    ICSSModel currentModel = getModel();

    // get ModelProvideAdapter
    IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);

    setElement(null);
    setModel(null);

    if (adapter != null)
      adapter.modelReleased(currentModel);

    if (currentModel != null)
      currentModel.releaseFromRead();
  }
View Full Code Here

    ICSSModel currentModel = getModel();

    setModel(null);

    // get ModelProvideAdapter
    IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
    if (adapter != null)
      adapter.modelRemoved(currentModel);

    if (currentModel != null)
      currentModel.releaseFromRead();
  }
View Full Code Here

      setModel(model, false); // need to set before contentChanged()
      contentChanged();

      // from super.createModel()
      // get ModelProvideAdapter
      IModelProvideAdapter modelProvideAdapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
      // notify adapter
      if (modelProvideAdapter != null)
        modelProvideAdapter.modelProvided(model);

      // from createModel()
      IStructuredDocument structuredDocument = null;
      if (model != null)
        structuredDocument = model.getStructuredDocument();
      if (structuredDocument == null)
        return null;
      structuredDocument.addDocumentChangedListener(this);

      // from setModel()
      if (oldModel != null)
        oldModel.removeStyleListener(this);
      if (model != null)
        model.addStyleListener(this);

      if (oldModel != null) {
        // get ModelProvideAdapter
        IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement()).getAdapterFor(IModelProvideAdapter.class);
        if (adapter != null) {
          adapter.modelRemoved(oldModel);
        }
      }

      this.replaceModel = false;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.css.core.internal.provisional.adapters.IModelProvideAdapter

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.