Class StreamAccessorStorage
java.lang.Object
org.eclipse.emf.compare.ide.ui.internal.logical.StreamAccessorStorage
- All Implemented Interfaces:
org.eclipse.core.resources.IStorage,org.eclipse.core.runtime.IAdaptable,IStoragePathAdapterProvider
public class StreamAccessorStorage
extends Object
implements org.eclipse.core.resources.IStorage, IStoragePathAdapterProvider
This implementation of IStorage simply wraps a stream content accessor.
-
Constructor Summary
ConstructorsConstructorDescriptionStreamAccessorStorage(org.eclipse.compare.IStreamContentAccessor accessor, String fullPath) Wraps the given accessor. -
Method Summary
Modifier and TypeMethodDescriptioncreateStoragePathAdapter(String path, boolean isLocal) This method is used to create a new StoragePathAdapter.static org.eclipse.team.core.history.IFileRevisionfindCommitId(org.eclipse.compare.ITypedElement element) Get the commit id for the given elementstatic StreamAccessorStoragefromTypedElement(String storagePath, org.eclipse.compare.ITypedElement element) Creates a StreamAccessorStorage given the input typed element.static StreamAccessorStoragefromTypedElement(org.eclipse.compare.ITypedElement element) This is a short-hand forfromTypedElement(String, ITypedElement).getAdapter(Class adapter) org.eclipse.core.runtime.IPathgetName()boolean
-
Constructor Details
-
StreamAccessorStorage
Wraps the given accessor.- Parameters:
accessor- The accessor to wrap as an IStorage.fullPath- Full path to the underlying storage.
-
-
Method Details
-
fromTypedElement
public static StreamAccessorStorage fromTypedElement(org.eclipse.compare.ITypedElement element) throws IllegalArgumentException This is a short-hand forfromTypedElement(String, ITypedElement). This second one should be preferred in case the given element is remote and we need a proper path for it.- Parameters:
element- The typed element for which we need to create a wrapper.- Returns:
- The wrapped typed element.
- Throws:
IllegalArgumentException- If the given element does not implementIStreamContentAccessor.
-
fromTypedElement
public static StreamAccessorStorage fromTypedElement(String storagePath, org.eclipse.compare.ITypedElement element) throws IllegalArgumentException Creates a StreamAccessorStorage given the input typed element. Note that the given typed element -must- implementIStreamContentAccessoras well.- Parameters:
storagePath- The full path to this storage, can benull.element- The typed element for which we need to create a wrapper.- Returns:
- The wrapped typed element.
- Throws:
IllegalArgumentException- If the given element does not implementIStreamContentAccessor.
-
findCommitId
public static org.eclipse.team.core.history.IFileRevision findCommitId(org.eclipse.compare.ITypedElement element) Get the commit id for the given element- Parameters:
element- The element for which we want the commit id- Returns:
- the commit id
-
createStoragePathAdapter
This method is used to create a new StoragePathAdapter.- Specified by:
createStoragePathAdapterin interfaceIStoragePathAdapterProvider- Parameters:
path- The path to use.isLocal- Whether this storage is local.- Returns:
- the new adapter
- See Also:
-
IStoragePathAdapterProvider#createStoragePathAdapter()
-
getAdapter
- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable- See Also:
-
IAdaptable.getAdapter(java.lang.Class)
-
getContents
- Specified by:
getContentsin interfaceorg.eclipse.core.resources.IStorage- Throws:
org.eclipse.core.runtime.CoreException- See Also:
-
IStorage.getContents()
-
getFullPath
public org.eclipse.core.runtime.IPath getFullPath()- Specified by:
getFullPathin interfaceorg.eclipse.core.resources.IStorage- See Also:
-
IStorage.getFullPath()
-
getName
- Specified by:
getNamein interfaceorg.eclipse.core.resources.IStorage- See Also:
-
IStorage.getName()
-
isReadOnly
public boolean isReadOnly()- Specified by:
isReadOnlyin interfaceorg.eclipse.core.resources.IStorage- See Also:
-
IStorage.isReadOnly()
-