Class StringBasedTypedElement

  • All Implemented Interfaces:
    org.eclipse.compare.IEditableContent, org.eclipse.compare.IEncodedStreamContentAccessor, org.eclipse.compare.IStreamContentAccessor, org.eclipse.compare.ITypedElement

    public class StringBasedTypedElement
    extends AbstractCompareTypedElement
    implements org.eclipse.compare.IEditableContent
    The AbstractCompareTypedElement extension storing content as String.
    • Constructor Detail

      • StringBasedTypedElement

        public StringBasedTypedElement​(String name,
                                       String content,
                                       boolean isEditable)
        Constructor.
        Parameters:
        name - the typed element name, may be null
        content - the typed element content, may be null
        isEditable - true if this typed element can be modified and false otherwise
    • Method Detail

      • getContents

        public 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 boolean isEditable()
        Specified by:
        isEditable in interface org.eclipse.compare.IEditableContent
      • setContent

        public void setContent​(byte[] newContent)
        Specified by:
        setContent 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
      • convertToByteContent

        public byte[] convertToByteContent​(String content)
        Converts the string content to byte representation.
        Parameters:
        content - the string content, may be null