private Control createDefaultPage ( FormToolkit kit ) { Form form = kit . createForm ( book ) ; Composite body = form . getBody ( ) ; GridLayout layout = new GridLayout ( 2 , false ) ; body . setLayout ( layout ) ; Link hlink = new Link ( body , SWT . NONE ) ; hlink . setText ( "<a>Use the Servers View to create a new server...</a>" ) ; hlink . setBackground ( book . getDisplay ( ) . getSystemColor ( SWT . COLOR_LIST_BACKGROUND ) ) ; GridData gd = new GridData ( SWT . LEFT , SWT . FILL , true , false ) ; hlink . setLayoutData ( gd ) ; hlink . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent e ) { // show Servers View ViewUtils . showServersView ( ) ; } } ) ; // Create the context menu for the default page final CommonViewer commonViewer = this . getCommonViewer ( ) ; if ( commonViewer != null ) { ICommonViewerSite commonViewerSite = CommonViewerSiteFactory . createCommonViewerSite ( this . getViewSite ( ) ) ; if ( commonViewerSite != null ) { // Note: actionService cannot be null final NavigatorActionService actionService = new NavigatorActionService ( commonViewerSite , commonViewer , commonViewer . getNavigatorContentService ( ) ) ; MenuManager menuManager = new MenuManager ( "#PopupMenu" ) ; menuManager . addMenuListener ( new IMenuListener ( ) { public void menuAboutToShow ( IMenuManager mgr ) { ISelection selection = commonViewer . getSelection ( ) ; actionService . setContext ( new ActionContext ( selection ) ) ; actionService . fillContextMenu ( mgr ) ; } } ) ; Menu menu = menuManager . createContextMenu ( body ) ; // It is necessary to set the menu in two places: // 1. The white space in the server view // 2. The text and link in the server view. If this menu is not // set, if the // user right clicks on the text or uses shortcut keys to open // the context menu, // the context menu will not come up body . setMenu ( menu ) ; hlink . setMenu ( menu ) ; } else { // if (Trace.FINEST) { // Trace.trace(Trace.STRING_FINEST, // "The commonViewerSite is null"); // } } } else { // if (Trace.FINEST) { // Trace.trace(Trace.STRING_FINEST, "The commonViewer is null"); // } } return form ; }
Creates a page displayed when there are no servers defined .