Class AbstractResolution
- java.lang.Object
-
- org.eclipse.emf.compare.ide.ui.internal.logical.resolver.AbstractResolution
-
- Direct Known Subclasses:
LocalModelResolution,LocalModelsResolution,ModelsResolution
public abstract class AbstractResolution extends Object
Abstract super-class of resolving computations.
-
-
Field Summary
Fields Modifier and Type Field Description protected IResolutionContextcontextThe context.protected DiagnosticSupportdiagnosticThe diagnostic.protected IImplicitDependenciesimplicitDependenciesThe implicit dependencies.protected EMFCompareLoggerloggerThe loggerprotected org.eclipse.core.runtime.SubMonitormonitorThe monitor.
-
Constructor Summary
Constructors Constructor Description AbstractResolution(IResolutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<URI>asURISet(Set<org.eclipse.core.resources.IStorage> storages)protected <T> Tcall(Callable<T> callable)Executes the given callable as soon as there is no other computation running, and automatically runs "finalization" treatment once the computation is over, whatever its outcome (success or failure).protected RunnablegetFinalizeResolvingRunnable()This provides the treatment that is run at the end of the computation, whatever its outcome.protected IImplicitDependenciesgetImplicitDependencies()Returns the implicit dependencies which can be used to retrieve a set of files that should be part of the same logical model than a given file.protected intgetTicks()Number of ticks to allocate to the progress monitor used for reporting progress.protected Set<org.eclipse.core.resources.IStorage>resolveTraversal(org.eclipse.core.resources.IFile file, Set<URI> bounds)Computes the traversal of the given file, excluding the given bounds if needed.
-
-
-
Field Detail
-
context
protected final IResolutionContext context
The context.
-
monitor
protected final org.eclipse.core.runtime.SubMonitor monitor
The monitor.
-
diagnostic
protected DiagnosticSupport diagnostic
The diagnostic.
-
logger
protected final EMFCompareLogger logger
The logger
-
implicitDependencies
protected IImplicitDependencies implicitDependencies
The implicit dependencies.
-
-
Constructor Detail
-
AbstractResolution
public AbstractResolution(IResolutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor)
Constructor.- Parameters:
context- The resolution context, must not benullmonitor- The progress monitor, can benull
-
-
Method Detail
-
getImplicitDependencies
protected IImplicitDependencies getImplicitDependencies()
Returns the implicit dependencies which can be used to retrieve a set of files that should be part of the same logical model than a given file.- Returns:
- The
IImplicitDependenciesinstance.
-
getTicks
protected int getTicks()
Number of ticks to allocate to the progress monitor used for reporting progress.- Returns:
- The number of ticks to use, 100 by default but can be overridden if necessary.
-
call
protected <T> T call(Callable<T> callable)
Executes the given callable as soon as there is no other computation running, and automatically runs "finalization" treatment once the computation is over, whatever its outcome (success or failure). Adiagnosticis instantiated before the computation and should be used thourghout this whole computation. It will be set tonullbefore returning, whatever happens.- Type Parameters:
T- The type of the returned value.- Parameters:
callable- Treatment to run- Returns:
- The result of the treatment
-
getFinalizeResolvingRunnable
protected Runnable getFinalizeResolvingRunnable()
This provides the treatment that is run at the end of the computation, whatever its outcome. It is guaranteed to run once, in a block "finally", along with other required finalization treatments that are run systematically. There's no need to acquire a lock, this is guaranteed to have been done before, and it is released after this treatment ends.- Returns:
- The
Runnableto run after having resolved resources.
-
asURISet
protected Set<URI> asURISet(Set<org.eclipse.core.resources.IStorage> storages)
- Parameters:
storages- The storages to transform, must not benull.- Returns:
- A mutable set of
URIs, may be empty but never)null.
-
resolveTraversal
protected Set<org.eclipse.core.resources.IStorage> resolveTraversal(org.eclipse.core.resources.IFile file, Set<URI> bounds)
Computes the traversal of the given file, excluding the given bounds if needed.- Parameters:
file- File for which the traversal is neededbounds- URI to exclude from the logical model computation in case both compared resources are part of the same logical model- Returns:
- A
Setof the file's outgoing and incoming dependencies, never null but possibly empty.
-
-