Beispiel #1
0
 public ShellMenu(final Matcher<String>... matchers) {
   this.matchers = matchers;
   setMacOsMenuProperties();
   if (!isSubmenuOfMacEclipseMenu) {
     MenuLookup ml = new MenuLookup();
     menuItem = ml.lookFor(ml.getActiveShellTopMenuItems(), matchers);
   }
 }
Beispiel #2
0
 @Override
 public boolean isSelected() {
   MenuLookup l = new MenuLookup();
   if (menuItem != null) {
     return l.isSelected(menuItem);
   } else {
     return false;
   }
 }
Beispiel #3
0
 @Override
 public String getText() {
   if (!isSubmenuOfMacEclipseMenu) {
     MenuLookup ml = new MenuLookup();
     MenuItem i = ml.lookFor(ml.getActiveShellTopMenuItems(), matchers);
     String text = ml.getMenuItemText(i);
     return text;
   } else {
     return "&" + macEclipseMenuCommand.text;
   }
 }
Beispiel #4
0
 @Override
 public void select() {
   if (!isSubmenuOfMacEclipseMenu) {
     MenuLookup ml = new MenuLookup();
     ml.select(menuItem);
   } else {
     if (macEclipseMenuCommand.equals(MacEclipseMenuCommand.PREFERENCES)) {
       openPreferencesDialog();
     } else if (macEclipseMenuCommand.equals(MacEclipseMenuCommand.ABOUT)) {
       openAboutDialog();
     } else {
       throw new SWTLayerException(
           "Unsupported Mac Eclispe menu command: " + macEclipseMenuCommand);
     }
   }
 }