Class ShellFactory


  • public final class ShellFactory
    extends java.lang.Object
    Facilitates the creation of SWT Shells with platform-specific additions. All shells normal to the user should be created from ShellFactory
    Version:
    1.0
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ShellFactory.AEShell
      A shell that provides platform-specific behaviour in some methods in order to better suit the user experience
    • Constructor Summary

      Constructors 
      Constructor Description
      ShellFactory()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.eclipse.swt.widgets.Shell createMainShell​(int styles)  
      static org.eclipse.swt.widgets.Shell createShell​(int styles)
      Creates a shell
      static org.eclipse.swt.widgets.Shell createShell​(org.eclipse.swt.widgets.Display disp)
      Creates a shell
      static org.eclipse.swt.widgets.Shell createShell​(org.eclipse.swt.widgets.Display disp, int styles)
      Creates a shell
      static org.eclipse.swt.widgets.Shell createShell​(org.eclipse.swt.widgets.Shell parent)
      Creates a shell
      static org.eclipse.swt.widgets.Shell createShell​(org.eclipse.swt.widgets.Shell parent, int styles)
      Creates a shell
      private static org.eclipse.swt.widgets.Shell getRegisteredShell​(org.eclipse.swt.widgets.Shell toRegister)
      Gets the registered shell
      • Methods inherited from class java.lang.Object

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

      • ShellFactory

        public ShellFactory()
    • Method Detail

      • createMainShell

        public static org.eclipse.swt.widgets.Shell createMainShell​(int styles)
      • createShell

        public static org.eclipse.swt.widgets.Shell createShell​(org.eclipse.swt.widgets.Display disp,
                                                                int styles)

        Creates a shell

        For platforms that use a unified menu bar, the shell's menu bar is set to the main window's menu bar

        See Also:
        Shell
      • createShell

        public static org.eclipse.swt.widgets.Shell createShell​(org.eclipse.swt.widgets.Display disp)

        Creates a shell

        For platforms that use a unified menu bar, the shell's menu bar is set to the main window's menu bar

        See Also:
        Shell
      • createShell

        public static org.eclipse.swt.widgets.Shell createShell​(org.eclipse.swt.widgets.Shell parent,
                                                                int styles)

        Creates a shell

        For platforms that use a unified menu bar, the shell's menu bar is set to the main window's menu bar

        See Also:
        Shell
      • createShell

        public static org.eclipse.swt.widgets.Shell createShell​(org.eclipse.swt.widgets.Shell parent)

        Creates a shell

        For platforms that use a unified menu bar, the shell's menu bar is set to the main window's menu bar

        See Also:
        Shell
      • createShell

        public static org.eclipse.swt.widgets.Shell createShell​(int styles)

        Creates a shell

        For platforms that use a unified menu bar, the shell's menu bar is set to the main window's menu bar

        See Also:
        Shell
      • getRegisteredShell

        private static org.eclipse.swt.widgets.Shell getRegisteredShell​(org.eclipse.swt.widgets.Shell toRegister)

        Gets the registered shell

        Registration entails setting its menu bar if platform uses a unified menu bar.

        On OSX (carbon) the menus for an application is displayed at the top of the screen instead of on the main window of the application. This menu is shown whenever the application is activated or any of its pop up dialogs are activated. This behavior is very different than that for Windows and Linux applications because the menu is shown in the main application window for these OS's.

        To provide the same behavior as native OSX application we must ensure that whenever the application window or any of its pop up dialog is activate we show the same application menus on the OSX global menubar. In the SWT world this means that the same application menu must be created on each shell that we pop up.

        NOTE: This essentially means that each shell will have its own copy of the main menu so to the users it would seem like they are looking at the same menu instance. Moreover, this also means that any shell-related functions activated through the menu may have to distinguish which shell it is working with... the main application shell? or a pop up dialog shell?

        Also, the shell is added to the shared ShellManager

        Parameters:
        toRegister - A SWT Shell
        Returns:
        The SWT Shell