Package org.eclipse.compare.internal
Class MergeSourceViewer
java.lang.Object
org.eclipse.compare.internal.MergeSourceViewer
- All Implemented Interfaces:
IOperationHistoryListener
,IAdaptable
,IMenuListener
,ITextListener
,ISelectionChangedListener
public class MergeSourceViewer
extends Object
implements ISelectionChangedListener, ITextListener, IMenuListener, IOperationHistoryListener, IAdaptable
Wraps a JFace SourceViewer and add some convenience methods.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMergeSourceViewer
(SourceViewer sourceViewer, ResourceBundle bundle, ICompareContainer container) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAction
(String actionId, MergeViewerAction action) void
void
addTextAction
(IAction textEditorPropertyAction) void
configure
(SourceViewerConfiguration configuration) protected IAction
createAction
(String actionId) void
dispose()
The viewer is no longer part of the UI, it's a wrapper only.<T> T
getAdapter
(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.int
boolean
int
getLineRange
(Position p, Point region) int
int
int
protected void
handle show/hide line numbers from editor preferencesvoid
void
Something of note has happened in the IOperationHistory.boolean
void
menuAboutToShow
(IMenuManager menu) Notifies this listener that the menu is about to be shown by the given menu manager.void
boolean
removeTextAction
(IAction textEditorPropertyAction) void
void
Notifies that the selection has changed.void
setBackgroundColor
(Color color) void
setBounds
(int x, int y, int width, int height) specific implementation to support a vertical rulervoid
setEnabled
(boolean enabled) void
void
setForegroundColor
(Color color) void
setLineBackground
(Position position, Color c) void
void
setSelection
(Position position) void
textChanged
(TextEvent event) The visual representation of a text viewer this listener is registered with has been changed.void
update all actions independent of their typevoid
vscroll
(int line)
-
Field Details
-
UNDO_ID
- See Also:
-
REDO_ID
- See Also:
-
CUT_ID
- See Also:
-
COPY_ID
- See Also:
-
PASTE_ID
- See Also:
-
DELETE_ID
- See Also:
-
SELECT_ALL_ID
- See Also:
-
FIND_ID
- See Also:
-
GOTO_LINE_ID
- See Also:
-
CHANGE_ENCODING_ID
- See Also:
-
-
Constructor Details
-
MergeSourceViewer
public MergeSourceViewer(SourceViewer sourceViewer, ResourceBundle bundle, ICompareContainer container)
-
-
Method Details
-
rememberDocument
-
getRememberedDocument
-
hideSaveAction
public void hideSaveAction() -
setFont
-
setBackgroundColor
-
setForegroundColor
-
setEnabled
public void setEnabled(boolean enabled) -
getEnabled
public boolean getEnabled() -
setRegion
-
getRegion
-
isControlOkToUse
public boolean isControlOkToUse() -
setSelection
-
setLineBackground
-
resetLineBackground
public void resetLineBackground() -
getLineCount
public int getLineCount() -
getViewportLines
public int getViewportLines() -
getViewportHeight
public int getViewportHeight() -
getDocumentRegionOffset
public int getDocumentRegionOffset() -
getVerticalScrollOffset
public int getVerticalScrollOffset() -
getLineRange
-
vscroll
public void vscroll(int line) -
addAction
-
getAction
-
createAction
-
selectionChanged
Description copied from interface:ISelectionChangedListener
Notifies that the selection has changed.- Specified by:
selectionChanged
in interfaceISelectionChangedListener
- Parameters:
event
- event object describing the change
-
textChanged
Description copied from interface:ITextListener
The visual representation of a text viewer this listener is registered with has been changed.- Specified by:
textChanged
in interfaceITextListener
- Parameters:
event
- the description of the change
-
dispose
public void dispose()The viewer is no longer part of the UI, it's a wrapper only. The disposal doesn't take place while releasing the editor pane's children. The method have to be called it manually. The wrapped viewer is disposed as a regular viewer, while disposing the UI. -
updateActions
public void updateActions()update all actions independent of their type -
configure
-
setBounds
public void setBounds(int x, int y, int width, int height) specific implementation to support a vertical ruler -
handlePropertyChangeEvent
handle show/hide line numbers from editor preferences -
addTextAction
-
removeTextAction
-
addAction
-
historyNotification
Description copied from interface:IOperationHistoryListener
Something of note has happened in the IOperationHistory. Listeners should check the supplied event for details.- Specified by:
historyNotification
in interfaceIOperationHistoryListener
- Parameters:
event
- the OperationHistoryEvent that describes the particular notification.
-
getSourceViewer
- Returns:
- the wrapped viewer
-
getAdapter
Description copied from interface:IAdaptable
Returns an object which is an instance of the given class associated with this object. Returnsnull
if no such object can be found.Clients may implement this method but should generally call
Adapters.adapt(Object, Class, boolean)
rather than invoking it directly.- Specified by:
getAdapter
in interfaceIAdaptable
- Type Parameters:
T
- the class type- Parameters:
adapter
- the adapter class to look up- Returns:
- a object of the given class, or
null
if this object does not have an adapter for the given class
-