Java Code Examples for org.eclipse.ui.IViewSite#registerContextMenu()

The following examples show how to use org.eclipse.ui.IViewSite#registerContextMenu() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InformationViewPart.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private void hookContextMenu ( final IViewSite viewSite )
{
    final MenuManager menuMgr = new MenuManager ( "#PopupMenu" ); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown ( true );
    menuMgr.addMenuListener ( new IMenuListener () {
        @Override
        public void menuAboutToShow ( final IMenuManager manager )
        {
            fillContextMenu ( manager );
        }
    } );
    final Menu menu = menuMgr.createContextMenu ( this.viewer.getControl () );
    this.viewer.getControl ().setMenu ( menu );
    viewSite.registerContextMenu ( menuMgr, this.viewer );
}
 
Example 2
Source File: ChartControllerView.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private void hookContextMenu ( final IViewSite viewSite )
{
    final MenuManager menuMgr = new MenuManager ( "#PopupMenu" ); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown ( true );
    menuMgr.addMenuListener ( new IMenuListener () {
        @Override
        public void menuAboutToShow ( final IMenuManager manager )
        {
            fillContextMenu ( manager );
        }
    } );
    final Menu menu = menuMgr.createContextMenu ( this.viewer.getControl () );
    this.viewer.getControl ().setMenu ( menu );
    viewSite.registerContextMenu ( menuMgr, this.viewer );
}
 
Example 3
Source File: MonitorsViewTable.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
protected void hookContextMenu ( final Control control, final ISelectionProvider selectionProvider, final IViewSite viewSite )
{
    final MenuManager menuMgr = new MenuManager ( "#PopupMenu" ); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown ( true );
    menuMgr.addMenuListener ( new IMenuListener () {
        @Override
        public void menuAboutToShow ( final IMenuManager manager )
        {
            fillContextMenu ( manager );
        }
    } );
    final Menu menu = menuMgr.createContextMenu ( control );
    control.setMenu ( menu );
    viewSite.registerContextMenu ( menuMgr, selectionProvider );
}
 
Example 4
Source File: EventViewTable.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
protected void hookContextMenu ( final Control control, final ISelectionProvider selectionProvider, final IViewSite viewSite )
{
    final MenuManager menuMgr = new MenuManager ( "#PopupMenu" ); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown ( true );
    menuMgr.addMenuListener ( new IMenuListener () {
        @Override
        public void menuAboutToShow ( final IMenuManager manager )
        {
            fillContextMenu ( manager );
        }
    } );
    final Menu menu = menuMgr.createContextMenu ( control );
    control.setMenu ( menu );
    viewSite.registerContextMenu ( menuMgr, selectionProvider );
}
 
Example 5
Source File: RealTimeListViewer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private void hookContextMenu ( final IViewSite viewSite )
{
    final MenuManager menuMgr = new MenuManager ( "#PopupMenu" ); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown ( true );
    menuMgr.addMenuListener ( new IMenuListener () {
        @Override
        public void menuAboutToShow ( final IMenuManager manager )
        {
            fillContextMenu ( manager );
        }
    } );
    final Menu menu = menuMgr.createContextMenu ( this.viewer.getControl () );
    this.viewer.getControl ().setMenu ( menu );
    viewSite.registerContextMenu ( menuMgr, this.viewer );
}