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

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


  }

  public IStructuredModel getNewModelForRead(IFile iFile) {
    if (iFile == null)
      return null;
    IModelManager manager = getModelManager();
    if (manager == null)
      return null;

    IStructuredModel model = null;
    try {
      model = manager.getNewModelForEdit(iFile, false);
    }
    catch (IOException ex) {
    }
    catch (ResourceInUse riu) {
    }
View Full Code Here


    }
    return type;
  }

  private IFile getFile() {
    IModelManager modelManager = StructuredModelManager.getModelManager();
    IStructuredModel model = null;
    IFile file = null;
    if(modelManager != null) {
      try {
        model = modelManager.getExistingModelForRead(getDocument());
        if (model != null) {
          String baseLocation = model.getBaseLocation();
          // The baseLocation may be a path on disk or relative to the
          // workspace root. Don't translate on-disk paths to
          // in-workspace resources.
View Full Code Here

    final long afterModifiedFromJavaIO = (location != null) ? location.toFile().lastModified() : IResource.NULL_STAMP;
    final long afterModifiedFromIFile = file.getModificationStamp();

    if (beforeModifiedFromJavaIO != afterModifiedFromJavaIO || beforeModifiedFromIFile != afterModifiedFromIFile) {
      IModelManager manager = StructuredModelManager.getModelManager();
      IStructuredModel model = manager.getExistingModelForRead(file);
      if (model != null) {
        if (!model.isDirty()) {
          try {
            file.refreshLocal(IResource.DEPTH_ONE, null);
          }
View Full Code Here

   * @return String content type of given document
   */
  protected String getContentType(IDocument document) {
    String type = null;

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

    }
    return true;
  }

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

    IDocumentProvider provider = fTextEditor.getDocumentProvider();
    if (provider instanceof IDocumentProviderExtension4) {
      try {
        IContentType type = ((IDocumentProviderExtension4) provider).getContentType(fTextEditor.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 {
View Full Code Here

    if (viewer == null)
      return null;

    IndexedRegion node = null;
    IModelManager mm = StructuredModelManager.getModelManager();
    IStructuredModel model = null;
    if (mm != null)
      model = mm.getExistingModelForRead(viewer.getDocument());
    try {
      if (model != null) {
        int lastOffset = documentOffset;
        node = model.getIndexedRegion(documentOffset);
        while (node == null && lastOffset >= 0) {
View Full Code Here

      return translation;

    IStructuredModel model = null;
    try {
      // get existing model for read, then get document from it
      IModelManager modelManager = getModelManager();
      if (modelManager != null) {
        jspFile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
        model = modelManager.getModelForRead(jspFile);
      }
      // handle unsupported
      if (model instanceof IDOMModel) {
        IDOMModel xmlModel = (IDOMModel)model;
        setupAdapterFactory(xmlModel);
View Full Code Here

    }

    private IDOMModel getModelForFile(final IFile file)
            throws CoreException, IOException
    {
        final IModelManager modelManager =
            StructuredModelManager.getModelManager();

        final IStructuredModel model = modelManager.getModelForRead(file);

        if (model instanceof IDOMModel)
        {
            return (IDOMModel) model;
        }
View Full Code Here

    }

    private IDOMModel getModelForFile(final IFile file)
            throws CoreException, IOException
    {
        final IModelManager modelManager =
            StructuredModelManager.getModelManager();

        final IStructuredModel model = modelManager.getModelForRead(file);

        if (model instanceof IDOMModel)
        {
            return (IDOMModel) model;
        }
View Full Code Here

    list.add(IStyleConstantsHTML.SCRIPT_AREA_BORDER);
    list.add(IStyleConstantsJSP.JSP_CONTENT);
  }

  protected void setupPicker(StyledTextColorPicker picker) {
    IModelManager mmanager = StructuredModelManager.getModelManager();
    picker.setParser(mmanager.createStructuredDocumentFor(ContentTypeIdForJSP.ContentTypeID_JSP).getParser());

    // create descriptions for highlighting types
    Dictionary descriptions = new Hashtable();
    initDescriptions(descriptions);
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.