org.eclipse.handly.xtext.ui.editor

## Class XtextWorkingCopyCallback

- java.lang.Object
- - org.eclipse.handly.model.impl.WorkingCopyCallback
  - - org.eclipse.handly.xtext.ui.editor.XtextWorkingCopyCallback

- All Implemented Interfaces:
    IWorkingCopyCallback

      public class XtextWorkingCopyCallback
      extends WorkingCopyCallback

  Xtext-specific implementation of `IWorkingCopyCallback`. Reconciles the working copy when the underlying `HandlyXtextDocument` is reconciled.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XtextWorkingCopyCallback()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected HandlyXtextDocument` | `getDocument()` Returns the underlying document of the working copy buffer.
    `boolean` | `needsReconciling()` Returns whether the working copy needs reconciling, i.e., its buffer has been modified since the last time it was reconciled.
    `void` | `onDispose()` Informs this callback that the working copy has been disposed.
    `void` | `onInit(IWorkingCopyInfo info)` Informs this callback about the working copy it will work on.
    `void` | `reconcile(IContext context, org.eclipse.core.runtime.IProgressMonitor monitor)` Reconciles the working copy.

    - ### Methods inherited from class org.eclipse.handly.model.impl.WorkingCopyCallback

      `getWorkingCopyInfo`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XtextWorkingCopyCallback

          public XtextWorkingCopyCallback()

  - ### Method Detail

    - #### onInit

          public void onInit(IWorkingCopyInfo info)
                      throws org.eclipse.core.runtime.CoreException

      Description copied from class: `WorkingCopyCallback`
      Informs this callback about the working copy it will work on. This method is called before any other method and marks the start of the callback's lifecycle.

      Clients should not call this method (the model implementation calls it at appropriate times).

      Subclasses may override this method, but must make sure to call the super implementation.

      Specified by:
        `onInit` in interface `IWorkingCopyCallback`
      Overrides:
        `onInit` in class `WorkingCopyCallback`
      Parameters:
        `info` - the working copy info (never `null`)
      Throws:
        `org.eclipse.core.runtime.CoreException` - if this callback was not initialized successfully

    - #### onDispose

          public void onDispose()

      Description copied from class: `WorkingCopyCallback`
      Informs this callback that the working copy has been disposed. This is the last method called on the callback and marks the end of the callback's lifecycle.

      Clients should not call this method (the model implementation calls it at appropriate times).

      Subclasses may override this method, but must make sure to call the super implementation.

      Specified by:
        `onDispose` in interface `IWorkingCopyCallback`
      Overrides:
        `onDispose` in class `WorkingCopyCallback`

    - #### needsReconciling

          public final boolean needsReconciling()

      Description copied from interface: `IWorkingCopyCallback`
      Returns whether the working copy needs reconciling, i.e., its buffer has been modified since the last time it was reconciled.

      Clients should not call this method (the model implementation calls it at appropriate times).

      Returns:
        `true` if the working copy needs reconciling, and `false` otherwise

    - #### reconcile

          public final void reconcile(IContext context,
                                      org.eclipse.core.runtime.IProgressMonitor monitor)
                               throws org.eclipse.core.runtime.CoreException

      Description copied from interface: `IWorkingCopyCallback`
      Reconciles the working copy.

      Clients should not call this method (the model implementation calls it at appropriate times).

      Implementations are encouraged to support the following standard options, which may be specified in the given context:

      - `FORCE_RECONCILING` - Indicates whether reconciling has to be performed even if the working copy buffer has not been modified since the last time the working copy was reconciled.

      An implementation of this method is supposed to invoke the working copy's `reconcile strategy` by calling its `reconcile` method with an appropriately augmented context while providing the necessary synchronization guarantees.

      Parameters:
        `context` - the operation context (never `null`)
        `monitor` - a progress monitor, or `null` if progress reporting is not desired. The caller must not rely on `IProgressMonitor.done()` having been called by the receiver
      Throws:
        `org.eclipse.core.runtime.CoreException` - if the working copy could not be reconciled

    - #### getDocument

          protected final HandlyXtextDocument getDocument()

      Returns the underlying document of the working copy buffer.
      Returns:
        the underlying document (never `null`)

Copyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0