Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.MenuItem


  private void handleHideProxy(final Menu proxy) {
    proxy.removeListener(SWT.Hide, getMenuCreatorListener());
    proxy.getDisplay().asyncExec(new Runnable() {
      public void run() {
        if (!proxy.isDisposed()) {
          MenuItem parentItem = proxy.getParentItem();
          proxy.dispose();
          parentItem.setMenu(holdMenu);
        }
        if (holdMenu != null && !holdMenu.isDisposed()) {
          holdMenu.notifyListeners(SWT.Hide, null);
        }
        holdMenu = null;
View Full Code Here


      {
        menu1 = new Menu(getShell(), SWT.BAR);
        getShell().setMenuBar(menu1);

        {
          lobbyMenuItem = new MenuItem(menu1, SWT.CASCADE);
          lobbyMenuItem.setText("Lobby");
          {
            lobbyMenu = new Menu(lobbyMenuItem);
            {
              newFileMenuItem = new MenuItem(lobbyMenu, SWT.CASCADE);
              newFileMenuItem.setText("Login ...");
              newFileMenuItem.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent evt) {
                  logger.debug("newFileMenuItem.widgetSelected, event=" + evt);
                  // clientCore.login(clientCore., port,
                  // userName, password)
                }
              });
            }
            {
              exitMenuItem = new MenuItem(lobbyMenu, SWT.CASCADE);
              exitMenuItem.setText("Exit");
              exitMenuItem.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent evt) {
                  logger.debug("exitMenuItem.widgetSelected, event=" + evt);
                  // TODO Leave all open tables
                  // TODO Log out (via AccountListener??)
                  exit();
                }
              });
            }
            lobbyMenuItem.setMenu(lobbyMenu);
          }
        }

        {
          uiMenuItem = new MenuItem(menu1, SWT.CASCADE);
          uiMenuItem.setText("Appearance");
          //TODO reenable after missing images bug is fixed
          uiMenuItem.setEnabled(false);
          {
            uiMenu = new Menu(uiMenuItem);
            uiMenuItem.setMenu(uiMenu);

            {
              soundMenuItem = new MenuItem(uiMenu, SWT.CHECK);
              soundMenuItem.setText("Play Sound");
              soundMenuItem.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent evt) {

                  ClientGUI.SOUND_ON = soundMenuItem.getSelection();
                  Preferences.userRoot().put(User.Prefs.SOUND, Boolean.toString(ClientGUI.SOUND_ON));
                }
              });
            }

            {
              cardsMenuItem = new MenuItem(uiMenu, SWT.CASCADE);
              cardsMenuItem.setText("Cards");
            }

            cardsMenu = new Menu(cardsMenuItem);
            cardsMenuItem.setMenu(cardsMenu);
            fourColorDeckMenuItem = new MenuItem(cardsMenu, SWT.RADIO);
            fourColorDeckMenuItem.setText("Four Color Deck");
            fourColorDeckMenuItem.setSelection(ClientGUI.Resources.ACTIVE_DECK_IMG_FILE
                .equals(ClientGUI.Resources.FOUR_COLOR_DECK_IMG_FILE));
            fourColorDeckMenuItem.addSelectionListener(new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent evt) {
                try {
                  ClientGUI.setActiveCardDeck(ClientGUI.Resources.FOUR_COLOR_DECK_IMG_FILE);
                } catch (FileNotFoundException e) {
                  logger.error("Could not change card deck style", e);
                }
              }
            });
            ftpCardsMenuItem = new MenuItem(cardsMenu, SWT.RADIO);
            ftpCardsMenuItem.setText("Full Tilt Poker");
            ftpCardsMenuItem.setEnabled(ClientGUI.Resources.ADDITIONAL_RESOURCES);
            ftpCardsMenuItem.setSelection(ClientGUI.Resources.ACTIVE_DECK_IMG_FILE
                .equals(ClientGUI.Resources.FTP_DECK_IMG_FILE));
            ftpCardsMenuItem.addSelectionListener(new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent evt) {
                try {
                  ClientGUI.setActiveCardDeck(ClientGUI.Resources.FTP_DECK_IMG_FILE);
                } catch (FileNotFoundException e) {
                  logger.error("Could not change card deck style", e);
                }
              }
            });
            {
              chipsMenuItem = new MenuItem(uiMenu, SWT.CASCADE);
              chipsMenuItem.setText("Chips");

              chipsMenu = new Menu(chipsMenuItem);

              chipsMenuItem.setMenu(chipsMenu);
              starsChipsMenuItem = new MenuItem(chipsMenu, SWT.RADIO);
              starsChipsMenuItem.setText("Poker Stars");
              starsChipsMenuItem.setEnabled(ClientGUI.Resources.ADDITIONAL_RESOURCES);
              starsChipsMenuItem.setSelection(ClientGUI.Resources.ACTIVE_CHIP_DIR
                  .equals(ClientGUI.Resources.STARS_CHIP_IMG_DIR));
              starsChipsMenuItem.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent evt) {
                  try {
                    ClientGUI.setActiveChipsStyle(ClientGUI.Resources.STARS_CHIP_IMG_DIR);
                  } catch (FileNotFoundException e) {
                    logger.error("Could not change chip style", e);
                  }
                }
              });
              eptChipsMenuItem = new MenuItem(chipsMenu, SWT.RADIO);
              eptChipsMenuItem.setText("European Poker Tour");
              eptChipsMenuItem.setEnabled(ClientGUI.Resources.ADDITIONAL_RESOURCES);
              eptChipsMenuItem.setSelection(ClientGUI.Resources.ACTIVE_CHIP_DIR
                  .equals(ClientGUI.Resources.EPT_CHIP_IMG_DIR));
              eptChipsMenuItem.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent evt) {
                  try {
                    ClientGUI.setActiveChipsStyle(ClientGUI.Resources.EPT_CHIP_IMG_DIR);
                  } catch (FileNotFoundException e) {
                    logger.error("Could not change chip style", e);
                  }
                }
              });

              pokerWikiaChipsMenuItem = new MenuItem(chipsMenu, SWT.RADIO);
              pokerWikiaChipsMenuItem.setText("Poker Wikia (Free) Chips");
              pokerWikiaChipsMenuItem.setSelection(ClientGUI.Resources.ACTIVE_CHIP_DIR
                  .equals(ClientGUI.Resources.FREE_CHIPS));
              pokerWikiaChipsMenuItem.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent evt) {
                  try {
                    ClientGUI.setActiveChipsStyle(ClientGUI.Resources.FREE_CHIPS);
                  } catch (FileNotFoundException e) {
                    logger.error("Could not change chip style", e);
                  }
                }
              });
            }
          }
        }

        {
          helpMenuItem = new MenuItem(menu1, SWT.CASCADE);
          helpMenuItem.setText("Help");
          {
            helpMenu = new Menu(helpMenuItem);
            {
              contentsMenuItem = new MenuItem(helpMenu, SWT.CASCADE);
              contentsMenuItem.setText("Contents");
            }
            {
              aboutMenuItem = new MenuItem(helpMenu, SWT.CASCADE);
              aboutMenuItem.setText("About");
              aboutMenuItem.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent evt) {
View Full Code Here

      // has this type sub types ?
      // yes
      if (childs.size() != 0) {

        if (isParentIncluded) {
          MenuItem  subMenuItem = new MenuItem(parentMenu, SWT.CASCADE);
          subMenuItem.setText(parentType.getShortName());

          newSubMenu = new Menu(subMenuItem);
          subMenuItem.setMenu(newSubMenu);
        }
        else {
          newSubMenu = parentMenu;
        }
View Full Code Here

      super(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION), typeSystem);
    }

    @Override
    protected void insertAction(final Type type, Menu parentMenu) {
      MenuItem actionItem = new MenuItem(parentMenu, SWT.PUSH);
      actionItem.setText(type.getShortName());

      actionItem.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event e) {

          IAction actionToExecute = new ChangeModeAction(type, type.getShortName(),
                  AnnotationEditor.this);
View Full Code Here

      }
    }

    @Override
    protected void insertAction(final Type type, Menu parentMenu) {
      final MenuItem actionItem = new MenuItem(parentMenu, SWT.CHECK);
      actionItem.setText(type.getShortName());

      if (getAnnotationMode().equals(type)) {
        actionItem.setSelection(true);
      }
     
      if (mTypesToDisplay.contains(type)) {
        actionItem.setSelection(true);
      }

      // TODO: move this to an action
      // do not access mTypesToDisplay directly !!!
      actionItem.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event e) {
          if (actionItem.getSelection()) {
            mTypesToDisplay.add(type);

          } else {
            mTypesToDisplay.remove(type);
          }
View Full Code Here

public class IvyMenuSeparator extends ContributionItem {

    public void fill(Menu menu, int index) {
        if (index >= 0) {
            new MenuItem(menu, SWT.SEPARATOR, index);
        } else {
            new MenuItem(menu, SWT.SEPARATOR);
        }
    }
View Full Code Here

            setId( factory.getId() );
            this.factory = factory;
        }
        @Override
        public void fill(Menu menu, int index) {
            MenuItem item = new MenuItem( menu, SWT.RADIO, index );
           
            item.setText( factory.getDisplayName() );
            item.setData( factory.getId() );
            item.setSelection( factory.getId().equals( viewerId ) );
            item.addSelectionListener( menuListener );
           
            int score = factory.score( getInput(), getExpression() );
           
            if( Appropriate.valueOf(score) == Appropriate.NOT_APPROPRIATE ){
                item.setEnabled(false);
            }
        }
View Full Code Here

        public ItemSelectionListener(final DropDownMenuWithDefaultAction dropDownMenu) {
            this.dropDownMenu = dropDownMenu;
        }

        public void widgetDefaultSelected(final SelectionEvent e) {
            final MenuItem menuItem = (MenuItem) e.getSource();
            if ( menuItem.getData() instanceof ActionContributionItem ) {
                final ActionContributionItem item = (ActionContributionItem) menuItem.getData();
                this.dropDownMenu.setAction( item.getAction() );
            }
        }
View Full Code Here

                this.dropDownMenu.setAction( item.getAction() );
            }
        }

        public void widgetSelected(final SelectionEvent e) {
            final MenuItem menuItem = (MenuItem) e.getSource();
            if ( menuItem.getData() instanceof ActionContributionItem ) {
                final ActionContributionItem item = (ActionContributionItem) menuItem.getData();
                this.dropDownMenu.setAction( item.getAction() );
            }
        }
View Full Code Here

        this.menu = menu;
    }

    private void addDTWizard(Menu menu,
                             final Shell shell) {
        MenuItem dsl = new MenuItem( menu,
                                     SWT.NONE );
        dsl.setText( "New Decision Table" );
        dsl.addSelectionListener( new SelectionListener() {

            public void widgetSelected(SelectionEvent e) {
                NewDTFileWizard wizard = new NewDTFileWizard();
                launchWizard( shell, wizard );
            }
View Full Code Here

TOP

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

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.