Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.68 KB | None | 0 0
  1.     private ToolBar tb;
  2.     private ToolItem itemDropDown;
  3.    
  4.     @Override
  5.     public void addToolItem(final ToolBar tb) {
  6.         this.tb = tb;
  7.         itemDropDown = new ToolItem(tb, SWT.PUSH);
  8.         itemDropDown.setToolTipText("SoulWars Settings");
  9.         itemDropDown.setImage(new org.eclipse.swt.graphics.Image(tb.getDisplay(), "si.png"));
  10.         final org.eclipse.swt.widgets.Menu menu = new org.eclipse.swt.widgets.Menu(tb.getShell(), SWT.POP_UP);
  11.        
  12.         //Enter Stuff
  13.         MenuItem enterMode = new MenuItem(menu,SWT.CASCADE);
  14.         enterMode.setText("Enter Mode");
  15.         org.eclipse.swt.widgets.Menu enterMenu = new org.eclipse.swt.widgets.Menu(enterMode);
  16.         enterMode.setMenu(enterMenu);
  17.         new MenuItem(enterMenu,SWT.CHECK).setText("Join team with highest player level average");
  18.         new MenuItem(enterMenu,SWT.CHECK).setText("Join team with highest player level average (100+)");
  19.         new MenuItem(enterMenu,SWT.CHECK).setText("Join team with most players");
  20.         new MenuItem(enterMenu,SWT.CHECK).setText("Join using balance portal");
  21.         new MenuItem(enterMenu,SWT.CHECK).setText("Red team ONLY");
  22.         new MenuItem(enterMenu,SWT.CHECK).setText("Blue team ONLY");
  23.         new MenuItem(enterMenu,SWT.CHECK).setText("Last Lost");
  24.         new MenuItem(enterMenu,SWT.CHECK).setText("Clan Chat");
  25.         new MenuItem(enterMenu,SWT.CHECK).setText("Highest Clan Member Count");
  26.         new MenuItem(enterMenu,SWT.CHECK).setText("Last Won");
  27.         new MenuItem(enterMenu,SWT.CHECK).setText("Most Summoning Monsters");
  28.        
  29.         //Activity Mode Stuff
  30.         MenuItem activityMode = new MenuItem(menu,SWT.CASCADE);
  31.         activityMode.setText("Activity Mode");
  32.         org.eclipse.swt.widgets.Menu activityMenu = new org.eclipse.swt.widgets.Menu(activityMode);
  33.         activityMode.setMenu(activityMenu);
  34.         new MenuItem(activityMenu,SWT.CHECK).setText("Attack Players");
  35.         new MenuItem(activityMenu,SWT.CHECK).setText("Bandage Players");
  36.         new MenuItem(activityMenu,SWT.CHECK).setText("Attack Pyrefiends");
  37.         new MenuItem(activityMenu,SWT.CHECK).setText("Attack Jellies");
  38.        
  39.         //Misc Stuff
  40.         MenuItem otherOptions = new MenuItem(menu,SWT.CASCADE);
  41.         otherOptions.setText("Other Options");
  42.         org.eclipse.swt.widgets.Menu otherMenu = new org.eclipse.swt.widgets.Menu(otherOptions);
  43.         otherOptions.setMenu(otherMenu);
  44.         new MenuItem(otherMenu,SWT.CHECK).setText("Quick-Prayer");
  45.         new MenuItem(otherMenu,SWT.CHECK).setText("Walk To Random Tile In Waiting Room");
  46.         new MenuItem(otherMenu,SWT.CHECK).setText("Timed Switch Team");
  47.         new MenuItem(otherMenu,SWT.CHECK).setText("Use Special Attack With Wielded Weapon");
  48.         new MenuItem(otherMenu,SWT.CHECK).setText("Use Special Attack With Weapon In First Inventory Slot");
  49.        
  50.         itemDropDown.addListener(SWT.Selection, new org.eclipse.swt.widgets.Listener() {
  51.  
  52.             public void handleEvent(Event event) {
  53.                 org.eclipse.swt.graphics.Rectangle bounds = itemDropDown.getBounds();
  54.                 org.eclipse.swt.graphics.Point point = tb.toDisplay(bounds.x, bounds.y + bounds.height);
  55.                 menu.setLocation(point);
  56.                 menu.setVisible(true);
  57.             }
  58.         });
  59.        
  60.         org.eclipse.swt.graphics.Point oldSize = tb.getShell().getSize();
  61.         tb.getShell().pack(false);
  62.         tb.getShell().setSize(oldSize);
  63.     }
  64.  
  65.     @Override
  66.     public void removeToolItem() {
  67.         itemDropDown.dispose();
  68.         org.eclipse.swt.graphics.Point oldSize = tb.getShell().getSize();
  69.         tb.getShell().pack(false);
  70.         tb.getShell().setSize(oldSize);
  71.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement