Java Code Examples for org.eclipse.jface.action.IMenuManager#insertAfter()

The following examples show how to use org.eclipse.jface.action.IMenuManager#insertAfter() . 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: LeveAttributelNodeProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the context menu for the given object. Gets the action from the
 * actionRegistry and adds the action to the menu.
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	super.createContextMenu( sourceViewer, object, menu );

	menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
			new ShowPropertyAction( object ) );

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
	IAction action = new RefreshAction( sourceViewer );
	if (action.isEnabled( ))
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
	}
}
 
Example 2
Source File: DataSetNodeProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the context menu for the given object. Gets the action from the
 * actionRegistry and adds the action to the menu.
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	super.createContextMenu( sourceViewer, object, menu );

	menu.insertBefore( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", //$NON-NLS-1$
			new ShowPropertyAction( object ) );

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", new Separator( ) ); //$NON-NLS-1$
	IAction action = new RefreshAction( sourceViewer );
	if (action.isEnabled( ))
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS + "-refresh", action ); //$NON-NLS-1$
	}
}
 
Example 3
Source File: CoreActionBarContributor.java    From ifml-editor with MIT License 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 4
Source File: GenconfActionBarContributor.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
    menuManager.insertAfter("additions-end", new Separator("ui-actions"));
    menuManager.insertAfter("ui-actions", showPropertiesViewAction);

    refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
    menuManager.insertAfter("ui-actions", refreshViewerAction);

    super.addGlobalActions(menuManager);
}
 
Example 5
Source File: CrossflowActionBarContributor.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 6
Source File: ConfigurationActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 7
Source File: DesignerActionBarContributor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void contributeToMenu( IMenuManager menubar )
{
	super.contributeToMenu( menubar );
	updateEditMenu( menubar );
	// Insert Menu
	MenuManager insertMenu = new MenuManager( Messages.getString( "DesignerActionBarContributor.menu.insert" ), M_INSERT ); //$NON-NLS-1$
	createInsertMenu( insertMenu );

	insertMenu.addMenuListener( new IMenuListener( ) {

		public void menuAboutToShow( IMenuManager manager )
		{
			manager.removeAll( );
			insertElementActions = null;
			createInsertMenu( manager );
		}
	} );

	// insertMenu.add( getAction( ImportLibraryAction.ID ) );
	menubar.insertAfter( IWorkbenchActionConstants.M_EDIT, insertMenu );

	// Element Menu
	MenuManager elementMenu = new MenuManager( Messages.getString( "DesignerActionBarContributor.menu.element" ), M_ELEMENT ); //$NON-NLS-1$
	contributeElementMenu( elementMenu );
	menubar.insertAfter( M_INSERT, elementMenu );

	// Data Menu
	MenuManager dataMenu = new MenuManager( Messages.getString( "DesignerActionBarContributor.menu.data" ), M_DATA ); //$NON-NLS-1$

	// the data actions are now registered through eclipse menu extensions
	IMenuService menuService = (IMenuService) PlatformUI.getWorkbench( )
			.getService( IMenuService.class );
	menuService.populateContributionManager( dataMenu, "menu:birtData" ); //$NON-NLS-1$
	menubar.insertAfter( M_ELEMENT, dataMenu );

	menubar.update( );
}
 
Example 8
Source File: GlobalizeActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 9
Source File: LangEditorActionContributor.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected void prepareSourceMenu(IMenuManager menu) {
	IMenuManager sourceMenu = menu.findMenuUsingPath(SOURCE_MENU_ID);
	if(sourceMenu == null) {
		// This structure should have been created declaratively by plugin.xml, 
		LangCore.logError("Source menu " + SOURCE_MENU_ID + " not created by plugin.xml!");

		// We can create it programmatically, by other plugin.xml declarative menu contribution will
		// fail to find the menu because it will be created too late.
		sourceMenu = LangEditorContextMenuContributor.createSourceMenuSkeleton();
		menu.insertAfter(IWorkbenchActionConstants.M_EDIT, sourceMenu);
	}
	
	contributeSourceMenu(sourceMenu);
}
 
Example 10
Source File: OpenActionProvider.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void fillContextMenu(IMenuManager aMenu) {
		if (!contribute || getContext().getSelection().isEmpty()) {
			return;
		}

		IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

		openFileAction.selectionChanged(selection);
		if (openFileAction.isEnabled()) {
			aMenu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openFileAction);
		}
//		addOpenWithMenu(aMenu);
	}
 
Example 11
Source File: BeansActionBarContributor.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions"));
	menuManager.insertAfter("ui-actions", showPropertiesViewAction);

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
	menuManager.insertAfter("ui-actions", refreshViewerAction);

	super.addGlobalActions(menuManager);
}
 
Example 12
Source File: ThemeNodeProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the context menu for the given object.
 * 
 * @param object
 *            the object
 * @param menu
 *            the menu
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	if ( canContain( object ) )
	{
		InsertAction newStyleAction = new InsertAction( object,
				Messages.getString( "StylesNodeProvider.action.New" ) ) { //$NON-NLS-1$

			@Override
			public String getId( )
			{
				return NEW_STYLE_ACTION_ID;
			}
		};
		menu.add( newStyleAction );
	}

	super.createContextMenu( sourceViewer, object, menu );

	if ( canContain( object ) )
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
				new Separator( ) );

		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
				new ImportCSSStyleAction( object ) );
	}

	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
			new ReloadCssStyleAction( object ) );
	menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
			new UseCssStyleAction( object ) );
}
 
Example 13
Source File: WorldActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 14
Source File: OsgiActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 15
Source File: ProfileActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 16
Source File: EipActionBarContributor.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
   * This inserts global actions before the "additions-end" separator.
   * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
   * @generated
   */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
     menuManager.insertAfter("additions-end", new Separator("ui-actions"));
     menuManager.insertAfter("ui-actions", showPropertiesViewAction);

     refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());		
     menuManager.insertAfter("ui-actions", refreshViewerAction);

     super.addGlobalActions(menuManager);
  }
 
Example 17
Source File: DetailViewActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions ( IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) ); //$NON-NLS-1$ //$NON-NLS-2$
    menuManager.insertAfter ( "ui-actions", showPropertiesViewAction ); //$NON-NLS-1$

    refreshViewerAction.setEnabled ( refreshViewerAction.isEnabled () );
    menuManager.insertAfter ( "ui-actions", refreshViewerAction ); //$NON-NLS-1$

    super.addGlobalActions ( menuManager );
}
 
Example 18
Source File: ChartActionBarContributor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This inserts global actions before the "additions-end" separator.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
protected void addGlobalActions(IMenuManager menuManager) {
	menuManager.insertAfter("additions-end", new Separator("ui-actions")); //$NON-NLS-1$ //$NON-NLS-2$
	menuManager.insertAfter("ui-actions", showPropertiesViewAction); //$NON-NLS-1$

	refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
	menuManager.insertAfter("ui-actions", refreshViewerAction); //$NON-NLS-1$

	super.addGlobalActions(menuManager);
}
 
Example 19
Source File: NewActionProvider.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Adds a submenu to the given menu with the name "group.new" see
 * {@link ICommonMenuConstants#GROUP_NEW}). The submenu contains the following structure:
 * 
 * <ul>
 * <li>a new generic project wizard shortcut action, </li>
 * <li>a separator, </li>
 * <li>a set of context senstive wizard shortcuts (as defined by
 * <b>org.eclipse.ui.navigator.commonWizard</b>), </li>
 * <li>another separator, </li>
 * <li>a generic examples wizard shortcut action, and finally </li>
 * <li>a generic "Other" new wizard shortcut action</li>
 * </ul>
 */
public void fillContextMenu(IMenuManager menu) {
	// append the submenu after the GROUP_NEW group.
	menu.insertAfter(ICommonMenuConstants.GROUP_NEW, showDlgAction);
}
 
Example 20
Source File: NewActionProvider.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Adds a submenu to the given menu with the name "group.new" see
 * {@link ICommonMenuConstants#GROUP_NEW}). The submenu contains the following structure:
 * 
 * <ul>
 * <li>a new generic project wizard shortcut action, </li>
 * <li>a separator, </li>
 * <li>a set of context senstive wizard shortcuts (as defined by
 * <b>org.eclipse.ui.navigator.commonWizard</b>), </li>
 * <li>another separator, </li>
 * <li>a generic examples wizard shortcut action, and finally </li>
 * <li>a generic "Other" new wizard shortcut action</li>
 * </ul>
 */
public void fillContextMenu(IMenuManager menu) {
	// append the submenu after the GROUP_NEW group.
	menu.insertAfter(ICommonMenuConstants.GROUP_NEW, showDlgAction);
}