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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMergeSourceViewer(SourceViewer sourceViewer, ResourceBundle bundle, ICompareContainer container) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAction(String actionId, MergeViewerAction action) voidvoidaddTextAction(IAction textEditorPropertyAction) voidconfigure(SourceViewerConfiguration configuration) protected IActioncreateAction(String actionId) voiddispose()The viewer is no longer part of the UI, it's a wrapper only.<T> TgetAdapter(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.intbooleanintgetLineRange(Position p, Point region) intintintprotected voidhandle show/hide line numbers from editor preferencesvoidvoidSomething of note has happened in the IOperationHistory.booleanvoidmenuAboutToShow(IMenuManager menu) Notifies this listener that the menu is about to be shown by the given menu manager.voidbooleanremoveTextAction(IAction textEditorPropertyAction) voidvoidNotifies that the selection has changed.voidsetBackgroundColor(Color color) voidsetBounds(int x, int y, int width, int height) specific implementation to support a vertical rulervoidsetEnabled(boolean enabled) voidvoidsetForegroundColor(Color color) voidsetLineBackground(Position position, Color c) voidvoidsetSelection(Position position) voidtextChanged(TextEvent event) The visual representation of a text viewer this listener is registered with has been changed.voidupdate all actions independent of their typevoidvscroll(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:ISelectionChangedListenerNotifies that the selection has changed.- Specified by:
selectionChangedin interfaceISelectionChangedListener- Parameters:
event- event object describing the change
-
textChanged
Description copied from interface:ITextListenerThe visual representation of a text viewer this listener is registered with has been changed.- Specified by:
textChangedin 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:IOperationHistoryListenerSomething of note has happened in the IOperationHistory. Listeners should check the supplied event for details.- Specified by:
historyNotificationin interfaceIOperationHistoryListener- Parameters:
event- the OperationHistoryEvent that describes the particular notification.
-
getSourceViewer
- Returns:
- the wrapped viewer
-
getAdapter
Description copied from interface:IAdaptableReturns an object which is an instance of the given class associated with this object. Returnsnullif 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:
getAdapterin interfaceIAdaptable- Type Parameters:
T- the class type- Parameters:
adapter- the adapter class to look up- Returns:
- a object of the given class, or
nullif this object does not have an adapter for the given class
-