int top = Window.getScrollTop() + DOM.eventGetClientY( event );
popupMenu.setPopupPosition( adjustLeftIfNecessary( left ), top );
MenuBar menuBar = new MenuBar( true );
menuBar.setAutoOpen( true );
if ( getContent() instanceof IFrameTabPanel ) {
MenuItem backMenuItem =
new MenuItem( Messages.getString( "back" ), new TabCommand( TABCOMMANDTYPE.BACK, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( backMenuItem );
backMenuItem.getElement().setId( "back" ); //$NON-NLS-1$
menuBar.addSeparator();
MenuItem reloadTabMenuItem =
new MenuItem( Messages.getString( "reloadTab" ), new TabCommand( TABCOMMANDTYPE.RELOAD, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( reloadTabMenuItem );
reloadTabMenuItem.getElement().setId( "reloadTab" ); //$NON-NLS-1$
}
if ( getTabPanel().getTabCount() > 1 ) {
MenuItem reloadAllTabsMenuItem =
new MenuItem( Messages.getString( "reloadAllTabs" ), new TabCommand( TABCOMMANDTYPE.RELOAD_ALL, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( reloadAllTabsMenuItem );
reloadAllTabsMenuItem.getElement().setId( "reloadAllTabs" ); //$NON-NLS-1$
} else {
MenuItem reloadAllTabsMenuItem = new MenuItem( Messages.getString( "reloadAllTabs" ), (Command) null ); //$NON-NLS-1$
menuBar.addItem( reloadAllTabsMenuItem );
reloadAllTabsMenuItem.getElement().setId( "reloadAllTabs" ); //$NON-NLS-1$
reloadAllTabsMenuItem.setStyleName( "disabledMenuItem" ); //$NON-NLS-1$
}
menuBar.addSeparator();
if ( getContent() instanceof IFrameTabPanel ) {
MenuItem openTabInNewWindowMenuItem =
new MenuItem(
Messages.getString( "openTabInNewWindow" ), new TabCommand( TABCOMMANDTYPE.NEW_WINDOW, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( openTabInNewWindowMenuItem );
openTabInNewWindowMenuItem.getElement().setId( "openTabInNewWindow" ); //$NON-NLS-1$
MenuItem createDeepLinkMenuItem =
new MenuItem(
Messages.getString( "createDeepLink" ), new TabCommand( TABCOMMANDTYPE.CREATE_DEEP_LINK, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( createDeepLinkMenuItem );
createDeepLinkMenuItem.getElement().setId( "deepLink" ); //$NON-NLS-1$
menuBar.addSeparator();
}
menuBar
.addItem( new MenuItem( Messages.getString( "closeTab" ), new TabCommand( TABCOMMANDTYPE.CLOSE, popupMenu ) ) ); //$NON-NLS-1$
if ( getTabPanel().getTabCount() > 1 ) {
MenuItem closeOtherTabsMenuItem =
new MenuItem( Messages.getString( "closeOtherTabs" ), new TabCommand( TABCOMMANDTYPE.CLOSE_OTHERS, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( closeOtherTabsMenuItem );
closeOtherTabsMenuItem.getElement().setId( "closeOtherTabs" ); //$NON-NLS-1$
MenuItem closeAllTabsMenuItem =
new MenuItem( Messages.getString( "closeAllTabs" ), new TabCommand( TABCOMMANDTYPE.CLOSE_ALL, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( closeAllTabsMenuItem );
closeAllTabsMenuItem.getElement().setId( "closeAllTabs" ); //$NON-NLS-1$
} else {
MenuItem closeOtherTabsMenuItem = new MenuItem( Messages.getString( "closeOtherTabs" ), (Command) null ); //$NON-NLS-1$
closeOtherTabsMenuItem.setStyleName( "disabledMenuItem" ); //$NON-NLS-1$
MenuItem closeAllTabsMenuItem = new MenuItem( Messages.getString( "closeAllTabs" ), (Command) null ); //$NON-NLS-1$
closeAllTabsMenuItem.setStyleName( "disabledMenuItem" ); //$NON-NLS-1$
menuBar.addItem( closeOtherTabsMenuItem );
menuBar.addItem( closeAllTabsMenuItem );
closeOtherTabsMenuItem.getElement().setId( "closeOtherTabs" ); //$NON-NLS-1$
closeAllTabsMenuItem.getElement().setId( "closeAllTabs" ); //$NON-NLS-1$
}
popupMenu.setWidget( menuBar );
popupMenu.hide();
popupMenu.show();
}