Class SWTEmbeddedAWTContext

  • All Implemented Interfaces:
    GUIContext, AWTContext

    public class SWTEmbeddedAWTContext
    extends Object
    implements AWTContext
    Author:
    Markus Lauer This class makes it possible to integrate an application component with an AWT-GUI into a SWT environment. It uses the AWT-SWT-bridge provided by the eclipse foundation.
    • Field Detail

      • swtContext

        protected SWTContext swtContext
        The SWT context the AWT GUI could be integrated into
      • parentComposite

        protected org.eclipse.swt.widgets.Composite parentComposite
        The SWT element that includes the AWT Frame the AWT component can insert its gui elements.
      • parentFrame

        protected Frame parentFrame
        The AWT Frame the AWT component can insert its GUI elements.
      • controlThread

        protected Thread controlThread
        The thread which executes the application using this context.
    • Constructor Detail

      • SWTEmbeddedAWTContext

        public SWTEmbeddedAWTContext​(Thread controlThread,
                                     SWTContext swtContext)
        Constructs an graphical context for an AWT based application component up on an existing swt graphical context.
        Parameters:
        controlThread - The thread which executes the application using this context.
        swtContext - The existing SWT context.
        See Also:
        SWTContext
    • Method Detail

      • getParentFrame

        public Frame getParentFrame()
        Description copied from interface: AWTContext
        Gets the parent frame of this context to use for the GUI of the application.
        An InvalidExecutorThreadException will be thrown if the method is not called by the main thread of the corresponding component.
        Specified by:
        getParentFrame in interface AWTContext
        Returns:
        Returns the parent composite which should be used by the Component to draw its GUI.
      • close

        public void close()
        Description copied from interface: GUIContext
        Closes the GUI for this context. This method has to be called by the runtime manager whenever an application has terminated (finished, failed, aborted, killed,...).
        It must be possible to call this method more than once, even if the GUIContext has already shut down. This especially applies to the disposal of SWT-widgets, that is, it is allowed to call this method after the disposal of the corresponding widgets.
        Specified by:
        close in interface GUIContext