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

Examples of org.eclipse.wst.css.core.internal.provisional.document.ICSSModel


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

    // get old content length
    Node child = element.getFirstChild();
View Full Code Here


   */
  private void contentChanged() {
    Element element = getElement();
    if (element == null)
      return;
    ICSSModel model = getExistingModel();
    if (model == null)
      return;
    IStructuredDocument structuredDocument = model.getStructuredDocument();
    if (structuredDocument == null)
      return;

    String data = null;
    Node child = element.getFirstChild();
View Full Code Here

  }

  /**
   */
  public ICSSModel getModel() {
    ICSSModel model = getExistingModel();
    if (this.replaceModel) {
      ICSSModel oldModel = model;
      model = createModel(false);

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

  protected ICSSModel createModel(boolean addListener) {
    if (!isValidAttribute()) {
      return null;
    }

    ICSSModel model = super.createModel(addListener);

    if (!addListener)
      return model;

    IStructuredDocument structuredDocument = model.getStructuredDocument();
    if (structuredDocument == null)
      return null;
    structuredDocument.addDocumentChangedListener(this);

    return model;
View Full Code Here

  }

  /**
   */
  protected void setModel(ICSSModel model, boolean setupListener) {
    ICSSModel oldModel = getExistingModel();
    if (model == oldModel)
      return;
    super.setModel(model);
    if (!setupListener)
      return;
    if (oldModel != null)
      oldModel.removeStyleListener(this);
    if (model != null)
      model.addStyleListener(this);
  }
View Full Code Here

  }

  /**
   */
  private String getCSSValue(Attr attr) {
    ICSSModel model = getCSSModel(attr);
    if (model == null)
      return null;
    ICSSNode document = model.getDocument();
    if (document == null)
      return null;
    INodeNotifier notifier = (INodeNotifier) document;
    CSSSourceFormatter formatter = (CSSSourceFormatter) notifier.getAdapterFor(CSSSourceFormatter.class);
    // try another way to get formatter
View Full Code Here

  }

  /**
   */
  private String getCSSValue(Attr attr) {
    ICSSModel model = getCSSModel(attr);
    if (model == null)
      return null;
    ICSSNode document = model.getDocument();
    if (document == null)
      return null;
    INodeNotifier notifier = (INodeNotifier) document;
    CSSSourceFormatter formatter = (CSSSourceFormatter) notifier.getAdapterFor(CSSSourceFormatter.class);
    // try another way to get formatter
View Full Code Here

  protected ICSSModel createModel() {
    // create embedded CSS model (not for external CSS)
    if (getElement() == null)
      return null;
    IStructuredModel baseModel = ((IDOMNode) getElement()).getModel();
    ICSSModel newModel = (ICSSModel) baseModel.getModelManager().createUnManagedStructuredModelFor(CSS_ID);
    ((CSSModelImpl) newModel).setOwnerDOMNode(getElement());
    return newModel;
  }
View Full Code Here

  }

  /**
   */
  public ICSSModel getModel() {
    ICSSModel model = getExistingModel();
    if (model == null && isModelNecessary()) {
      model = createModel();
      if (model == null)
        return null;
     
      IStructuredDocument structuredDocument = model.getStructuredDocument();
      if (structuredDocument == null)
        return null;

      RegionParser parser = structuredDocument.getParser();
      if (parser instanceof CSSSourceParser) {
View Full Code Here

  }

  /**
   */
  public CSSStyleDeclaration getStyle() {
    ICSSModel model = getModel();
    if (model == null)
      return null;
    return (CSSStyleDeclaration) model.getDocument();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.wst.css.core.internal.provisional.document.ICSSModel

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.