Package org.eclipse.wst.sse.core.internal.provisional

Examples of org.eclipse.wst.sse.core.internal.provisional.IModelManager


 
  private IDOMModel initializeXMLModel(IFile file, boolean forWrite) throws UnsupportedEncodingException, IOException {
    if (file == null || !file.exists())
      throw new FileNotFoundException((file == null) ? "null" : file.getFullPath().toOSString()); //$NON-NLS-1$
    try {
      IModelManager manager = getModelManager();
      String id = manager.calculateId(file);     
      if (forWrite) {
        IDOMModel mod = (IDOMModel)manager.getExistingModelForEdit(id);
        if (mod == null)
          setXMLModel((IDOMModel) manager.getModelForEdit(file));
        else {
          setXMLModel(mod);
        }
      }
      else {
        IDOMModel mod = (IDOMModel)manager.getExistingModelForRead(id);
        if (mod == null)
          setXMLModel((IDOMModel) manager.getModelForRead(file));
        else {
          setXMLModel(mod);
        }
      }
      setXMLModelId(getXMLModel().getId());
View Full Code Here


      fText.setStyleRange(element);
    }
  }

  public void initColorsMap() {
    IModelManager mmanager = StructuredModelManager.getModelManager();
    setParser(mmanager.createStructuredDocumentFor(
        ContentTypeIdForPHP.ContentTypeID_PHP).getParser());

    styleProvider = new LineStyleProviderForPhp();
    Dictionary contextStyleMap = new Hashtable(styleProvider
        .getColorTypesMap());
View Full Code Here

    }
    return EMPTY;
  }

  private boolean isInDocOrCommentOrString(ITextViewer viewer, int offset) {
    IModelManager modelManager = StructuredModelManager.getModelManager();
    if (modelManager != null) {
      IStructuredModel structuredModel = null;
      structuredModel = modelManager.getExistingModelForRead(viewer
          .getDocument());
      if (structuredModel != null) {
        try {
          DOMModelForPHP domModelForPHP = (DOMModelForPHP) structuredModel;
          try {
View Full Code Here

    }
    return true;
  }

  private boolean isInDocOrCommentOrString(ITextViewer viewer, int offset) {
    IModelManager modelManager = StructuredModelManager.getModelManager();
    if (modelManager != null) {
      IStructuredModel structuredModel = null;
      structuredModel = modelManager.getExistingModelForRead(viewer
          .getDocument());
      if (structuredModel != null) {
        try {
          DOMModelForPHP domModelForPHP = (DOMModelForPHP) structuredModel;
          try {
View Full Code Here

   *            the file to get the model for
   * @return the file's XMLModel
   */
  protected IDOMModel getModelForResource(IFile file) {
    IStructuredModel model = null;
    IModelManager manager = StructuredModelManager.getModelManager();

    try {
      model = manager.getModelForRead(file);
      // TODO.. HTML validator tries again to get a model a 2nd way
    } catch (Exception e) {
      // e.printStackTrace();
    }
    return model instanceof IDOMModel ? (IDOMModel) model : null;
View Full Code Here

    }
    applyStyles();
  }

  public void setupViewer() {
    IModelManager mmanager = StructuredModelManager.getModelManager();
    setParser(mmanager.createStructuredDocumentFor(
        ContentTypeIdForPHP.ContentTypeID_PHP).getParser());

    styleProvider = new LineStyleProviderForPhp();
  }
View Full Code Here

    }

  }

  protected String getContentType(ITextEditor editor, IDocument document) {
    IModelManager mgr = StructuredModelManager.getModelManager();
    String contentType = null;

    IDocumentProvider provider = editor.getDocumentProvider();
    if (provider instanceof IDocumentProviderExtension4) {
      try {
        IContentType type = ((IDocumentProviderExtension4) provider)
            .getContentType(editor.getEditorInput());
        if (type != null)
          contentType = type.getId();
      } catch (CoreException e) {
        /*
         * A failure accessing the underlying store really isn't
         * interesting, although it can be a problem for
         * IStorageEditorInputs.
         */
      }
    }

    if (contentType == null) {
      IStructuredModel model = null;
      try {
        model = mgr.getExistingModelForRead(document);
        if (model != null) {
          contentType = model.getContentTypeIdentifier();
        }
      } finally {
        if (model != null) {
View Full Code Here

   * @param parent
   */
  public PhpPreview(CodeFormatterPreferences codeFormatterPreferences,
      Composite parent) {
    // set the PHP parser
    IModelManager mmanager = StructuredModelManager.getModelManager();
    fParser = mmanager.createStructuredDocumentFor(
        ContentTypeIdForPHP.ContentTypeID_PHP).getParser();

    this.codeFormatterPreferences = codeFormatterPreferences;

    // create the text area
View Full Code Here

  }
 
  // Get DOM Model
  private IDOMModel getDOMModel(IFile file, IModelStateListener listener) throws Exception {

    IModelManager manager = StructuredModelManager.getModelManager();
    IStructuredModel model = manager.getExistingModelForRead(file);
    if (model == null) {
      model = manager.getModelForRead(file);
    }
    if (model == null) {
      throw new Exception(
          "DOM Model is null, check the content type of your file (it seems that it's not *.xml file)");
    }
View Full Code Here

        }
      }
     
      try {
        IFile file = ClickUtils.getClickConfigFile(project);
        IModelManager manager = StructuredModelManager.getModelManager();
        model = manager.getModelForEdit(file);
       
        IDOMDocument doc = ((IDOMModel)model).getDocument();
       
        Element root  = doc.getDocumentElement();
        Element pages = null;
View Full Code Here

TOP

Related Classes of org.eclipse.wst.sse.core.internal.provisional.IModelManager

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.