Class TextStreamContent

  • All Implemented Interfaces:
    StreamContent, org.eclipse.compare.IEditableContent, org.eclipse.compare.IEditableContentExtension, org.eclipse.compare.IStreamContentAccessor, org.eclipse.compare.ITypedElement, org.eclipse.compare.structuremergeviewer.IStructureComparator, org.eclipse.core.runtime.IAdaptable

    public class TextStreamContent
    extends java.lang.Object
    implements StreamContent, org.eclipse.compare.IStreamContentAccessor, org.eclipse.compare.IEditableContent, org.eclipse.compare.IEditableContentExtension
    • Field Detail

      • ANY_EDIT_COMPARE

        private static final java.lang.String ANY_EDIT_COMPARE
        See Also:
        Constant Field Values
      • selectedText

        private final java.lang.String selectedText
      • position

        private final org.eclipse.jface.text.Position position
      • bytes

        private byte[] bytes
      • dirty

        private boolean dirty
      • partListener

        private final org.eclipse.ui.IPartListener2 partListener
      • positionUpdater

        private org.eclipse.jface.text.DefaultPositionUpdater positionUpdater
      • docListener

        private org.eclipse.jface.text.IDocumentListener docListener
      • lineAnnotation

        private org.eclipse.jface.text.source.Annotation lineAnnotation
      • disposed

        private boolean disposed
    • Constructor Detail

      • TextStreamContent

        public TextStreamContent​(ContentWrapper content,
                                 AbstractEditor editor)
        Parameters:
        content - NOT null
        editor - might be null
      • TextStreamContent

        private TextStreamContent​(ContentWrapper content,
                                  AbstractEditor editor,
                                  java.lang.String selectedText,
                                  org.eclipse.jface.text.Position position)
    • Method Detail

      • updateCompareEditor

        void updateCompareEditor​(org.eclipse.jface.text.DocumentEvent event)
      • createPosition

        private static org.eclipse.jface.text.Position createPosition​(org.eclipse.jface.text.ITextSelection selection)
      • hookOnSelection

        private void hookOnSelection()
      • getChangedCompareText

        private java.lang.String getChangedCompareText()
      • getImage

        public org.eclipse.swt.graphics.Image getImage()
        Specified by:
        getImage in interface org.eclipse.compare.ITypedElement
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface org.eclipse.compare.ITypedElement
      • getType

        public java.lang.String getType()
        Specified by:
        getType in interface org.eclipse.compare.ITypedElement
      • getChildren

        public java.lang.Object[] getChildren()
        Specified by:
        getChildren in interface org.eclipse.compare.structuremergeviewer.IStructureComparator
      • commitChanges

        public boolean commitChanges​(org.eclipse.core.runtime.IProgressMonitor pm)
                              throws org.eclipse.core.runtime.CoreException
        Specified by:
        commitChanges in interface StreamContent
        Throws:
        org.eclipse.core.runtime.CoreException
      • getContents

        public java.io.InputStream getContents()
                                        throws org.eclipse.core.runtime.CoreException
        Specified by:
        getContents in interface org.eclipse.compare.IStreamContentAccessor
        Throws:
        org.eclipse.core.runtime.CoreException
      • isEditable

        public final boolean isEditable()
        Specified by:
        isEditable in interface org.eclipse.compare.IEditableContent
      • replace

        public org.eclipse.compare.ITypedElement replace​(org.eclipse.compare.ITypedElement dest,
                                                         org.eclipse.compare.ITypedElement src)
        Specified by:
        replace in interface org.eclipse.compare.IEditableContent
      • setContent

        public void setContent​(byte[] newContent)
        Specified by:
        setContent in interface org.eclipse.compare.IEditableContent
      • addSelectionAnnotation

        private void addSelectionAnnotation()
      • removeSelectionAnnotation

        private void removeSelectionAnnotation()
      • getText

        private java.lang.String getText​(org.eclipse.jface.text.Position pos)
      • isReadOnly

        public boolean isReadOnly()
        Specified by:
        isReadOnly in interface org.eclipse.compare.IEditableContentExtension
      • validateEdit

        public org.eclipse.core.runtime.IStatus validateEdit​(org.eclipse.swt.widgets.Shell shell)
        Specified by:
        validateEdit in interface org.eclipse.compare.IEditableContentExtension
      • getAdapter

        public java.lang.Object getAdapter​(java.lang.Class adapter)
        Specified by:
        getAdapter in interface org.eclipse.core.runtime.IAdaptable
      • getSharedDocumentAdapter

        private org.eclipse.compare.ISharedDocumentAdapter getSharedDocumentAdapter()
        The code below is copy from org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement and is required to add full Java editor capabilities (content assist, navigation etc) to the compare editor
        Returns: