Class TextFallbackMergeViewer
- java.lang.Object
-
- org.eclipse.jface.viewers.Viewer
-
- org.eclipse.jface.viewers.ContentViewer
-
- org.eclipse.compare.contentmergeviewer.ContentMergeViewer
-
- org.eclipse.compare.contentmergeviewer.TextMergeViewer
-
- org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.fallback.TextFallbackMergeViewer
-
- All Implemented Interfaces:
org.eclipse.compare.contentmergeviewer.IFlushable
,org.eclipse.compare.internal.IFlushable2
,org.eclipse.compare.IPropertyChangeNotifier
,org.eclipse.core.runtime.IAdaptable
,org.eclipse.jface.viewers.IInputProvider
,org.eclipse.jface.viewers.IInputSelectionProvider
,org.eclipse.jface.viewers.ISelectionProvider
public class TextFallbackMergeViewer extends org.eclipse.compare.contentmergeviewer.TextMergeViewer
A highly specialized implementation of a text merge viewer.
-
-
Constructor Summary
Constructors Constructor Description TextFallbackMergeViewer(org.eclipse.swt.widgets.Composite parent, EMFCompareConfiguration configuration)
Creates an instance under the given parent using the given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
protected org.eclipse.jface.text.source.SourceViewer
createSourceViewer(org.eclipse.swt.widgets.Composite parent, int textOrientation)
protected void
createToolItems(org.eclipse.jface.action.ToolBarManager tbm)
protected EMFCompareConfiguration
getCompareConfiguration()
Object
getEffectiveInput()
Object
getInput()
Object
getOriginalInput()
String
getTitle()
protected void
handleDispose(org.eclipse.swt.events.DisposeEvent event)
void
handleEditingDomainChange(ICompareEditingDomainChange event)
Listens to editing domain changes on theevent bus
.protected void
handlePropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent event)
protected boolean
isLeftDirty()
protected boolean
isRightDirty()
void
removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
void
setContentProvider(org.eclipse.jface.viewers.IContentProvider contentProvider)
void
setInput(Object input)
protected void
setLeftDirty(boolean dirty)
protected void
setRightDirty(boolean dirty)
protected void
updateToolItems()
-
Methods inherited from class org.eclipse.compare.contentmergeviewer.TextMergeViewer
configureTextViewer, copy, createCenterControl, createControls, createTokenComparator, doSave, findInsertionPosition, flushContent, getAdapter, getCenterWidth, getContents, getDocumentPartitioner, getDocumentPartitioning, getEditorInput, handleCompareInputChange, handleResizeAncestor, handleResizeLeftRight, handleSetFocus, invalidateTextPresentation, isEditorBacked, setActionsActivated, setBackgroundColor, setEditable, setForegroundColor, setupDocument, updateContent, updateHeader
-
Methods inherited from class org.eclipse.compare.contentmergeviewer.ContentMergeViewer
buildControl, flush, flushLeft, flushRight, getCenterControl, getControl, getResourceBundle, getSelection, getToolBarManager, hookControl, inputChanged, internalIsLeftDirty, internalIsRightDirty, isAncestorVisible, isLeftEditable, isRightEditable, isThreeWay, refresh, save, setConfirmSave, setSelection
-
Methods inherited from class org.eclipse.jface.viewers.ContentViewer
getContentProvider, getLabelProvider, handleLabelProviderChanged, labelProviderChanged, setLabelProvider
-
-
-
-
Constructor Detail
-
TextFallbackMergeViewer
public TextFallbackMergeViewer(org.eclipse.swt.widgets.Composite parent, EMFCompareConfiguration configuration)
Creates an instance under the given parent using the given configuration.- Parameters:
parent
- the parent composite under which to create this viewer.configuration
- the EMF compare configuration used by this viewer.
-
-
Method Detail
-
handleEditingDomainChange
public void handleEditingDomainChange(ICompareEditingDomainChange event)
Listens to editing domain changes on theevent bus
.- Parameters:
event
- the editing domain change event.
-
addPropertyChangeListener
public void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
This implementation subverts calls to
super
so that nothing can actually listen to underlying state changes to the dirty state of this viewer's source viewers. It manages its ownlisteners
andinforms listeners of the dirty state
based on changes tocommand stack state
.- Specified by:
addPropertyChangeListener
in interfaceorg.eclipse.compare.IPropertyChangeNotifier
- Overrides:
addPropertyChangeListener
in classorg.eclipse.compare.contentmergeviewer.ContentMergeViewer
- See Also:
ContentMergeViewer.removePropertyChangeListener(IPropertyChangeListener)
-
removePropertyChangeListener
public void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
This implementation subverts calls to
super
so that nothing can actually listen to underlying state changes to the dirty state of this viewer's source viewers. It manages its ownlisteners
.- Specified by:
removePropertyChangeListener
in interfaceorg.eclipse.compare.IPropertyChangeNotifier
- Overrides:
removePropertyChangeListener
in classorg.eclipse.compare.contentmergeviewer.ContentMergeViewer
- See Also:
ContentMergeViewer.removePropertyChangeListener(IPropertyChangeListener)
-
isLeftDirty
protected boolean isLeftDirty()
This implementation returns the
state
of thecommand stack
when the command stack isupdating the dirty state
.- Overrides:
isLeftDirty
in classorg.eclipse.compare.contentmergeviewer.ContentMergeViewer
- See Also:
ContentMergeViewer.isLeftDirty()
-
setLeftDirty
protected void setLeftDirty(boolean dirty)
This implementation
updates the header
because the labelincludes a dirty state indication
.- Overrides:
setLeftDirty
in classorg.eclipse.compare.contentmergeviewer.ContentMergeViewer
- See Also:
ContentMergeViewer.setLeftDirty(boolean)
-
isRightDirty
protected boolean isRightDirty()
This implementation returns the
state
of thecommand stack
when the command stack isupdating the dirty state
.- Overrides:
isRightDirty
in classorg.eclipse.compare.contentmergeviewer.ContentMergeViewer
- See Also:
ContentMergeViewer.isRightDirty()
-
setRightDirty
protected void setRightDirty(boolean dirty)
This implementation
updates the header
because the labelincludes a dirty state indication
.- Overrides:
setRightDirty
in classorg.eclipse.compare.contentmergeviewer.ContentMergeViewer
- See Also:
ContentMergeViewer.setRightDirty(boolean)
-
createToolItems
protected void createToolItems(org.eclipse.jface.action.ToolBarManager tbm)
This implementation also creates a
preview action
that's useful for showing the saved contents of resource in their current state of modification.- Overrides:
createToolItems
in classorg.eclipse.compare.contentmergeviewer.TextMergeViewer
- See Also:
TextMergeViewer.createToolItems(ToolBarManager)
-
updateToolItems
protected void updateToolItems()
This implementation also updates the
preview action
.- Overrides:
updateToolItems
in classorg.eclipse.compare.contentmergeviewer.TextMergeViewer
- See Also:
TextMergeViewer.updateToolItems()
-
getCompareConfiguration
protected EMFCompareConfiguration getCompareConfiguration()
This implementation assumes the configuration must be an
EMFCompareConfiguration
, returning it as such.- Overrides:
getCompareConfiguration
in classorg.eclipse.compare.contentmergeviewer.ContentMergeViewer
- See Also:
ContentMergeViewer.getCompareConfiguration()
-
setContentProvider
public void setContentProvider(org.eclipse.jface.viewers.IContentProvider contentProvider)
This specialized implementation
ignores
content provider changes except when explicitly set in theconstructor
and when this implementation ishandling mirror changes
.- Overrides:
setContentProvider
in classorg.eclipse.compare.contentmergeviewer.ContentMergeViewer
- See Also:
ContentMergeViewer.setContentProvider(IContentProvider)
-
setInput
public void setInput(Object input)
- Overrides:
setInput
in classorg.eclipse.jface.viewers.ContentViewer
- See Also:
ContentViewer.setInput(Object)
-
createSourceViewer
protected org.eclipse.jface.text.source.SourceViewer createSourceViewer(org.eclipse.swt.widgets.Composite parent, int textOrientation)
This implementation simply delegates to
super
but it is used to record theancesorViewer
,leftViewer
, andrightViewer
which are needed insetInput(Object)
toselect
objects.- Overrides:
createSourceViewer
in classorg.eclipse.compare.contentmergeviewer.TextMergeViewer
- See Also:
TextMergeViewer.createSourceViewer(Composite, int)
-
getInput
public Object getInput()
This class' specialized
setInput
method transforms the real input, so it's important that we return theoriginalInput
when that isn'tnull
.- Specified by:
getInput
in interfaceorg.eclipse.jface.viewers.IInputProvider
- Overrides:
getInput
in classorg.eclipse.jface.viewers.ContentViewer
- See Also:
setInput(Object)
,ContentViewer.getInput()
-
handleDispose
protected void handleDispose(org.eclipse.swt.events.DisposeEvent event)
- Overrides:
handleDispose
in classorg.eclipse.compare.contentmergeviewer.TextMergeViewer
- See Also:
TextMergeViewer.handleDispose(org.eclipse.swt.events.DisposeEvent)
-
handlePropertyChangeEvent
protected void handlePropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent event)
This implementation uses the
mirror manager
to subvertsuper's
handling of mirror state changes so that it can handle the state change in a better way than does the base class.- Overrides:
handlePropertyChangeEvent
in classorg.eclipse.compare.contentmergeviewer.TextMergeViewer
- See Also:
TextMergeViewer.handlePropertyChangeEvent(PropertyChangeEvent)
-
getTitle
public String getTitle()
- Overrides:
getTitle
in classorg.eclipse.compare.contentmergeviewer.ContentMergeViewer
- See Also:
ContentMergeViewer.getTitle()
-
getOriginalInput
public Object getOriginalInput()
-
getEffectiveInput
public Object getEffectiveInput()
-
-