Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Menu


    if (focus == null || focus.isDisposed())
      return;
   
    MenuManager menu= new MenuManager();
    fillMenu(menu);
    final Menu widget= menu.createContextMenu(focus.getShell());
    Point location= computeMenuLocation(focus, widget);
    if (location == null)
      return;
    widget.setLocation(location);
    widget.setVisible(true);
    while (!widget.isDisposed() && widget.isVisible()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    if (!widget.isDisposed()) {
      widget.dispose();
    }
  }
View Full Code Here


            public void menuAboutToShow(IMenuManager manager) {
                manager.add(_startWGARuntime);
                manager.add(_stopWGARuntime);
            }
        });
        Menu menu = menuMgr.createContextMenu(_table.getControl());
        _table.getControl().setMenu(menu);
        getSite().registerContextMenu(menuMgr, _table);
    }
View Full Code Here

          if (!(e.button == 3 || (e.button == 1 && e.stateMask == SWT.CONTROL))){

            return;
          }

          final Menu menu = new Menu(control.getShell(),SWT.POP_UP);

          MenuItem   item = new MenuItem( menu,SWT.NONE );

          item.setText( MessageText.getString( "ConfigView.copy.to.clipboard.tooltip"));

          item.addSelectionListener(
              new SelectionAdapter()
              {
                public void
                widgetSelected(
                    SelectionEvent arg0)
                {
                  new Clipboard(control.getDisplay()).setContents(new Object[] {text}, new Transfer[] {TextTransfer.getInstance()});
                }
              });

          control.setMenu( menu );

          menu.addMenuListener(
              new MenuAdapter()
              {
                public void
                menuHidden(
                    MenuEvent arg0 )
                {
                  if ( control.getMenu() == menu ){
                 
                    control.setMenu( null );
                  }
                }
              });

          menu.setVisible( true );
        }
      });
  }
View Full Code Here

          "UIFunctionsManagerSWT.getUIFunctionsSWT() is returning null");
    }

    item = new MenuItem(menu, SWT.CASCADE);
    item.setText("&Debug");
    Menu menuDebug = new Menu(menu.getParent(), SWT.DROP_DOWN);
    item.setMenu(menuDebug);

    item = new MenuItem(menuDebug, SWT.CASCADE);
    item.setText("ScreenSize");
    Menu menuSS = new Menu(menu.getParent(), SWT.DROP_DOWN);
    item.setMenu(menuSS);

    item = new MenuItem(menuSS, SWT.NONE);
    item.setText("640x400");
    item.addSelectionListener(new SelectionAdapter() {
View Full Code Here

          main_listener.handleEvent(e);
        }
      });
     
      if (is_container) {
        Menu this_menu = new Menu(composite.getShell(), SWT.DROP_DOWN);
        menuItem.setMenu(this_menu);
        addPluginMenuItems(composite, az_menuitem.getItems(), this_menu, false,
            enable_items, controller);
      }
     
View Full Code Here

  }

  private void setMenu(Menu parent) {
    if (_menu != null)
      _menu.dispose();
    _menu= new Menu(parent);
  }
View Full Code Here

  }
 
  private void setMenu(Control parent) {
    if (_menu != null)
      _menu.dispose();   
    _menu= new Menu(parent);
  }
View Full Code Here

       
        Tree tree = toolkit.createTree(schemaSection, SWT.NONE);
        tree.setLayoutData(new GridData(GridData.FILL_BOTH));
        schemaSection.setClient(tree);
       
        final Menu menu = new Menu(Display.getCurrent().getActiveShell(), SWT.POP_UP);
        MenuItem itemNewContentTypeDefinition = new MenuItem(menu, SWT.PUSH);
        itemNewContentTypeDefinition.setText("Content Type Definition");
        itemNewContentTypeDefinition.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                WGContentTypeDefinition cType = _model.createContentTypeDefinition();
                _treeViewer.expandToLevel(cType, 1);
                _treeViewer.setSelection(new SingleStructuredSelection(cType));               
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
        MenuItem itemNewAreaDefinition = new MenuItem(menu, SWT.PUSH);
        itemNewAreaDefinition.setText("Area Definition");
        itemNewAreaDefinition.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                WGAreaDefinition area = _model.createAreaDefinition();
                _treeViewer.expandToLevel(area, 1);
                _treeViewer.setSelection(new SingleStructuredSelection(area));               
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
        MenuItem itemNewLanguageDefinition = new MenuItem(menu, SWT.PUSH);
        itemNewLanguageDefinition.setText("Language Definition");
        itemNewLanguageDefinition.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                WGLanguageDefinition lang = _model.createLanguageDefinition();
                _treeViewer.expandToLevel(lang, 1);
                _treeViewer.setSelection(new SingleStructuredSelection(lang));               
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
       
       
        final ToolBar schemaSectionToolBar = new ToolBar(schemaSection, SWT.FLAT);
        final ToolItem schemaSectionItemNew = new ToolItem(schemaSectionToolBar, SWT.DROP_DOWN);
        schemaSectionItemNew.setText("new");
        schemaSectionItemNew.setImage(Plugin.getDefault().getImageRegistry().get(Plugin.IMAGE_SCHEMADEFINITION_ADD));
        schemaSectionItemNew.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event event) {

                  Rectangle rect = schemaSectionItemNew.getBounds();
                  Point pt = new Point(rect.x, rect.y + rect.height);
                  pt = schemaSectionToolBar.toDisplay(pt);
                  menu.setLocation(pt.x, pt.y);
                  menu.setVisible(true);

              }
           }
        );
        final ToolItem schemaSectionItemDelete = new ToolItem(schemaSectionToolBar, SWT.PUSH);
View Full Code Here

  private WGARuntime _lastStartedRuntime;

  public Menu getMenu(Control parent) {
   
    Menu menu = new Menu(parent);
   
    List<WGARuntime> runtimeList = new ArrayList<WGARuntime>(WGADesignerPlugin.getAllRuntimes().values());
    Collections.sort(runtimeList, new WGARuntimeSortByName());
    Iterator<WGARuntime> runtimes = runtimeList.iterator();
    while (runtimes.hasNext()) {
      WGARuntime runtime = runtimes.next();
     
      MenuItem runtimeItem = new MenuItem(menu, SWT.CASCADE);
      runtimeItem.setText(runtime.getName());
      runtimeItem.setData(runtime);
     
      Menu runtimeMenu = new Menu(parent.getShell(), SWT.DROP_DOWN);
      runtimeItem.setMenu(runtimeMenu);
     
      MenuItem startItem = new MenuItem(runtimeMenu, SWT.DROP_DOWN);
      startItem.setText("start");
      startItem.setImage(WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_SERVER_START));
View Full Code Here

   
    releaseOldImages();
   
    MenuItem[] items = MenuItemManager.getInstance().getAllAsArray(menu_context.context);
    if (items.length > 0 & menu == null) {
      menu = new Menu(label);
      label.setMenu(menu);
       
      MenuBuildUtils.addMaintenanceListenerForMenu(menu,
          new MenuBuildUtils.MenuBuilder() {
          public void buildMenu(Menu menu, MenuEvent menuEvent) {
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Menu

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.