Class EmbeddingHelper


  • public abstract class EmbeddingHelper
    extends java.lang.Object
    Helps embedding the xText-editor of a certain grammar.
    Author:
    Holger Eichelberger, Christian Kröher
    • Constructor Summary

      Constructors 
      Constructor Description
      EmbeddingHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static IEmbeddedEditor embedEditor​(java.net.URI file, org.eclipse.swt.widgets.Composite parent, com.google.inject.Injector injector)
      Embeds an xText editor for the given resource into the given parent.
      static IEmbeddedEditor embedEditor​(java.net.URI file, org.eclipse.swt.widgets.Composite parent, com.google.inject.Injector injector, java.lang.String[] content, boolean requireWorkspaceResource)
      Embeds an xText editor for the given resource into the given parent.
      private static IEmbeddedEditor embedEditor​(org.eclipse.swt.widgets.Composite parent, com.google.inject.Injector injector, org.eclipse.xtext.ui.editor.embedded.IEditedResourceProvider resourceProvider, java.lang.String[] content, boolean requireWorkspaceResource)
      Embeds an xText editor for the given resource into the given parent.
      private static java.lang.String getResourceContent​(java.net.URI file)
      Returns the content of the file identified by the given URI.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EmbeddingHelper

        public EmbeddingHelper()
    • Method Detail

      • getResourceContent

        private static java.lang.String getResourceContent​(java.net.URI file)
        Returns the content of the file identified by the given URI.
        Parameters:
        file - the URI that identifies the file
        Returns:
        the content of the file as String or null if the file does not exist
      • embedEditor

        public static IEmbeddedEditor embedEditor​(java.net.URI file,
                                                  org.eclipse.swt.widgets.Composite parent,
                                                  com.google.inject.Injector injector)
        Embeds an xText editor for the given resource into the given parent.
        Parameters:
        file - the file representing the resource
        parent - the parent UI component
        injector - the injector configured for the editor and the grammar of file
        Returns:
        the embedded editor (or null if embedding failed)
      • embedEditor

        public static IEmbeddedEditor embedEditor​(java.net.URI file,
                                                  org.eclipse.swt.widgets.Composite parent,
                                                  com.google.inject.Injector injector,
                                                  java.lang.String[] content,
                                                  boolean requireWorkspaceResource)
        Embeds an xText editor for the given resource into the given parent.
        Parameters:
        file - the file representing the resource
        parent - the parent UI component
        injector - the injector configured for the editor and the grammar of file
        content - a split of file consisting of the actual editable content in terms of prefix not to be shown [0], content to be displayed [1] and postfix not to be shown[2]
        requireWorkspaceResource - whether the editor requires a workspace resource and shall complain at least in the logs or whether it shall be silent
        Returns:
        the embedded editor (or null if embedding failed)
      • embedEditor

        private static IEmbeddedEditor embedEditor​(org.eclipse.swt.widgets.Composite parent,
                                                   com.google.inject.Injector injector,
                                                   org.eclipse.xtext.ui.editor.embedded.IEditedResourceProvider resourceProvider,
                                                   java.lang.String[] content,
                                                   boolean requireWorkspaceResource)
        Embeds an xText editor for the given resource into the given parent.
        Parameters:
        parent - the parent UI component
        injector - the injector configured for the editor and the grammar of file
        resourceProvider - the resource to be displayed
        content - the actual editable content in terms of prefix not to be shown [0], content to be displayed [1] and postfix not to be shown[2]
        requireWorkspaceResource - whether the editor requires a workspace resource and shall complain at least in the logs or whether it shall be silent
        Returns:
        the embedded editor (or null if embedding failed)