Java 类org.eclipse.jface.action.MenuManager 实例源码

项目:n4js    文件:SelectAllProjectExplorer_PluginUITest.java   
/**
 * Tests that the Top Level Elements
 */
@Test
public void testTopLevelElementsEntryNoDuplicates() {
    IActionBars actionBars = projectExplorer.getViewSite().getActionBars();
    IMenuManager menuManager = actionBars.getMenuManager();

    int topLevelElementsEntriesFound = 0;

    for (IContributionItem item : menuManager.getItems()) {
        if (item instanceof MenuManager) {
            String escapedMenuText = LegacyActionTools.removeMnemonics(((MenuManager) item).getMenuText());
            if (escapedMenuText.equals("Top Level Elements")) {
                topLevelElementsEntriesFound++;
            }
        }
    }

    assertEquals("There was more than one 'Top Level Elements' entry in the navigator action bar.",
            topLevelElementsEntriesFound, 1);
}
项目:n4js    文件:SelectAllProjectExplorer_PluginUITest.java   
/**
 * Asserts that the context menu for the current navigator selection does not contain any duplicates.
 *
 * That is, two menu items that represent an action of the same class.
 */
private void assertContextMenuNoActionDuplicates() {
    MenuManager menu = new MenuManager();
    projectExplorer.getNavigatorActionService().fillContextMenu(menu);
    List<ActionContributionItem> actionContributions = Arrays.asList(menu.getItems()).stream()
            .filter(i -> i instanceof ActionContributionItem)
            .map(i -> ((ActionContributionItem) i))
            .collect(Collectors.toList());

    Map<String, ActionContributionItem> contributionNameMap = new HashMap<>();

    for (ActionContributionItem item : actionContributions) {
        ActionContributionItem mapItem = contributionNameMap.putIfAbsent(item.getAction().getText(), item);
        if (mapItem != null) {
            IAction mapAction = mapItem.getAction();
            IAction otherAction = item.getAction();

            // Double check if action is of the same type
            if (mapAction.getClass().equals(otherAction.getClass())) {
                fail("Action '" + mapAction.getClass().getSimpleName()
                        + "' is contributed twice to the context menu: "
                        + mapAction.toString() + " " + otherAction.toString());
            }
        }
    }
}
项目:n4js    文件:SelectAllProjectExplorer_PluginUITest.java   
/**
 * Returns the menu contribution titles of the project navigator context menu.
 *
 * This only includes {@link ActionContributionItem}s and {@link MenuManager}s.
 */
private List<String> getContextMenuContributions() {
    MenuManager menu = new MenuManager();
    projectExplorer.getNavigatorActionService().fillContextMenu(menu);
    return Arrays.asList(menu.getItems()).stream()
            .map(i -> {
                if (i instanceof ActionContributionItem) {
                    // use action name
                    return ((ActionContributionItem) i).getAction().getText();
                } else if (i instanceof MenuManager) {
                    // use sub-menu title
                    return ((MenuManager) i).getMenuText();
                } else {
                    // null for other types of contributions
                    return null;
                }
            })
            .filter(t -> null != t)
            // remove mnemonics (e.g. Close &Project -> Close Project))
            .map(text -> LegacyActionTools.removeMnemonics(text))
            .collect(Collectors.toList());
}
项目:neoscada    文件:ProtocolEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:ChartEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well
 * registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * 
 * @generated NOT
 */
protected void createContextMenuFor ( final StructuredViewer viewer )
{
    final MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    final Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    final Transfer[] transfers = new Transfer[] {
            LocalTransfer.getInstance (),
            LocalSelectionTransfer.getTransfer (),
            FileTransfer.getInstance (),
            ItemTransfer.getInstance ()
    };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new DropAdapterExtension ( this.editingDomain, viewer ) );
}
项目:neoscada    文件:ChartConfiguratorView.java   
/**
 * This creates a context menu for the viewer and adds a listener as well
 * registering the menu for extension. <!-- begin-user-doc --> <!--
 * end-user-doc -->
 */
protected void createContextMenuFor ( final StructuredViewer viewer )
{
    final MenuManager contextMenu = new MenuManager ( "#PopUp" );
    contextMenu.add ( new Separator ( "additions" ) );
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    final Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    final Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( this.editingDomain, viewer ) );
}
项目:neoscada    文件:DetailViewActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:DetailViewActionBarContributor.java   
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
项目:neoscada    文件:DetailViewEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:BaseFolderImplementation.java   
public BaseFolderImplementation ( final int index, final String label, final MenuManager mgr )
{
    this.summaryInformation = new SummaryInformation ( Collections.<String, DataValue> emptyMap () );
    this.index = index;
    this.label = label;
    this.mgr = mgr;

    this.dumpAction = new Action ( "Dump summaries for: " + this.label ) {
        @Override
        public void run ()
        {
            BaseFolderImplementation.this.summaryInformation.dump ( System.out );
        };
    };
    this.contribution = new ActionContributionItem ( this.dumpAction );
}
项目:neoscada    文件:VisualInterfaceEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:DeploymentEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:DeploymentActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:DeploymentActionBarContributor.java   
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
项目:neoscada    文件:SetupActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:ProfileActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:ProfileActionBarContributor.java   
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
项目:neoscada    文件:ProfileEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:OsgiActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:OsgiActionBarContributor.java   
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
项目:neoscada    文件:OsgiEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:Hydrograph    文件:CustomAboutDialog.java   
/**
 * Create the context menu for the text widget.
 * 
 * @since 3.4
 */
private void createTextMenu() {
    final MenuManager textManager = new MenuManager();
    textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(),
            null, IWorkbenchCommandConstants.EDIT_COPY, CommandContributionItem.STYLE_PUSH)));
    textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(),
            null, IWorkbenchCommandConstants.EDIT_SELECT_ALL, CommandContributionItem.STYLE_PUSH)));
    text.setMenu(textManager.createContextMenu(text));
    text.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            textManager.dispose();
        }
    });

}
项目:neoscada    文件:WorldActionBarContributor.java   
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
项目:neoscada    文件:WorldEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:MemoryEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" );
    contextMenu.add ( new Separator ( "additions" ) );
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:MemoryActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:MemoryActionBarContributor.java   
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
项目:neoscada    文件:RecipeActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:RecipeActionBarContributor.java   
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
项目:neoscada    文件:RecipeEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:InfrastructureEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:InfrastructureActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:SecurityEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:neoscada    文件:GlobalizeActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:ComponentActionBarContributor.java   
/**
 * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.MenuManager}s containing
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> collection, by inserting them before the specified contribution
 * item <code>contributionID</code>.
 * If <code>contributionID</code> is <code>null</code>, they are simply added.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void populateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions, String contributionID )
{
    if ( submenuActions != null )
    {
        for ( Map.Entry<String, Collection<IAction>> entry : submenuActions.entrySet () )
        {
            MenuManager submenuManager = new MenuManager ( entry.getKey () );
            if ( contributionID != null )
            {
                manager.insertBefore ( contributionID, submenuManager );
            }
            else
            {
                manager.add ( submenuManager );
            }
            populateManager ( submenuManager, entry.getValue (), null );
        }
    }
}
项目:neoscada    文件:ComponentActionBarContributor.java   
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
项目:neoscada    文件:ItemActionBarContributor.java   
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
项目:neoscada    文件:ItemEditor.java   
/**
 * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void createContextMenuFor ( StructuredViewer viewer )
{
    MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
项目:scanning    文件:ValidateResultsView.java   
/**
 * Create the actions
 */
private void createActions() {
    final IContributionManager man = getViewSite().getActionBars().getToolBarManager();

    final Action restart = new Action("Clear", Activator.getImageDescriptor("icons/layers-stack.png")) {
        @Override
        public void run() {
            clear();
        }
    };
    man.add(restart);

    final MenuManager menuMan = new MenuManager();
    menuMan.add(restart);

    text.setMenu(menuMan.createContextMenu(text));
}
项目:Hydrograph    文件:DebugDataViewer.java   
private void createViewMenu(MenuManager menuManager) {
    MenuManager viewMenu = createMenu(menuManager, MenuConstants.VIEW);
    menuManager.add(viewMenu);
    viewMenu.setVisible(true);

    if (actionFactory == null) {
        actionFactory = new ActionFactory(this);
    }

    viewMenu.add(actionFactory.getAction(GridViewAction.class.getName()));
    viewMenu.add(actionFactory.getAction(FormattedViewAction.class.getName()));
    viewMenu.add(actionFactory.getAction(UnformattedViewAction.class.getName()));
    viewMenu.add(new Separator());
    viewMenu.add(actionFactory.getAction(ReloadAction.class.getName()));
    viewDataPreferencesVO = getViewDataPreferencesFromPreferenceFile();
    viewMenu.add(actionFactory.getAction(PreferencesAction.class.getName()));
}