org.eclipse.jface.action.IMenuManager Java Examples

The following examples show how to use org.eclipse.jface.action.IMenuManager. 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: FilteredItemsSelectionDialog.java    From tlaplus with MIT License 6 votes vote down vote up
private void createPopupMenu() {
	removeHistoryItemAction = new RemoveHistoryItemAction();
	removeHistoryActionContributionItem = new ActionContributionItem(
			removeHistoryItemAction);

	contextMenuManager = new MenuManager();
	contextMenuManager.setRemoveAllWhenShown(true);
	contextMenuManager.addMenuListener(new IMenuListener() {
		
		public void menuAboutToShow(IMenuManager manager) {
			fillContextMenu(manager);
		}
	});

	final Table table = list.getTable();
	Menu menu= contextMenuManager.createContextMenu(table);
	table.setMenu(menu);
}
 
Example #2
Source File: ReferencesSearchGroup.java    From typescript.java with MIT License 6 votes vote down vote up
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM = new MenuManager(getName(), IContextMenuConstants.GROUP_SEARCH);
	// addAction(fFindReferencesAction, javaSearchMM);
	addAction(fFindReferencesInProjectAction, javaSearchMM);
	// addAction(fFindReferencesInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());
	//
	// Iterator iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	// while (iter.hasNext()) {
	// addWorkingSetAction((IWorkingSet[]) iter.next(), javaSearchMM);
	// }
	// addAction(fFindReferencesInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #3
Source File: GamlEditor.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void rulerContextMenuAboutToShow(final IMenuManager menu) {
	super.rulerContextMenuAboutToShow(menu);
	menu.remove("projection");

	final IMenuManager foldingMenu = new MenuManager(XtextUIMessages.Editor_FoldingMenu_name, "projection"); //$NON-NLS-1$
	menu.appendToGroup(ITextEditorActionConstants.GROUP_RULERS, foldingMenu);
	IAction action = getAction("FoldingToggle"); //$NON-NLS-1$
	foldingMenu.add(action);
	action = getAction("FoldingExpandAll"); //$NON-NLS-1$
	foldingMenu.add(action);
	action = getAction("FoldingCollapseAll"); //$NON-NLS-1$
	foldingMenu.add(action);
	action = getAction("FoldingCollapseStrings"); //$NON-NLS-1$
	foldingMenu.add(action);
	action = getAction("FoldingRestore"); //$NON-NLS-1$
	foldingMenu.add(action);
}
 
Example #4
Source File: EditActionGroup.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
public void fillContextMenu(IMenuManager menu) {
	IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

	boolean anyResourceSelected = !selection.isEmpty()
			&& ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER
					| IResource.FILE);

	copyAction.selectionChanged(selection);
	// menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyAction);
	pasteAction.selectionChanged(selection);
	// menu.insertAfter(copyAction.getId(), pasteAction);
	// menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, pasteAction);

	if (anyResourceSelected) {
		deleteAction.selectionChanged(selection);
		// menu.insertAfter(pasteAction.getId(), deleteAction);
		menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, deleteAction);
	}
}
 
Example #5
Source File: N4JSNavigatorActionProvider.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(final IMenuManager menu) {
	// {@link N4JSProjectActionGroup} does enablement-logic
	// on its own, thus always invoke it here
	projectGroup.fillContextMenu(menu);

	// Only delegate to {@link N4JSWorkingSetActionProvider},
	// if the current selection contains working sets.
	if (selectionContainsWorkingSet) {
		workingSetActionProvider.fillContextMenu(menu);
	}

	if (assignWorkingSetsAction.isEnabled()) {
		menu.appendToGroup(IContextMenuConstants.GROUP_BUILD, assignWorkingSetsAction);
	}
}
 
Example #6
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void init(IPageSite site) {
	super.init(site);
	IMenuManager menuManager = site.getActionBars().getMenuManager();
	menuManager.insertBefore(IContextMenuConstants.GROUP_PROPERTIES, new Separator(GROUP_FILTERING));
	fActionGroup.fillActionBars(site.getActionBars());
	menuManager.appendToGroup(IContextMenuConstants.GROUP_PROPERTIES, new Action(SearchMessages.JavaSearchResultPage_preferences_label) {
		@Override
		public void run() {
			String pageId= "org.eclipse.search.preferences.SearchPreferencePage"; //$NON-NLS-1$
			String[] displayedPages= { pageId,
					"org.eclipse.ui.editors.preferencePages.Annotations", //$NON-NLS-1$
					"org.eclipse.ui.preferencePages.ColorsAndFonts" //$NON-NLS-1$
			};
			PreferencesUtil.createPreferenceDialogOn(JavaPlugin.getActiveWorkbenchShell(), pageId, displayedPages, null).open();
		}
	});
}
 
Example #7
Source File: ServerView.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Contextual menu
 */
private void createContextMenu() {
  // Create menu manager.
  MenuManager menuMgr = new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener() {
    public void menuAboutToShow(IMenuManager mgr) {
      fillContextMenu(mgr);
    }
  });

  // Create menu.
  Menu menu = menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);

  // Register menu for extension.
  getSite().registerContextMenu(menuMgr, viewer);
}
 
Example #8
Source File: TabularLevelNodeProvider.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 );

	if ( ( (LevelHandle) object ).canEdit( ) )
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
				new EditCubeLevelAction( object,
						Messages.getString( "CubeLevelNodeProvider.menu.text" ) ) ); //$NON-NLS-1$
	}

	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 #9
Source File: WorkingSetFilterActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Adds the filter actions to the menu
 *
 * @param mm the menu manager
 */
public void fillViewMenu(IMenuManager mm) {
	if (mm.find(IWorkingSetActionGroup.ACTION_GROUP) == null) {
		mm.add(new Separator(IWorkingSetActionGroup.ACTION_GROUP));
	}
	add(mm, fSelectWorkingSetAction);
	add(mm, fClearWorkingSetAction);
	add(mm, fEditWorkingSetAction);
	add(mm, new Separator());
	add(mm, new Separator(LRU_GROUP));

	fMenuManager= mm;
	fMenuListener= new IMenuListener() {
		public void menuAboutToShow(IMenuManager manager) {
			removePreviousLRUWorkingSetActions(manager);
			addLRUWorkingSetActions(manager);
		}
	};
	fMenuManager.addMenuListener(fMenuListener);
}
 
Example #10
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 #11
Source File: LocalPullDownMenu.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
public LocalPullDownMenu(IMenuManager menuManager, LogViewer view, Shell shell) {
	this.menuManager = menuManager;
	this.view = view;
	this.shell = shell;
	actionList = new Vector<Object>();
	this.menuManager.setRemoveAllWhenShown(true);
	this.menuManager.addMenuListener(this);
}
 
Example #12
Source File: TmfSimpleTableViewer.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Constructor that initializes the parent of the viewer
 *
 * @param table
 *            the {@link TableViewer} to wrap
 */
public TmfSimpleTableViewer(TableViewer table) {
    super(table.getControl().getParent());
    fTableViewer = table;

    final Table tableControl = fTableViewer.getTable();
    tableControl.setHeaderVisible(true);
    tableControl.setLinesVisible(true);

    fDirection = SWT.DOWN;
    fTableViewer.setUseHashlookup(true);
    fTableViewer.getControl().addMouseListener(new MouseColumnListener());

    fTablePopupMenuManager = new MenuManager();
    fTablePopupMenuManager.setRemoveAllWhenShown(true);

    fTablePopupMenuManager.addMenuListener((final @Nullable IMenuManager manager) -> {
        TableViewer viewer = getTableViewer();
        ISelection selection = viewer.getSelection();
        if (selection instanceof IStructuredSelection) {
            IStructuredSelection sel = (IStructuredSelection) selection;
            if (manager != null) {
                appendToTablePopupMenu(manager, sel);
            }
        }
    });

    Menu tablePopup = fTablePopupMenuManager.createContextMenu(getTableViewer().getTable());
    getTableViewer().getTable().setMenu(tablePopup);

    tableControl.addDisposeListener((e) -> {
        internalDispose();
    });
}
 
Example #13
Source File: TsfTraceAnalysisView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void hookContextMenu() {
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(IMenuManager manager) {
            TsfTraceAnalysisView.this.fillContextMenu(manager);
        }
    });
    Menu menu = menuMgr.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    getSite().registerContextMenu(menuMgr, viewer);
}
 
Example #14
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void fillMenuBar(IMenuManager menuBar) {
	menuBar.add(createFileMenu());
	menuBar.add(createEditMenu());
	menuBar.add(new GroupMarker("view"));
	menuBar.add(new GroupMarker("translation"));
	menuBar.add(new GroupMarker("project"));
	menuBar.add(new GroupMarker("database"));
	menuBar.add(new GroupMarker("qa"));
	menuBar.add(createToolMenu());
	menuBar.add(new GroupMarker("advance"));
	menuBar.add(createHelpMenu());
}
 
Example #15
Source File: RowProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the context menu for the given object. Gets the action from the
 * actionRegistry for the given object and adds them to the menu
 * 
 * @param menu
 *            the menu
 * @param object
 *            the object
 */
public void createContextMenu( TreeViewer sourceViewer, Object object,
		IMenuManager menu )
{
	menu.add( new InsertAction( object,
			Messages.getString( "RowProvider.action.text.above" ), //$NON-NLS-1$
			ReportDesignConstants.ROW_ELEMENT,
			InsertAction.ABOVE ) );
	menu.add( new InsertAction( object,
			Messages.getString( "RowProvider.action.text.below" ), //$NON-NLS-1$
			ReportDesignConstants.ROW_ELEMENT,
			InsertAction.BELOW ) );
	super.createContextMenu( sourceViewer, object, menu );
}
 
Example #16
Source File: MarkerRulerAction.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void menuAboutToShow(IMenuManager manager) {
    if (action != null) {
        obtainFindBugsMarkers();
        action.setEnabled(markers.size() > 0);
    }
}
 
Example #17
Source File: VisualInterfaceActionBarContributor.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: BasicEditor.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
private void fillContextMenu ( final IMenuManager manager )
{
    // Other plug-ins can contribute there actions here

    manager.add ( this.deleteAction );
    manager.add ( new Separator () );
    manager.add ( new Separator ( IWorkbenchActionConstants.MB_ADDITIONS ) );
}
 
Example #19
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 #20
Source File: CustomChartStubView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void createPartControl(@Nullable Composite parent) {
    super.createPartControl(parent);
    SashForm sf = new SashForm(parent, SWT.NONE);
    fContainer = sf;

    /* Add a menu for adding charts */
    Action addChart = new NewChartAction();
    addChart.setText(MENU_TITLE);

    IMenuManager menuMgr = getViewSite().getActionBars().getMenuManager();
    menuMgr.add(addChart);
}
 
Example #21
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 ( final IMenuManager menuManager )
{
    menuManager.insertAfter ( "additions-end", new Separator ( "ui-actions" ) );
    menuManager.insertAfter ( "ui-actions", this.showPropertiesViewAction );

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

    super.addGlobalActions ( menuManager );
}
 
Example #22
Source File: TabularCubeNodeProvider.java    From birt with Eclipse Public License 1.0 5 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 )
{

	menu.add( new Separator( ) );

	InsertCubeInLayoutAction insertAction = new InsertCubeInLayoutAction( object );
	if ( insertAction.isEnabled( ) )
	{
		menu.add( insertAction );
	}

	super.createContextMenu( sourceViewer, object, menu );

	if ( ( (CubeHandle) object ).canEdit( ) )
	{
		menu.insertAfter( IWorkbenchActionConstants.MB_ADDITIONS,
				new EditCubeAction( object,
						Messages.getString( "InsertCubeInLayoutAction.menu.text" ) ) ); //$NON-NLS-1$
	}

	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 #23
Source File: N4JSNewWizardsActionGroup.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void fillContextMenu(final IMenuManager menu) {
	super.fillContextMenu(menu);

	final ISelection selection = getContext().getSelection();
	if (selection instanceof IStructuredSelection) {
		if (canEnable((IStructuredSelection) selection)) {
			final MenuManager newMenu = new MenuManager("Ne&w");
			menu.appendToGroup(IContextMenuConstants.GROUP_NEW, newMenu);
			newMenu.add(getNewWizardMenu());
		}
	}

}
 
Example #24
Source File: PropertiesActionProvider.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public void fillContextMenu(IMenuManager menu) {
	super.fillContextMenu(menu);

	if (propertiesAction.isApplicableForSelection()) {
		menu.appendToGroup(ICommonMenuConstants.GROUP_PROPERTIES,
				propertiesAction);
	}

}
 
Example #25
Source File: MechanicStatusControlContribution.java    From workspacemechanic with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates and registers a new popup menu on the supplied control.
 * 
 * <p>
 * When the menu is about to be shown the
 * {@link #fillContextMenu(IMenuManager)} method will be called.
 */
private void createContextMenu(Control control) {
  MenuManager mgr = new MenuManager("#PopupMenu");
  mgr.setRemoveAllWhenShown(true);
  mgr.addMenuListener(new IMenuListener() {
    public void menuAboutToShow(IMenuManager manager) {
      fillContextMenu(manager);
    }
  });

  Menu menu = mgr.createContextMenu(control);
  control.setMenu(menu);
}
 
Example #26
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addSortActions(IMenuManager mgr) {
	if (getLayout() != FLAG_LAYOUT_FLAT)
		return;
	MenuManager sortMenu= new MenuManager(SearchMessages.JavaSearchResultPage_sortBylabel);
	sortMenu.add(fSortByNameAction);
	sortMenu.add(fSortByPathAction);
	sortMenu.add(fSortByParentName);

	fSortByNameAction.setChecked(fCurrentSortOrder == fSortByNameAction.getSortOrder());
	fSortByPathAction.setChecked(fCurrentSortOrder == fSortByPathAction.getSortOrder());
	fSortByParentName.setChecked(fCurrentSortOrder == fSortByParentName.getSortOrder());

	mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
}
 
Example #27
Source File: ProtocolActionBarContributor.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 #28
Source File: OccurrencesSearchMenuAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void fillQuickMenu(IMenuManager manager, List<IAction> activeActions) {
	if (activeActions.isEmpty()) {
		manager.add(NO_ACTION_AVAILABLE);
	} else {
		for (int i= 0; i < activeActions.size(); i++) {
			manager.add(activeActions.get(i));
		}
	}
}
 
Example #29
Source File: TypeScriptEditorActionContributor.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public void contributeToMenu(IMenuManager menu) {
	super.contributeToMenu(menu);

	IMenuManager navigateMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
	if (navigateMenu != null) {
		navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fShowOutline);
	}
}
 
Example #30
Source File: ControlFlowView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.0
 */
@Override
protected void fillTimeGraphEntryContextMenu(@NonNull IMenuManager menuManager) {
    ISelection selection = getSite().getSelectionProvider().getSelection();
    if (selection instanceof StructuredSelection) {
        StructuredSelection sSel = (StructuredSelection) selection;
        if (sSel.getFirstElement() instanceof TimeGraphEntry) {
            TimeGraphEntry entry = (TimeGraphEntry) sSel.getFirstElement();
            ITmfTreeDataModel entryModel = entry.getEntryModel();
            if (entryModel instanceof ThreadEntryModel) {
                menuManager.add(new FollowThreadAction(ControlFlowView.this, entry.getName(), ((ThreadEntryModel) entryModel).getThreadId(), getTrace(entry)));
            }
        }
    }
}