Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » menu and submenu item dynamically generate using rich client platform(RCP)
menu and submenu item dynamically generate using rich client platform(RCP) [message #1694561] Wed, 06 May 2015 10:16
Lalit Solanki is currently offline Lalit SolankiFriend
Messages: 140
Registered: April 2015
Senior Member
Hi friend,

I am create one rich client platform application now i am trying to menu and submenu dynamically set menu and subitem.

code in plugin.xml file...

<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="popuprg.eclipse.ui.navigator.ProjectExplorer#PopupMenu?after=additions">

MyDynamicMenu .java
import java.util.Date;

import org.eclipse.jface.action.ContributionItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;

public class MyDynamicMenu extends ContributionItem {

public MyDynamicMenu() {

public MyDynamicMenu(String id) {

public void fill(Menu menu, int index) {
//Here you could get selection and decide what to do
//You can also simply return if you do not want to show a menu

//create the menu item
MenuItem menuItem = new MenuItem(menu, SWT.CHECK, index);
menuItem.setText("My menu item (" + new Date() + ")");
menuItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//what to do when menu is subsequently selected.
System.err.println("Dynamic menu selected");

please help me friend how to create more menu and submenu item dynamically ...

Previous Topic:Closed view displayed again after restarting application
Next Topic:InjectionException on E4 app w/ CompatibilityView
Goto Forum:

Current Time: Mon Mar 19 05:18:05 GMT 2018

Powered by FUDForum. Page generated in 0.01614 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software