Package org.eclipse.ui.texteditor

Examples of org.eclipse.ui.texteditor.IDocumentProvider


  /**
   * Removes the annotations.
   */
  private void removeAnnotations() {
    final IDocumentProvider docProvider = fEditor.getDocumentProvider();

    if (docProvider == null) {
      return;
    }

    IAnnotationModel model = docProvider.getAnnotationModel(fEditor
        .getEditorInput());

    if (model == null)
      return;

View Full Code Here


          IEditorPart editor = IDE.openEditor(page, cexFile);

          if (editor instanceof ITextEditor) {
            ITextEditor textEditor = (ITextEditor) editor;

            IDocumentProvider documentProvider =
              textEditor.getDocumentProvider();
            IDocument document =
              documentProvider.getDocument(editor.getEditorInput());

            FindReplaceDocumentAdapter searchAdapter =
              new FindReplaceDocumentAdapter(document);

            try {
View Full Code Here

   *             getExistingModelFor*(IDocument). Supported document
   *             providers ensure that the document maps to a shared
   *             structured model.
   */
  public IStructuredModel getModel() {
    IDocumentProvider documentProvider = getDocumentProvider();
   
    if (documentProvider == null) {
      // this indicated an error in startup sequence
      Logger.trace(getClass().getName(), "Program Info Only: document provider was null when model requested"); //$NON-NLS-1$ //$NON-NLS-2$
    }
   
    // Remember if we entered this method without a model existing
    boolean initialModelNull = (fStructuredModel == null);
   
    if (fStructuredModel == null && documentProvider != null) {
      // lazily set the model instance, although this is an ABNORMAL
      // CODE PATH
      if (documentProvider instanceof IModelProvider) {
        fStructuredModel = ((IModelProvider) documentProvider).getModel(getEditorInput());
        fisReleased = false;
      }
      else {
        IDocument doc = documentProvider.getDocument(getEditorInput());
        if (doc instanceof IStructuredDocument) {
          /*
           * Called in this manner because getExistingModel can skip
           * some calculations always performed in getModelForEdit
           */
 
View Full Code Here

    IResource resource = ResourceUtil.getResource(input);
    if(resource != null) {
        resource.getWorkspace().addResourceChangeListener(this);
    }

    final IDocumentProvider docProvider = sourcePage.getDocumentProvider();
    IDocument document = docProvider.getDocument(input);
    try {
      model.loadFrom(document);
    } catch (IOException e) {
      throw new PartInitException("Error reading editor input.", e);
    }
   
    // Ensure the field values are updated if the file content is replaced
        docProvider.addElementStateListener(new IElementStateListener() {
            public void elementMoved(Object originalElement, Object movedElement) {
            }

            public void elementDirtyStateChanged(Object element, boolean isDirty) {
            }

            public void elementDeleted(Object element) {
            }

            public void elementContentReplaced(Object element) {
                try {
                    System.out.println("--> Content Replaced");
                    model.loadFrom(docProvider.getDocument(element));
                } catch (IOException e) {
                  e.printStackTrace();
                }
            }
View Full Code Here

    formEditor.getReportModel().saveChangesTo(document);
    stale = false;
  }

  private IDocument getDocument() {
    IDocumentProvider docProvider = getDocumentProvider();
    IEditorInput input = getEditorInput();
    IDocument doc = docProvider.getDocument(input);
    return doc;
  }
View Full Code Here

                    FileActivity.created(user, path, Purpose.RECOVERY));

                // Immediately follow up with a new checksum
                IDocument doc;
                FileEditorInput input = new FileEditorInput(file);
                IDocumentProvider provider = EditorManager
                    .getDocumentProvider(input);
                try {
                    provider.connect(input);
                    doc = provider.getDocument(input);

                    final DocumentChecksum checksum = new DocumentChecksum(path);
                    checksum.bind(doc);
                    checksum.update();
                    Utils.runSafeSWTSync(log, new Runnable() {
                        public void run() {
                            sarosSession.activityCreated(new ChecksumActivity(
                                user, path, checksum.getHash(), checksum
                                    .getLength()));
                        }
                    });
                } catch (CoreException e) {
                    log.warn("Could not check checksum of file "
                        + path.toString());
                } finally {
                    provider.disconnect(input);
                }

            } catch (IOException e) {
                log.error("File could not be read, despite existing: " + path,
                    e);
View Full Code Here

        this.editorManager.editorAPI.addSharedEditorListener(
            this.editorManager, editorPart);
        this.editorManager.editorAPI.setEditable(editorPart,
            this.editorManager.hasWriteAccess);

        IDocumentProvider documentProvider = EditorManager
            .getDocumentProvider(input);

        // TODO Not registering is very helpful to find errors related to file
        // transfer problems
        // this.editorManager.dirtyStateListener.register(documentProvider,
View Full Code Here

        // Unregister and unhook
        this.editorManager.editorAPI.setEditable(editorPart, true);
        this.editorManager.editorAPI.removeSharedEditorListener(
            this.editorManager, editorPart);

        IDocumentProvider documentProvider = EditorManager
            .getDocumentProvider(input);
        // this.editorManager.dirtyStateListener.unregister(documentProvider,
        // input);

        IDocument document = documentProvider.getDocument(input);
        if (document == null) {
            log.warn("Could not disconnect from document: " + path);
        } else {
            document
                .removeDocumentListener(this.editorManager.documentListener);
View Full Code Here

                + " is not available locally: " + path, new StackTrace());
            return;
        }

        FileEditorInput input = new FileEditorInput(file);
        IDocumentProvider provider = EditorManager.getDocumentProvider(input);
        try {
            provider.connect(input);
        } catch (CoreException e) {
            log.error("Could not connect to a document provider on file '"
                + file.toString() + "':", e);
            return;
        }
View Full Code Here

        connectedUserWithWriteAccessFiles.remove(path);

        IFile file = path.getFile();
        FileEditorInput input = new FileEditorInput(file);
        IDocumentProvider provider = EditorManager.getDocumentProvider(input);
        provider.disconnect(input);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.texteditor.IDocumentProvider

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.