org.eclipse.handly.model.impl.support

## Class ISourceFileImplSupport.ReconcileOperation

- java.lang.Object
- - org.eclipse.handly.model.impl.support.ISourceFileImplSupport.ReconcileOperation

- Direct Known Subclasses:
    ISourceFileImplSupport.NotifyingReconcileOperation
  Enclosing interface:
    ISourceFileImplSupport

      public static class ISourceFileImplSupport.ReconcileOperation
      extends java.lang.Object

  Reconciles a working copy.

  This class or a subclass of this class are not intended to be used by clients for purposes other than extension or instance creation; instances of this class or a subclass of this class are not intended to be used by clients for purposes other than returning from an implementation of `ISourceFileImplSupport.getReconcileOperation_()`.

  See Also:
    `ISourceFileImplSupport.NotifyingReconcileOperation`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ISourceFileImplSupport` | `sourceFile` This operation's source file.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ReconcileOperation(ISourceFileImplSupport sourceFile)` Constructs a reconcile operation for the given source file.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static boolean` | `isInitialReconcile(IContext context)` Returns whether this is initial reconcile.
    `protected static boolean` | `isReconcilingForced(IContext context)` Returns whether reconciling is forced, i.e., the working copy buffer has not been modified since the last time the working copy was reconciled.
    `protected void` | `reconcile(IContext context, org.eclipse.core.runtime.IProgressMonitor monitor)` Reconciles the working copy according to options specified in the given context.
    `protected void` | `reconcileStructure(IContext context, org.eclipse.core.runtime.IProgressMonitor monitor)` Reconciles the structure of the working copy by rebuilding it according to options specified in the given context.
    `protected boolean` | `shouldReconcileStructure(IContext context)` Returns whether the structure of the working copy needs to be reconciled by rebuilding it according to options specified in the given context.

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

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

- - ### Field Detail

    - #### sourceFile

          protected final ISourceFileImplSupport sourceFile

      This operation's source file.

  - ### Constructor Detail

    - #### ReconcileOperation

          protected ReconcileOperation(ISourceFileImplSupport sourceFile)

      Constructs a reconcile operation for the given source file.
      Parameters:
        `sourceFile` - not `null`

  - ### Method Detail

    - #### reconcile

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

      Reconciles the working copy according to options specified in the given context.

      The following context options, if simultaneously present, must be mutually consistent:

      - `ISourceFileImplSupport.SOURCE_AST` - Specifies the AST to use when reconciling. The AST is safe to read in the dynamic context of this method call, but must not be modified.
      - `ISourceFileImplSupport.SOURCE_CONTENTS` - Specifies the source string to use when reconciling.

      At least one of `SOURCE_AST` or `SOURCE_CONTENTS` must have a non-null value in the given context.

      The given context may provide additional data that this method can use, including the following:

      - `ISourceFileImplSupport.SOURCE_SNAPSHOT` - Specifies the source snapshot from which `SOURCE_AST` was created or `SOURCE_CONTENTS` was obtained. The snapshot may expire.

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

      This implementation calls `reconcileStructure` if, and only if, `shouldReconcileStructure` returns `true`.

      Parameters:
        `context` - the operation context (not `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
        `org.eclipse.core.runtime.OperationCanceledException` - if this method is canceled

    - #### shouldReconcileStructure

          protected boolean shouldReconcileStructure(IContext context)

      Returns whether the structure of the working copy needs to be reconciled by rebuilding it according to options specified in the given context.

      Subclasses may override this method, but must return `true` whenever the super implementation returns `true`; they may return `true` when the super implementation returns `false`.

      Parameters:
        `context` - the operation context (not `null`)
      Returns:
        `true` if the working copy structure needs to be reconciled, and `false` otherwise
      See Also:
        `reconcile(IContext, IProgressMonitor)`, `reconcileStructure(IContext, IProgressMonitor)`

    - #### isInitialReconcile

          protected static boolean isInitialReconcile(IContext context)

      Returns whether this is initial reconcile.
      Parameters:
        `context` - the operation context (not `null`)
      Returns:
        `true` if this is initial reconcile, and `false` otherwise
      See Also:
        `reconcile(IContext, IProgressMonitor)`, `reconcileStructure(IContext, IProgressMonitor)`

    - #### isReconcilingForced

          protected static boolean isReconcilingForced(IContext context)

      Returns whether reconciling is forced, i.e., the working copy buffer has not been modified since the last time the working copy was reconciled.
      Parameters:
        `context` - the operation context (not `null`)
      Returns:
        `true` if reconciling is forced, and `false` otherwise
      See Also:
        `reconcile(IContext, IProgressMonitor)`, `reconcileStructure(IContext, IProgressMonitor)`

    - #### reconcileStructure

          protected void reconcileStructure(IContext context,
                                            org.eclipse.core.runtime.IProgressMonitor monitor)
                                     throws org.eclipse.core.runtime.CoreException

      Reconciles the structure of the working copy by rebuilding it according to options specified in the given context.

      The following context options, if simultaneously present, must be mutually consistent:

      - `ISourceFileImplSupport.SOURCE_AST` - Specifies the AST to use when reconciling. The AST is safe to read in the dynamic context of this method call, but must not be modified.
      - `ISourceFileImplSupport.SOURCE_CONTENTS` - Specifies the source string to use when reconciling.

      At least one of `SOURCE_AST` or `SOURCE_CONTENTS` must have a non-null value in the given context.

      The given context may provide additional data that this method can use, including the following:

      - `ISourceFileImplSupport.SOURCE_SNAPSHOT` - Specifies the source snapshot from which `SOURCE_AST` was created or `SOURCE_CONTENTS` was obtained. The snapshot may expire.

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

      Parameters:
        `context` - the operation context (not `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
        `org.eclipse.core.runtime.OperationCanceledException` - if this method is canceled
      See Also:
        `reconcile(IContext, IProgressMonitor)`, `shouldReconcileStructure(IContext)`

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