menu.add( refreshAction ); }  IAction addLibraryAction = new AddLibraryAction( ); menu.add( addLibraryAction );  } else if ( library != null ) { IAction addAction = new AddSelectedLibToCurrentReportDesignAction( treeViewer ); if ( addAction.isEnabled( ) ) { menu.add( addAction ); } IAction removeLibraryAction = new RemoveLibraryAction( treeViewer ); if ( removeLibraryAction.isEnabled( ) ) { menu.add( removeLibraryAction ); } menu.add( new Separator( ) ); IAction refreshAction = new RefreshLibExplorerAction( treeViewer ); if ( refreshAction.isEnabled( ) ) { menu.add( refreshAction );
if ( ( (File) selected ).isDirectory( ) ) { addLibraryAction.setFolder( (File) selected ); menu.add( addLibraryAction ); } else { addLibraryAction.setFolder( ( (File) selected ).getParentFile( ) ); menu.add( addLibraryAction ); if ( useLibraryAction.isEnabled( ) ) { menu.add( useLibraryAction ); } }
	public void buildContextMenu( IMenuManager menu )	{		TreeViewer treeViewer = (TreeViewer) getViewer( );		if ( Policy.TRACING_MENU_SHOW )		{			System.out.println( "Menu(for Views) >> Shows for library" ); //$NON-NLS-1$		}		menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );				ISelectionProvider struViewer = (ISelectionProvider) getViewer( );		IStructuredSelection selection = (IStructuredSelection) struViewer.getSelection( );		LibraryHandle library = getSelectedLibrary( );		if ( selection == null || selection.getFirstElement( ) == null )		{			IAction refreshAction = new RefreshLibExplorerAction( treeViewer );			if ( refreshAction.isEnabled( ) )			{				menu.add( refreshAction );			}			IAction addLibraryAction = new AddLibraryAction( );			menu.add( addLibraryAction );		} // else if something is selected, but not library		else if ( library != null )		{			IAction addAction = new AddSelectedLibToCurrentReportDesignAction( treeViewer );			if ( addAction.isEnabled( ) )			{				menu.add( addAction );			}			IAction removeLibraryAction = new RemoveLibraryAction( treeViewer );			if ( removeLibraryAction.isEnabled( ) )			{				menu.add( removeLibraryAction );			}			menu.add( new Separator( ) );			IAction refreshAction = new RefreshLibExplorerAction( treeViewer );			if ( refreshAction.isEnabled( ) )			{				menu.add( refreshAction );			}		}	}