Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] MenuBar Menus and MenuItems


Hi bhargava
see the following link.............


http://www.eclipse.org/articles/Article-action-contribution/Contributing%20Actions%20to%20the%20Eclipse%20Workbench.html


As per my knowledge u can add and remove ur menus and actions............but u cant remove default menus and toolitems.
See a Sample Plugin in eclipse IDE....

Thanks and regards
-Pavanesh









"Bhargav Faldu"

Sent by:
platform-swt-dev-bounces@xxxxxxxxxxx

07/08/2005 12:07 PM

Please respond to
"Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>

To
"Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
cc
Subject
RE: [platform-swt-dev] MenuBar Menus and MenuItems
Classification





HiTimar,
Actually friend i am in search of menus as the extention to the eclipse plug-in and not the swt menus we create. I am talking about the menubar which appears by default in the eclipse environment. How to add/Remove Menus from this menubar.

Bhargav Faldu
Technology Innovation Group
Zensar Technologies
Phone - 020-5605-7673
Mobile- 09823164433


-----Original Message-----
From: platform-swt-dev-bounces@xxxxxxxxxxx
[mailto:platform-swt-dev-bounces@xxxxxxxxxxx]On Behalf Of Timar
Laurentia
Sent: Friday, July 08, 2005 11:41 AM
To: Eclipse Platform SWT component developers list.
Subject: RE: [platform-swt-dev] MenuBar Menus and MenuItems




Hello  Bhargav,

Here is a little example.
Is this what you want to know?




import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;


public class little extends Composite {

  public static final void main(String[] args) {
     Display display = new Display();
     final Shell shell = new Shell(display);

     shell.setText("My first SWT application.");
     
     little board = new little(shell, SWT.NONE);

     shell.pack();
     shell.open();
     while(!shell.isDisposed()) {
        if(!display.readAndDispatch())
           display.sleep();
     }
     display.dispose();
  }
  public little(Composite shell, int style) {
      super(shell, style);

      GridLayout l = new GridLayout();
      l.makeColumnsEqualWidth = true;

      l.marginWidth = 12;
      l.marginHeight = 12;
      l.horizontalSpacing = 4;
      l.verticalSpacing = 4;
      l.numColumns = 2;
      shell.setLayout(l);

       // set the menu and menu bar
          Menu mb = new Menu((Decorations)shell,SWT.BAR);
          ((Decorations)shell).setMenuBar(mb);
          MenuItem mi1 = new MenuItem(mb, SWT.CASCADE);
          mi1.setText("My menu");
          Menu fMenu1 = new Menu((Decorations)shell, SWT.DROP_DOWN);
          mi1.setMenu(fMenu1);
          MenuItem newItem = new MenuItem(fMenu1, SWT.CASCADE);
          newItem.setText("My first submenu item");
          newItem.addArmListener(new ArmListener(){
                                                                                       public void widgetArmed(ArmEvent
ae){
                                                                                                     System.out.println("Menu
Item is Armed.");
                                                                                    }
                                                     });
          MenuItem newItem1 = new MenuItem(fMenu1, SWT.CASCADE);
          newItem1.setText("Open item");


          MenuItem mi2 = new MenuItem(mb, SWT.CASCADE);
          mi2.setText("My edit");

          Menu eMenu1 = new Menu((Decorations)shell, SWT.DROP_DOWN);
          mi2.setMenu(eMenu1);
          eMenu1.addMenuListener(new MenuListener(){
                                                                                          public void
menuHidden(MenuEvent me){
               
System.out.println("Menu hidden event");
                                                                                          }
                                                                                          public void
menuShown(MenuEvent me){
               
System.out.println("Menu shown event");
                                                                                          }
                                                     });
          MenuItem edItem = new MenuItem(eMenu1, SWT.CASCADE);
          edItem.setText("My Copy");
          MenuItem edItem1 = new MenuItem(eMenu1, SWT.CASCADE);
          edItem1.setText("My Paste");
      //end setting menu bar

  }
}






_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

This email may contain confidential or privileged information for the intended recipient(s) and the views expressed in the same are not necessarily the views of Zensar Technologies Ltd. If you are not the intended recipient or have received this e-mail by error, its use is strictly prohibited, please delete the e-mail and notify the sender. Zensar Technologies Ltd. does not accept any liability for virus infected mails.



_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top