Class ResourceStreamAccessorImpl
- java.lang.Object
-
- org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.impl.AbstractTypedElementAdapter
-
- org.eclipse.emf.compare.rcp.ui.internal.contentmergeviewer.accessor.impl.ResourceStreamAccessorImpl
-
- All Implemented Interfaces:
IStreamContentAccessor
,ITypedElement
public class ResourceStreamAccessorImpl extends AbstractTypedElementAdapter implements IStreamContentAccessor
A specificIStreamContentAccessor
for resources.- Since:
- 4.0
-
-
Field Summary
-
Fields inherited from interface org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.ITypedElement
FOLDER_TYPE, TEXT_TYPE, UNKNOWN_TYPE
-
-
Constructor Summary
Constructors Constructor Description ResourceStreamAccessorImpl(AdapterFactory adapterFactory, Resource resource)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStream
getContents()
Returns an openInputStream
for this object which can be used to retrieve the object's content.org.eclipse.swt.graphics.Image
getImage()
Returns an image for this object.String
getName()
Returns the name of this object.String
getType()
Returns the type of this object.-
Methods inherited from class org.eclipse.emf.compare.rcp.ui.contentmergeviewer.accessor.legacy.impl.AbstractTypedElementAdapter
getAdapterFactory, getItemDelegator, getRootAdapterFactory
-
-
-
-
Constructor Detail
-
ResourceStreamAccessorImpl
public ResourceStreamAccessorImpl(AdapterFactory adapterFactory, Resource resource)
Default constructor.- Parameters:
adapterFactory
- the adapater factory used to create the accessor.resource
- the Resource to associate with the accessor.
-
-
Method Detail
-
getName
public String getName()
Returns the name of this object. The name is used when displaying this object in the UI.- Specified by:
getName
in interfaceITypedElement
- Returns:
- the name of this object
- See Also:
ITypedElement.getName()
-
getImage
public org.eclipse.swt.graphics.Image getImage()
Returns an image for this object. This image is used when displaying this object in the UI.- Specified by:
getImage
in interfaceITypedElement
- Returns:
- the image of this object or
null
if this type of input has no image - See Also:
ITypedElement.getImage()
-
getType
public String getType()
Returns the type of this object. For objects with a file name this is typically the file extension. For folders its the constantFOLDER_TYPE
. The type is used for determining a suitable viewer for this object.- Specified by:
getType
in interfaceITypedElement
- Returns:
- the type of this object
- See Also:
ITypedElement.getType()
-
getContents
public InputStream getContents() throws org.eclipse.core.runtime.CoreException
Returns an openInputStream
for this object which can be used to retrieve the object's content. The client is responsible for closing the stream when finished. Returnsnull
if this object has no streamable contents.- Specified by:
getContents
in interfaceIStreamContentAccessor
- Returns:
- an input stream containing the contents of this object
- Throws:
org.eclipse.core.runtime.CoreException
- if the contents of this object could not be accessed- See Also:
IStreamContentAccessor.getContents()
-
-