Class 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.
    • Field Summary

      • Fields inherited from class org.eclipse.jface.viewers.Viewer

        WIDGET_DATA_KEY
    • 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 the event 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
      • Methods inherited from class org.eclipse.jface.viewers.Viewer

        addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
    • 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 the event 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 own listeners and informs listeners of the dirty state based on changes to command stack state.

        Specified by:
        addPropertyChangeListener in interface org.eclipse.compare.IPropertyChangeNotifier
        Overrides:
        addPropertyChangeListener in class org.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 own listeners.

        Specified by:
        removePropertyChangeListener in interface org.eclipse.compare.IPropertyChangeNotifier
        Overrides:
        removePropertyChangeListener in class org.eclipse.compare.contentmergeviewer.ContentMergeViewer
        See Also:
        ContentMergeViewer.removePropertyChangeListener(IPropertyChangeListener)
      • isLeftDirty

        protected boolean isLeftDirty()

        This implementation returns the state of the command stack when the command stack is updating the dirty state.

        Overrides:
        isLeftDirty in class org.eclipse.compare.contentmergeviewer.ContentMergeViewer
        See Also:
        ContentMergeViewer.isLeftDirty()
      • setLeftDirty

        protected void setLeftDirty​(boolean dirty)

        This implementation updates the header because the label includes a dirty state indication.

        Overrides:
        setLeftDirty in class org.eclipse.compare.contentmergeviewer.ContentMergeViewer
        See Also:
        ContentMergeViewer.setLeftDirty(boolean)
      • isRightDirty

        protected boolean isRightDirty()

        This implementation returns the state of the command stack when the command stack is updating the dirty state.

        Overrides:
        isRightDirty in class org.eclipse.compare.contentmergeviewer.ContentMergeViewer
        See Also:
        ContentMergeViewer.isRightDirty()
      • setRightDirty

        protected void setRightDirty​(boolean dirty)

        This implementation updates the header because the label includes a dirty state indication.

        Overrides:
        setRightDirty in class org.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 class org.eclipse.compare.contentmergeviewer.TextMergeViewer
        See Also:
        TextMergeViewer.createToolItems(ToolBarManager)
      • updateToolItems

        protected void updateToolItems()

        This implementation also updates the preview action.

        Overrides:
        updateToolItems in class org.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 class org.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 the constructor and when this implementation is handling mirror changes.

        Overrides:
        setContentProvider in class org.eclipse.compare.contentmergeviewer.ContentMergeViewer
        See Also:
        ContentMergeViewer.setContentProvider(IContentProvider)
      • setInput

        public void setInput​(Object input)

        This implementation is specialized to adapt the input and to select the objects of the input.

        Overrides:
        setInput in class org.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 the ancesorViewer, leftViewer, and rightViewer which are needed in setInput(Object) to select objects.

        Overrides:
        createSourceViewer in class org.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 the originalInput when that isn't null.

        Specified by:
        getInput in interface org.eclipse.jface.viewers.IInputProvider
        Overrides:
        getInput in class org.eclipse.jface.viewers.ContentViewer
        See Also:
        setInput(Object), ContentViewer.getInput()
      • handleDispose

        protected void handleDispose​(org.eclipse.swt.events.DisposeEvent event)
        Overrides:
        handleDispose in class org.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 subvert super'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 class org.eclipse.compare.contentmergeviewer.TextMergeViewer
        See Also:
        TextMergeViewer.handlePropertyChangeEvent(PropertyChangeEvent)
      • getTitle

        public String getTitle()
        Overrides:
        getTitle in class org.eclipse.compare.contentmergeviewer.ContentMergeViewer
        See Also:
        ContentMergeViewer.getTitle()
      • getOriginalInput

        public Object getOriginalInput()
      • getEffectiveInput

        public Object getEffectiveInput()