Package org.eclipse.emf.compare.ide.ui.internal.logical

# Class RenameDetector

java.lang.Object
org.eclipse.emf.compare.ide.ui.internal.logical.RenameDetector

public class RenameDetector extends Object
Detector for revealing potential file renames that may have occurred in `IStorageProviderAccessor.DiffSide.SOURCE` or `IStorageProviderAccessor.DiffSide.REMOTE` in the context of a `Subscriber`.

## Constructor Summary

Constructors
Constructor
Description
`RenameDetector(org.eclipse.team.core.subscribers.Subscriber subscriber, IStorageProviderAccessor accessor)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`com.google.common.base.Optional<org.eclipse.core.resources.IFile>`
`getFileAfterRename(org.eclipse.core.resources.IFile originFile, IStorageProviderAccessor.DiffSide side)`
Given an origin file, this method optionally returns the corresponding `IFile` after it has been renamed on the respective `side`, if it has been renamed at all.
`com.google.common.base.Optional<org.eclipse.core.resources.IFile>`
`getFileBeforeRename(org.eclipse.core.resources.IFile sourceOrRemoteFile, IStorageProviderAccessor.DiffSide side)`
Given a source or remote file, this method optionally returns the corresponding `IFile` before it has been renamed on the respective `side`, if it has been renamed at all.

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

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

## Constructor Details

### RenameDetector

public RenameDetector(org.eclipse.team.core.subscribers.Subscriber subscriber, IStorageProviderAccessor accessor)
Constructor.

Parameters:
  `subscriber` - The subscriber to access the diffs. This parameter may be `null`, and as such, will result in no rename detection.
  `accessor` - The accessor to access the file variants.

## Method Details

### getFileBeforeRename

public com.google.common.base.Optional<org.eclipse.core.resources.IFile> getFileBeforeRename(org.eclipse.core.resources.IFile sourceOrRemoteFile, IStorageProviderAccessor.DiffSide side)
Given a source or remote file, this method optionally returns the corresponding `IFile` before it has been renamed on the respective `side`, if it has been renamed at all.

Only `IStorageProviderAccessor.DiffSide.SOURCE` or `IStorageProviderAccessor.DiffSide.REMOTE` are valid values for `side`.

Parameters:
  `sourceOrRemoteFile` - The potentially renamed file.
  `side` - The `IStorageProviderAccessor.DiffSide` to look for the rename (only `IStorageProviderAccessor.DiffSide.SOURCE` or `IStorageProviderAccessor.DiffSide.REMOTE` are valid).
Returns:
  The file before the rename, if it has been renamed at all, `Optional.absent()` otherwise.

### getFileAfterRename

public com.google.common.base.Optional<org.eclipse.core.resources.IFile> getFileAfterRename(org.eclipse.core.resources.IFile originFile, IStorageProviderAccessor.DiffSide side)
Given an origin file, this method optionally returns the corresponding `IFile` after it has been renamed on the respective `side`, if it has been renamed at all.

Only `IStorageProviderAccessor.DiffSide.SOURCE` or `IStorageProviderAccessor.DiffSide.REMOTE` are valid values for `side`.

Parameters:
  `originFile` - The potentially renamed file.
  `side` - The `IStorageProviderAccessor.DiffSide` to look for the rename (only `IStorageProviderAccessor.DiffSide.SOURCE` or `IStorageProviderAccessor.DiffSide.REMOTE` are valid).
Returns:
  The file after the rename, if it has been renamed at all, `Optional.absent()` otherwise.