Examples of ITextFileBuffer


Examples of org.eclipse.core.filebuffers.ITextFileBuffer

      // BUG 178598 - If the resource is shared, and it's possible to
      // get the workbench Display, the UI thread is asked to execute the
      // format of the file when it can
      try {
        ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
        ITextFileBuffer buffer = null;
       
        try {
          if(manager != null) {
            manager.connect(file.getFullPath(), LocationKind.IFILE, monitor);
            buffer = manager.getTextFileBuffer(resource.getFullPath(), LocationKind.IFILE);
          }
         
          if(buffer != null && buffer.isShared()) {
            Display display = getDisplay();
            display.syncExec(new Runnable() {
              public void run() {
                format(monitor, file);
              }
View Full Code Here

Examples of org.eclipse.core.filebuffers.ITextFileBuffer

  /**
   * @return the workspace file for this model, null otherwise
   */
  private IFile getFile() {
    IFile f = null;
    ITextFileBuffer buffer = FileBufferModelManager.getInstance().getBuffer(getStructuredDocument());
    if (buffer != null) {
      IPath path = buffer.getLocation();
      if (path.segmentCount() > 1) {
        f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      }
      if (f != null && f.isAccessible()) {
        return f;
View Full Code Here

Examples of org.eclipse.core.filebuffers.ITextFileBuffer

  private IPath getModelPath() {
    IPath path = null;
    IStructuredDocument structuredDocument = getStructuredDocument();
    if (structuredDocument != null) {
      ITextFileBuffer buffer = FileBufferModelManager.getInstance().getBuffer(structuredDocument);
      if (buffer != null) {
        path = buffer.getLocation();
      }
    }
    return path;
  }
View Full Code Here

Examples of org.eclipse.core.filebuffers.ITextFileBuffer

        }
      }
      if (is == null) {
        try {
          FileBuffers.getTextFileBufferManager().connect(filePath, LocationKind.LOCATION, new NullProgressMonitor());
          ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(filePath, LocationKind.LOCATION);
          if (buffer != null) {
            s.append(buffer.getDocument().get());
          }
        }
        catch (CoreException e) {
          // nothing to do
          Logger.logException(e);
View Full Code Here

Examples of org.eclipse.core.filebuffers.ITextFileBuffer

   * @return IFile the IFile, null if no such file exists
   */
  private IFile getFile() {
    if (fFile == null) {
      fFile = NO_FILE;
      ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(getDocument());
      if (buffer != null && buffer.getLocation() != null) {
        IPath path = buffer.getLocation();
        if (path.segmentCount() > 1) {
          IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
          if (file.isAccessible()) {
            fFile = file;
          }
View Full Code Here

Examples of org.eclipse.core.filebuffers.ITextFileBuffer

  }


  private IHyperlink createHyperlink(String elementName, IRegion region, IDocument document) {
    // try file buffers
    ITextFileBuffer textFileBuffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(document);
    if (textFileBuffer != null) {
      IPath basePath = textFileBuffer.getLocation();
      if (basePath != null && !basePath.isEmpty()) {
        IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(basePath.segment(0));
        if (basePath.segmentCount() > 1 && project.isAccessible()) {
          return createJavaElementHyperlink(JavaCore.create(project), elementName, region);
        }
View Full Code Here

Examples of org.eclipse.core.filebuffers.ITextFileBuffer

      }

      if (document == null || !hasHTMLFeature(document))
        return; // ignore

      ITextFileBuffer fb = FileBufferModelManager.getInstance().getBuffer(fDocument);
      if (fb == null)
        return;

      IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(fb.getLocation());
      if (file == null || !file.exists())
        return;

      // this will be the wrong region if it's Text (instead of Element)
      // we don't know how to validate Text
View Full Code Here

Examples of org.eclipse.core.filebuffers.ITextFileBuffer

    IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(fDocument);
    if (model == null)
      return;

    try {
      ITextFileBuffer fb = FileBufferModelManager.getInstance().getBuffer(fDocument);
      if (fb == null)
        return;
      IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(fb.getLocation());
      if (file == null || !file.exists())
        return;
      performValidation(file, reporter, model, dirtyRegion);
    }
    finally {
View Full Code Here

Examples of org.eclipse.core.filebuffers.ITextFileBuffer

  public String getContents(IPath filePath) {
    if (DEBUG)
      System.out.println("getContents:" + filePath);
   
    // use an text file buffer if one is already open
    ITextFileBuffer existingBuffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(filePath, LocationKind.IFILE);
    if (existingBuffer != null) {
      IDocument document = existingBuffer.getDocument();
      if (document != null) {
        return document.get();
      }
    }
   
View Full Code Here

Examples of org.eclipse.core.filebuffers.ITextFileBuffer

        }
      }
      if (is == null) {
        try {
          FileBuffers.getTextFileBufferManager().connect(filePath, LocationKind.LOCATION, new NullProgressMonitor());
          ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(filePath, LocationKind.LOCATION);
          if (buffer != null) {
            s.append(buffer.getDocument().get());
          }
        }
        catch (CoreException e) {
          // nothing to do
          Logger.logException(e);
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.