Class CustomEmbeddedEditorBuilder


  • public class CustomEmbeddedEditorBuilder
    extends org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder
    Custom implementation EmbeddedEditorFactory.Builder. Have folding support and underlying working copy support.
    • Field Summary

      • Fields inherited from class org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder

        actionFactory, annotationTypes, characterPairMatcher, documentPartitionerProvider, documentProvider, editorBuild, highlightingHelper, issueProcessor, issueResolutionProvider, lineNumbers, lineNumbersBackgroundColor, lineNumbersForegroundColor, preferenceStoreAccess, readonly, resourceProvider, resourceValidator, sourceViewerConfigurationProvider, sourceViewerFactory, style, VERTICAL_RULER_WIDTH, xtextDocumentUtil
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void afterCreatePartialEditor​(org.eclipse.xtext.ui.editor.XtextSourceViewer viewer, org.eclipse.xtext.ui.editor.model.XtextDocument document, org.eclipse.jface.text.source.CompositeRuler verticalRuler, org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorActions actions)  
      protected org.eclipse.jface.text.source.CompositeRuler createAnnotationRuler()
      Create annotation ruler.
      protected org.eclipse.xtext.ui.editor.model.XtextDocument createDocument()
      Create Xtext document.
      protected org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor createEmbeddedEditor​(org.eclipse.jface.text.source.CompositeRuler annotationRuler, org.eclipse.xtext.ui.editor.XtextSourceViewer viewer, org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration viewerConfiguration, org.eclipse.xtext.ui.editor.model.XtextDocument document, org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorActions actions)
      Create Xtext embedded editor.
      protected org.eclipse.xtext.ui.editor.XtextSourceViewer createSourceViewer​(org.eclipse.swt.widgets.Composite parent, org.eclipse.jface.text.source.IVerticalRuler ruler, org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration viewerConfiguration)
      Create and configure Xtext source viewer.
      protected org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration createSourceViewerConfiguration()
      Create Xtext source viewer configuration.
      protected org.eclipse.handly.model.impl.support.SourceFile createWorkingCopy​(org.eclipse.xtext.ui.editor.model.XtextDocument document, org.eclipse.core.resources.IFile underlyingFile)
      Create working copy for given editor and non-existing input.
      CustomEmbeddedEditorBuilder enableFolding()
      Enable folding for embedded editor.
      protected org.eclipse.jface.text.source.IAnnotationAccess getAnnotationAccess()
      Get default annotation access.
      protected void installFoldingSupport​(org.eclipse.xtext.ui.editor.XtextSourceViewer viewer, org.eclipse.xtext.ui.editor.model.XtextDocument document)
      Install folding support for given embedded editor.
      protected org.eclipse.jface.text.source.projection.ProjectionSupport installProjectionSupport​(org.eclipse.xtext.ui.editor.XtextSourceViewer viewer)
      Install projection support to given xtext source viewer.
      protected org.eclipse.ui.texteditor.SourceViewerDecorationSupport installSourceViewerDecorationSupport​(org.eclipse.swt.widgets.Composite parent, org.eclipse.xtext.ui.editor.XtextSourceViewer viewer)
      Install source viewer decoration support for given embedded editor.
      protected void installValidationSupport​(org.eclipse.xtext.ui.editor.model.XtextDocument document, org.eclipse.xtext.ui.editor.XtextSourceViewer viewer)
      Install validation support for given embedded editor.
      protected org.eclipse.handly.model.impl.support.SourceFile installWorkingCopySupport​(org.eclipse.xtext.ui.editor.XtextSourceViewer viewer, org.eclipse.xtext.ui.editor.model.XtextDocument document)
      Install working copy and discard it by editor disposing.
      CustomEmbeddedEditorBuilder setUderlyingFile​(org.eclipse.core.resources.IFile underlyingFile)
      Set underlying file for constructing embedded editor.
      org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor withParent​(org.eclipse.swt.widgets.Composite parent)  
      • Methods inherited from class org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder

        getSharedColors, initializeActions, installUndoRedoSupport, processIssuesBy, readOnly, setResourceProvider, showAnnotations, showErrorAndWarningAnnotations, showLineNumbers, showLineNumbers, uninstallUndoRedoSupport, updateUndoAction, withResourceValidator, withStyle
    • Constructor Detail

      • CustomEmbeddedEditorBuilder

        public CustomEmbeddedEditorBuilder()
    • Method Detail

      • setUderlyingFile

        public CustomEmbeddedEditorBuilder setUderlyingFile​(org.eclipse.core.resources.IFile underlyingFile)
        Set underlying file for constructing embedded editor. Used to create handle model.
        Parameters:
        underlyingFile - underlying file (not null)
        Returns:
        builder (never null)
        See Also:
        IHandle, ISourceFile
      • withParent

        public org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor withParent​(org.eclipse.swt.widgets.Composite parent)
        Overrides:
        withParent in class org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder
      • afterCreatePartialEditor

        protected void afterCreatePartialEditor​(org.eclipse.xtext.ui.editor.XtextSourceViewer viewer,
                                                org.eclipse.xtext.ui.editor.model.XtextDocument document,
                                                org.eclipse.jface.text.source.CompositeRuler verticalRuler,
                                                org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorActions actions)
        Overrides:
        afterCreatePartialEditor in class org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorFactory.Builder
      • installSourceViewerDecorationSupport

        protected org.eclipse.ui.texteditor.SourceViewerDecorationSupport installSourceViewerDecorationSupport​(org.eclipse.swt.widgets.Composite parent,
                                                                                                               org.eclipse.xtext.ui.editor.XtextSourceViewer viewer)
        Install source viewer decoration support for given embedded editor.
        Parameters:
        parent - parent composite (not null)
        viewer - Xtext source viewer (not null)
        Returns:
        source viewer decoration support (never null)
      • installValidationSupport

        protected void installValidationSupport​(org.eclipse.xtext.ui.editor.model.XtextDocument document,
                                                org.eclipse.xtext.ui.editor.XtextSourceViewer viewer)
        Install validation support for given embedded editor.
        Parameters:
        document - Xtext document (not null)
        viewer - Xtext source viewer (not null)
      • installFoldingSupport

        protected void installFoldingSupport​(org.eclipse.xtext.ui.editor.XtextSourceViewer viewer,
                                             org.eclipse.xtext.ui.editor.model.XtextDocument document)
        Install folding support for given embedded editor.
        Parameters:
        viewer - target xtext source viewer (not null)
        document - target xtext document (not null)
      • installProjectionSupport

        protected org.eclipse.jface.text.source.projection.ProjectionSupport installProjectionSupport​(org.eclipse.xtext.ui.editor.XtextSourceViewer viewer)
        Install projection support to given xtext source viewer.
        Parameters:
        viewer - target xtext source viewer (not null)
        Returns:
        projection support (never null)
      • installWorkingCopySupport

        protected org.eclipse.handly.model.impl.support.SourceFile installWorkingCopySupport​(org.eclipse.xtext.ui.editor.XtextSourceViewer viewer,
                                                                                             org.eclipse.xtext.ui.editor.model.XtextDocument document)
        Install working copy and discard it by editor disposing.
        Parameters:
        viewer - target xtext source viewer (not null)
        document - target xtext document (not null)
        Returns:
        source file by IFile corresponding to editor or null if none
      • createSourceViewer

        protected org.eclipse.xtext.ui.editor.XtextSourceViewer createSourceViewer​(org.eclipse.swt.widgets.Composite parent,
                                                                                   org.eclipse.jface.text.source.IVerticalRuler ruler,
                                                                                   org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration viewerConfiguration)
        Create and configure Xtext source viewer.
        Parameters:
        parent - parent composite (not null)
        ruler - annotation ruler (not null)
        viewerConfiguration - viewer configuration (not null)
        Returns:
        created Xtext source viewer (never null)
      • createDocument

        protected org.eclipse.xtext.ui.editor.model.XtextDocument createDocument()
        Create Xtext document.
        Returns:
        created Xtext document (never null)
      • createSourceViewerConfiguration

        protected org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration createSourceViewerConfiguration()
        Create Xtext source viewer configuration.
        Returns:
        created source viewer configuration (never null)
      • createEmbeddedEditor

        protected org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor createEmbeddedEditor​(org.eclipse.jface.text.source.CompositeRuler annotationRuler,
                                                                                           org.eclipse.xtext.ui.editor.XtextSourceViewer viewer,
                                                                                           org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration viewerConfiguration,
                                                                                           org.eclipse.xtext.ui.editor.model.XtextDocument document,
                                                                                           org.eclipse.xtext.ui.editor.embedded.EmbeddedEditorActions actions)
        Create Xtext embedded editor.
        Parameters:
        annotationRuler - annotation ruler (not null)
        viewer - source viewer (not null)
        viewerConfiguration - source viewer configuration (not null)
        document - xtext document (not null)
        actions - embedded editor actions (not null)
        Returns:
        created embedded editor (not null)
      • createAnnotationRuler

        protected org.eclipse.jface.text.source.CompositeRuler createAnnotationRuler()
        Create annotation ruler.
        Returns:
        created composite ruler (can return null)
      • getAnnotationAccess

        protected org.eclipse.jface.text.source.IAnnotationAccess getAnnotationAccess()
        Get default annotation access.
        Returns:
        annotation access (never null)
      • createWorkingCopy

        protected org.eclipse.handly.model.impl.support.SourceFile createWorkingCopy​(org.eclipse.xtext.ui.editor.model.XtextDocument document,
                                                                                     org.eclipse.core.resources.IFile underlyingFile)
        Create working copy for given editor and non-existing input.
        Parameters:
        document - target xtext document (not null)
        file - underlying file (not null)
        Returns:
        sourceFile created source file by given IFile or null if none
        Throws:
        IllegalStateException - if cannot create source file