org.eclipse.compare
Class SharedDocumentAdapter
java.lang.Object
org.eclipse.compare.SharedDocumentAdapter
-
All Implemented Interfaces:
-
ISharedDocumentAdapter
-
public abstract class SharedDocumentAdapter
- extends
Object
- implements
ISharedDocumentAdapter
An implementation of
ISharedDocumentAdapter
that provides default behavior for the
methods of that interface.
Clients may subclass this class.
-
Since:
- 3.3
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
SharedDocumentAdapter
public SharedDocumentAdapter()
getDocumentProvider
public static
IDocumentProvider getDocumentProvider(
IEditorInput input)
- Return the document provider for the given editor input.
-
-
-
Parameters:
-
input
- the editor input
-
Returns:
- the document provider for the given editor input
connect
public void connect(
IDocumentProvider provider,
IEditorInput documentKey)
throws
CoreException
-
Description copied from interface:
ISharedDocumentAdapter
- Connect the given element to its document provider. All connections must be performed
through this adapter so that the adapter can track whether it is connected or not.
-
-
Specified by:
-
connect
in interface
ISharedDocumentAdapter
-
-
Parameters:
-
provider
- the document provider -
documentKey
- the element's key returned from
ISharedDocumentAdapter.getDocumentKey(Object)
-
Throws:
-
CoreException
- if connection was not possible -
See Also:
-
IDocumentProvider.connect(Object)
disconnect
public void disconnect(
IDocumentProvider provider,
IEditorInput documentKey)
-
Description copied from interface:
ISharedDocumentAdapter
- Disconnect the element from the document provider. All connects and
disconnects must occur through the adapter so that the adapter can
track whether it is connected or not.
-
-
Specified by:
-
disconnect
in interface
ISharedDocumentAdapter
-
-
Parameters:
-
provider
- the document provider -
documentKey
- the element's key returned from
ISharedDocumentAdapter.getDocumentKey(Object)
-
See Also:
-
IDocumentProvider.disconnect(Object)
getDocumentKey
public
IEditorInput getDocumentKey(
Object element)
- Default implementation of
getDocumentKey(Object)
that returns a
FileEditorInput
for the element if the element adapts to
IFile
.
-
-
Specified by:
-
getDocumentKey
in interface
ISharedDocumentAdapter
-
-
Parameters:
-
element
- the element being queried for a shared document
-
Returns:
- the object that acts as the key to obtain a document provider and
document or
null
-
See Also:
-
ISharedDocumentAdapter.getDocumentKey(java.lang.Object)
saveDocument
protected void saveDocument(
IDocumentProvider provider,
IEditorInput documentKey,
IDocument document,
boolean overwrite,
IProgressMonitor monitor)
throws
CoreException
- A helper method to save a document.
-
-
-
Parameters:
-
provider
- the document provider -
documentKey
- the document key -
document
- the document -
overwrite
- indicates whether overwrite should be performed
while saving the given element if necessary -
monitor
- a progress monitor
-
Throws:
-
CoreException
disconnect
public void disconnect(
Object element)
-
Description copied from interface:
ISharedDocumentAdapter
- A helper disconnect method that looks up the appropriate key (using
ISharedDocumentAdapter.getDocumentKey(Object)
and the appropriate provider and calls
ISharedDocumentAdapter.disconnect(IDocumentProvider, IEditorInput)
.
-
-
Specified by:
-
disconnect
in interface
ISharedDocumentAdapter
-
-
Parameters:
-
element
- the element that was used to previously connect to a document -
See Also:
-
IDocumentProvider.disconnect(Object)
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.