Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Menu


      return null;
  }
   */

  private void createMenu() {
    _menu = new Menu(_tree.getShell(), SWT.POP_UP);

    MenuItem item = new MenuItem(_menu, SWT.PUSH);
    item.addListener(SWT.Selection, getXMLListener());
    item.setText(TreeMenu.EDIT_XML);

View Full Code Here


    listener.loadMessages();
    listener.loadJobTitels();
    listener.loadHolidaysTitel();
    Options.loadWindow(sShell, "editor");

    menuBar = new Menu(sShell, SWT.BAR);
    MenuItem submenuItem2 = new MenuItem(menuBar, SWT.CASCADE);
    submenuItem2.setText("&File");
    mFile = new Menu(submenuItem2);

    MenuItem open = new MenuItem(mFile, SWT.PUSH);
    open.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        if (container.openQuick() != null)
          setSaveStatus();
      }
    });
    open.setText("Open                                  \tCtrl+O");
    open.setAccelerator(SWT.CTRL | 'O');

    MenuItem mNew = new MenuItem(mFile, SWT.CASCADE);       
    mNew.setText("New                           ");


    Menu pmNew = new Menu(mNew);
    MenuItem pNew = new MenuItem(pmNew, SWT.PUSH);
    pNew.setText("Configuration                  \tCtrl+I");
    pNew.setAccelerator(SWT.CTRL | 'I');
    pNew.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newScheduler() != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });
    mNew.setMenu(pmNew);

    MenuItem push1 = new MenuItem(pmNew, SWT.PUSH);
    push1.setText("Documentation            \tCtrl+P"); // Generated
    push1.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newDocumentation() != null)
          setSaveStatus();
      }


      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    //new event handler
    MenuItem pNewActions = new MenuItem(pmNew, SWT.PUSH);
    pNewActions.setText("Event Handler \tCTRL+X");
    pNewActions.setAccelerator(SWT.CTRL | 'X');
    pNewActions.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newActions() != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });


    MenuItem mpLife = new MenuItem(pmNew, SWT.CASCADE);       
    mpLife.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
      }
    });
    mpLife.setText("Hot Folder Element   \tCtrl+L");
    mpLife.setAccelerator(SWT.CTRL | 'L');

    Menu mLife = new Menu(mpLife);
    MenuItem mLifeJob = new MenuItem(mLife, SWT.PUSH);
    mLifeJob.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {

        if (container.newScheduler(SchedulerDom.LIFE_JOB) != null)
          setSaveStatus();
      }
    });
    mLifeJob.setText("Job           \tCtrl+J");
    mLifeJob.setAccelerator(SWT.CTRL | 'J');
    mpLife.setMenu(mLife);

    MenuItem mLifeJobChain = new MenuItem(mLife, SWT.PUSH);
    mLifeJobChain.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_JOB_CHAIN) != null)
          setSaveStatus();
      }
    });
    mLifeJobChain.setText("Job Chain     \tCtrl+K");
    mLifeJobChain.setAccelerator(SWT.CTRL | 'K');

    MenuItem mLifeProcessClass = new MenuItem(mLife, SWT.PUSH);
    mLifeProcessClass.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_PROCESS_CLASS) != null)
          setSaveStatus();
      }
    });
    mLifeProcessClass.setText("Process Class \tCtrl+R");
    mLifeProcessClass.setAccelerator(SWT.CTRL | 'R');

    MenuItem mLifeLock = new MenuItem(mLife, SWT.PUSH);
    mLifeLock.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_LOCK) != null)
          setSaveStatus();
      }
    });
    mLifeLock.setText("Lock          \tCtrl+M");
    mLifeLock.setAccelerator(SWT.CTRL | 'M');

    MenuItem mLifeOrder= new MenuItem(mLife, SWT.PUSH);
    mLifeOrder.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_ORDER) != null)
          setSaveStatus();
      }
    });
    mLifeOrder.setText("Order         \tCtrl+W");
    mLifeOrder.setAccelerator(SWT.CTRL | 'W');

    MenuItem mLifeSchedule= new MenuItem(mLife, SWT.PUSH);
    mLifeSchedule.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_SCHEDULE) != null)
          setSaveStatus();
      }
    });
    mLifeSchedule.setText("Schedule      \tCtrl+K");
    mLifeSchedule.setAccelerator(SWT.CTRL | 'K');

    new MenuItem(mFile, SWT.SEPARATOR);

    MenuItem openDir = new MenuItem(mFile, SWT.PUSH);
    openDir.setText("Open Hot Folder               \tCtrl+D");   
    openDir.setAccelerator(SWT.CTRL | 'D');
    openDir.setEnabled(true);
    openDir.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.openDirectory(null) != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    //open remote configuration
    MenuItem mORC = new MenuItem(mFile, SWT.CASCADE);
    mORC.setText("Open Remote Configuration");

    Menu pMOpenGlobalScheduler = new Menu(mORC);

    MenuItem pOpenGlobalScheduler = new MenuItem(pMOpenGlobalScheduler, SWT.PUSH);
    pOpenGlobalScheduler.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        Utils.startCursor(getSShell());
        String globalSchedulerPath = Options.getSchedulerData().endsWith("/") || Options.getSchedulerData().endsWith("\\") ? Options.getSchedulerData() : Options.getSchedulerData() + "/";
        globalSchedulerPath = globalSchedulerPath + "config/remote/_all";
        File f = new java.io.File(globalSchedulerPath);
        if(!f.exists()) {
          if(!f.mkdirs()) {           
            MainWindow.message("could not create Global Scheduler Configurations: " + globalSchedulerPath, SWT.ICON_WARNING);
            Utils.stopCursor(getSShell());
            return;
          }
        }

        if (container.openDirectory(globalSchedulerPath) != null)
          setSaveStatus();
        Utils.stopCursor(getSShell());
      }
    });
    pOpenGlobalScheduler.setText("Open Global Scheduler")

    MenuItem pOpenSchedulerCluster = new MenuItem(pMOpenGlobalScheduler, SWT.PUSH);
    pOpenSchedulerCluster.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        HotFolderDialog dialog = new HotFolderDialog();
        dialog.showForm(HotFolderDialog.SCHEDULER_CLUSTER);
      }
    });
    pOpenSchedulerCluster.setText("Open Cluster Configuration");


    MenuItem pOpenSchedulerHost = new MenuItem(pMOpenGlobalScheduler, SWT.PUSH);
    pOpenSchedulerHost.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        HotFolderDialog dialog = new HotFolderDialog();
        dialog.showForm(HotFolderDialog.SCHEDULER_HOST);
      }
    });
    pOpenSchedulerHost.setText("Open Remote Scheduler Configuration");


    mORC.setMenu(pMOpenGlobalScheduler);

    new MenuItem(mFile, SWT.SEPARATOR);

    MenuItem pSaveFile = new MenuItem(mFile, SWT.PUSH);
    pSaveFile.setText("Save                                    \tCtrl+S");
    pSaveFile.setAccelerator(SWT.CTRL | 'S');
    pSaveFile.setEnabled(false);
    pSaveFile.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        save();       
      }

      @Override
      public void widgetDefaultSelected(SelectionEvent arg0) {
       
      }
   
    });
    MenuItem pSaveAs = new MenuItem(mFile, SWT.PUSH);
    pSaveAs.setText("Save As                            ");   
    pSaveAs.setEnabled(false);
    pSaveAs.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.getCurrentEditor() != null && container.getCurrentEditor().applyChanges()) {
          if(container.getCurrentTab().getData("ftp_title") != null) {
            container.getCurrentTab().setData("ftp_title", null);
            container.getCurrentTab().setData("ftp_profile_name", null);
            container.getCurrentTab().setData("ftp_remote_directory", null);
            container.getCurrentTab().setData("ftp_hot_folder_elements", null);
            container.getCurrentTab().setData("ftp_profile", null);
          }
          container.getCurrentEditor().saveAs();
          setSaveStatus();
        }
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem pSaveAsHotFolderElement = new MenuItem(mFile, SWT.PUSH);
    pSaveAsHotFolderElement.setText("Save As Hot Folder Elements   \tCtrl+B");   
    pSaveAsHotFolderElement.setAccelerator(SWT.CTRL | 'B');
    pSaveAsHotFolderElement.setEnabled(false);
    pSaveAsHotFolderElement.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {

        if (container.getCurrentEditor() != null && container.getCurrentEditor().applyChanges()) {
          SchedulerForm form =(SchedulerForm)container.getCurrentEditor();
          SchedulerDom currdom = (SchedulerDom)form.getDom();
          if(IOUtils.saveDirectory(currdom, true, SchedulerDom.DIRECTORY, null, container)) {
            Element root = currdom.getRoot();
            if(root != null) {
              Element config = root.getChild("config");
              if(config != null) {
                config.removeChildren("jobs");               
                config.removeChildren("job_chains");
                config.removeChildren("locks");
                Utils.removeChildrensWithName(config, "process_classes");
                config.removeChildren("schedules");
                config.removeChildren("commands");
                form.updateTree("main");
                form.update();
              }
            }
          }
          container.getCurrentEditor().save();
          setSaveStatus();
        }
      }

      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });


    new MenuItem(mFile, SWT.SEPARATOR);

    //    FTP
    MenuItem mFTP = new MenuItem(mFile, SWT.CASCADE);       
    mFTP.setText("FTP");
    Menu pmFTP = new Menu(mNew);

    MenuItem pOpenFTP = new MenuItem(pmFTP, SWT.PUSH);
    pOpenFTP.setText("Open By FTP");

    pOpenFTP.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { 
        FTPDialog ftp = new FTPDialog(main);
        ftp.showForm(FTPDialog.OPEN);
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem pOpenHotFolderFTP = new MenuItem(pmFTP, SWT.PUSH);
    pOpenHotFolderFTP.setText("Open Hot Folder By FTP");
    pOpenHotFolderFTP.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { 
        FTPDialog ftp = new FTPDialog(main);
        ftp.showForm(FTPDialog.OPEN_HOT_FOLDER);
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    new MenuItem(pmFTP, SWT.SEPARATOR);

    MenuItem pSaveFTP = new MenuItem(pmFTP, SWT.PUSH);
    pSaveFTP.setText("Save By FTP");

    pSaveFTP.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {       
        saveByFTP();       
      }

      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    mFTP.setMenu(pmFTP);
    new MenuItem(mFile, SWT.SEPARATOR);

    //    WebDav   
    boolean existwebDavLib = existLibraries();
    MenuItem mWebDav = new MenuItem(mFile, SWT.CASCADE);       
    mWebDav.setText("WebDav");
    mWebDav.setAccelerator(SWT.CTRL | 'N');
    mWebDav.setEnabled(existwebDavLib);
    Menu pmWebDav = new Menu(mNew);

    MenuItem pOpenWebDav = new MenuItem(pmWebDav, SWT.PUSH);
    pOpenWebDav.setText("Open By WebDav");
    pOpenWebDav.setEnabled(existwebDavLib);
    pOpenWebDav.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        try {
          if(existLibraries()) {
            WebDavDialog webdav = new WebDavDialog();
            webdav.showForm(WebDavDialog.OPEN);
          }
        } catch(Exception ex) {
          try {
            new sos.scheduler.editor.app.ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() + " ; could not open file on Webdav Server", ex);
          } catch(Exception ee) {
            //tu nichts
          }
          MainWindow.message("could not open file on Webdav Server, cause: "  + ex.getMessage(), SWT.ICON_WARNING);

        }
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem pOpenHotFolderWebDav = new MenuItem(pmWebDav, SWT.PUSH);
    pOpenHotFolderWebDav.setText("Open Hot Folder By WebDav");
    pOpenHotFolderWebDav.setEnabled(existwebDavLib);
    pOpenHotFolderWebDav.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if(existLibraries()) {
          WebDavDialog webdav = new WebDavDialog();
          webdav.showForm(WebDavDialog.OPEN_HOT_FOLDER);
        }
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    new MenuItem(pmWebDav, SWT.SEPARATOR);

    MenuItem pSaveWebDav = new MenuItem(pmWebDav, SWT.PUSH);
    pSaveWebDav.setText("Save By WebDav");
    pSaveWebDav.setEnabled(existwebDavLib);
    pSaveWebDav.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { 
        if(existLibraries()) {

          WebDavDialog webdav = new WebDavDialog();
          DomParser currdom = getSpecifiedDom();
          if(currdom == null)
            return;

          if( currdom instanceof SchedulerDom && ((SchedulerDom)currdom).isDirectory()) {       
            webdav.showForm(WebDavDialog.SAVE_AS_HOT_FOLDER);
          } else
            webdav.showForm(WebDavDialog.SAVE_AS);
        }
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    mWebDav.setMenu(pmWebDav);
    new MenuItem(mFile, SWT.SEPARATOR);

    submenuItem2.setMenu(mFile);
    MenuItem pExit = new MenuItem(mFile, SWT.PUSH);
    pExit.setText("Exit\tCtrl+E");
    pExit.setAccelerator(SWT.CTRL | 'E');
    pExit.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        try {
          sShell.close();
        } catch(Exception es) {
          try {
            new ErrorLog("error: " + sos.util.SOSClassUtil.getMethodName(), es);
          } catch (Exception ee){
            //tu nichts
          }
        }

      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem submenuItem = new MenuItem(menuBar, SWT.CASCADE);
    submenuItem.setText("Options");
    MenuItem submenuItem3 = new MenuItem(menuBar, SWT.CASCADE);
    submenuItem3.setText("&Help");
    submenu1 = new Menu(submenuItem3);

    MenuItem pHelS = new MenuItem(submenu1, SWT.PUSH);
    pHelS.setText("Scheduler Editor Help");   
    pHelS.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {       
        listener.openHelp(Options.getHelpURL("index"));       
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem pHelp = new MenuItem(submenu1, SWT.PUSH);
    pHelp.setText("Help\tF1");   
    pHelp.setAccelerator(SWT.F1);
    pHelp.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.getCurrentEditor() != null) {
          listener.openHelp(container.getCurrentEditor().getHelpKey());         
        }else {
          String msg = "Help is available after documentation or configuration is opened";
          MainWindow.message(msg, SWT.ICON_INFORMATION);
        }
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem pAbout = new MenuItem(submenu1, SWT.PUSH);
    pAbout.setText("About");
    pAbout.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        listener.showAbout();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });
    submenuItem3.setMenu(submenu1);
    submenu = new Menu(submenuItem);
    MenuItem submenuItem1 = new MenuItem(submenu, SWT.CASCADE);
    submenuItem1.setText("Help Language");
    menuLanguages = new Menu(submenuItem1);

    // create languages menu
    listener.setLanguages(menuLanguages);

    submenuItem1.setMenu(menuLanguages);
View Full Code Here

    final ToolBar toolBar = new ToolBar(groupmain, SWT.NONE);
    toolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.FILL, true, false));
    final ToolItem butNew = new ToolItem(toolBar, SWT.NONE);
    butNew.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_new.gif"))
    final Menu menu = new Menu(toolBar);
    butNew.setToolTipText("New Configuration");
    MenuItem itemConfig = new MenuItem(menu, SWT.PUSH);
    itemConfig.setText("Configuration");
    itemConfig.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newScheduler() != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });
    MenuItem itemDoc = new MenuItem(menu, SWT.PUSH);
    itemDoc.setText("Documentation");
    itemDoc.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newDocumentation() != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    /*MenuItem itemDetails = new MenuItem(menu, SWT.PUSH);
    itemDetails.setText("Details");
    itemDetails.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newDetails() != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });
     */
    MenuItem itemActions = new MenuItem(menu, SWT.PUSH);
    itemActions.setText("Event Handler");
    itemActions.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newActions() != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem itemHFEJob = new MenuItem(menu, SWT.PUSH);
    itemHFEJob.setText("Hot Folder Element - Job");
    itemHFEJob.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_JOB) != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem itemHFEJobChain = new MenuItem(menu, SWT.PUSH);
    itemHFEJobChain.setText("Hot Folder Element - Job Chain");
    itemHFEJobChain.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_JOB_CHAIN) != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem itemHFEProcessClass = new MenuItem(menu, SWT.PUSH);
    itemHFEProcessClass.setText("Hot Folder Element - Process Class");
    itemHFEProcessClass.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_PROCESS_CLASS) != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem itemHFELock = new MenuItem(menu, SWT.PUSH);
    itemHFELock.setText("Hot Folder Element - Lock");
    itemHFELock.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_LOCK) != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem itemHFEOrder = new MenuItem(menu, SWT.PUSH);
    itemHFEOrder.setText("Hot Folder Element - Order");
    itemHFEOrder.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_ORDER) != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });

    MenuItem itemHFEScheduler = new MenuItem(menu, SWT.PUSH);
    itemHFEScheduler.setText("Hot Folder Element - Schedule");
    itemHFEScheduler.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (container.newScheduler(SchedulerDom.LIFE_SCHEDULE) != null)
          setSaveStatus();
      }
      public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
      }
    });
    addDropDown(butNew, menu);

    final ToolItem butOpen = new ToolItem(toolBar, SWT.PUSH);
    butOpen.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        if (container.openQuick() != null)
          setSaveStatus();
      }
    });
    butOpen.setImage(ResourceManager
        .getImageFromResource("/sos/scheduler/editor/icon_open.gif"));
    butOpen.setToolTipText("Open Configuration File");


    final ToolItem butOpenHotFolder = new ToolItem(toolBar, SWT.PUSH);
    butOpenHotFolder.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        if (container.openDirectory(null) != null)
          setSaveStatus();
      }
    });
    butOpenHotFolder.setImage(ResourceManager
        .getImageFromResource("/sos/scheduler/editor/icon_open_hot_folder.gif"));
    butOpenHotFolder.setToolTipText("Open Hot Folder");


    butSave = new ToolItem(toolBar, SWT.PUSH);
    butSave.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(final SelectionEvent e) {
        save();
      }
    });
    butSave.setImage(ResourceManager
        .getImageFromResource("/sos/scheduler/editor/save.gif"))
    butSave.setToolTipText("Save Configuration");

    butShowAsSML = new ToolItem(toolBar, SWT.PUSH);
    butShowAsSML.setEnabled(container != null && container.getCurrentEditor() instanceof SchedulerForm);
    butShowAsSML.addSelectionListener(new SelectionAdapter() {     
      public void widgetSelected(final SelectionEvent e) {
        try {
          if(container.getCurrentEditor()== null)
            return;
          DomParser currDomParser = getSpecifiedDom();       
          Utils.showClipboard(Utils.getElementAsString(currDomParser.getRoot()), getSShell(), false, null, false, null, false);
        } catch (Exception ex) {
          try {
            new ErrorLog("error in " + sos.util.SOSClassUtil.getMethodName() + " cause: " + ex.toString(), ex);
          } catch(Exception ee) {
            //tu nichts
          }
        }
      }
    });
    butShowAsSML.setImage(ResourceManager
        .getImageFromResource("/sos/scheduler/editor/icon_view_as_xml.gif"))
    butShowAsSML.setToolTipText("Show Configuration as XML");

    final ToolItem butFTP = new ToolItem(toolBar, SWT.NONE);

    final Menu menuFTP = new Menu(toolBar);
    addDropDown(butFTP, menuFTP);

    butFTP.setImage(ResourceManager.getImageFromResource("/sos/scheduler/editor/icon_open_ftp.gif"))
    butFTP.setToolTipText("FTP");

View Full Code Here

    return mb.open();
  }


  private void createMenu() {
    _menu = new Menu(_combo.getShell(), SWT.POP_UP);

    MenuItem item = new MenuItem(_menu, SWT.PUSH);
    item.addListener(SWT.Selection, getListener());

View Full Code Here

        menuMgr.addMenuListener(new IMenuListener() {
            public void menuAboutToShow(IMenuManager mgr) {
                fillDetailContextMenu(mgr);
            }
        });
        Menu menu = menuMgr.createContextMenu(menuControl);
        menuControl.setMenu(menu);

        // register the context menu such that other plugins may contribute to
        // it
        getSite().registerContextMenu(
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
     */
    public Menu getMenu( Control parent )
    {
        menu = new Menu( parent );

        // Previous searches
        String[] previousSearches = SearchPage.loadSearchStringHistory();
        for ( final String search : previousSearches )
        {
View Full Code Here

   */
  public SWTBotMenu menu(final String menuName) throws WidgetNotFoundException {
    final Matcher<? extends Widget> matcher = withMnemonic(menuName);
    MenuItem menuItem = syncExec(new WidgetResult<MenuItem>() {
      public MenuItem run() {
        Menu bar = widget.getMenu();
        Matcher<MenuItem> withMnemonic = withMnemonic(menuName);
        List<MenuItem> menus = new MenuFinder().findMenus(bar, withMnemonic, true);
        if (!menus.isEmpty())
          return menus.get(0);
        return null;
View Full Code Here

        // Creating the 'Menu' ToolBar item
        final ToolItem leftMenuToolItem = new ToolItem( leftToolBar, SWT.PUSH );
        leftMenuToolItem.setImage( Activator.getDefault().getImage( PluginConstants.IMG_TOOLBAR_MENU ) );
        leftMenuToolItem.setToolTipText( Messages.getString( "DifferencesWidget.MenuToolTip" ) ); //$NON-NLS-1$
        // Creating the associated Menu
        final Menu leftMenu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP );
        // Adding the action to display the Menu when the item is clicked
        leftMenuToolItem.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent event )
            {
                Rectangle rect = leftMenuToolItem.getBounds();
                Point pt = new Point( rect.x, rect.y + rect.height );
                pt = leftToolBar.toDisplay( pt );
                leftMenu.setLocation( pt.x, pt.y );
                leftMenu.setVisible( true );
            }
        } );
        // Adding the 'Sorting...' MenuItem
        MenuItem sortingMenuItem = new MenuItem( leftMenu, SWT.PUSH );
        sortingMenuItem.setText( Messages.getString( "DifferencesWidget.Sorting" ) ); //$NON-NLS-1$
        sortingMenuItem.setImage( Activator.getDefault().getImage( PluginConstants.IMG_SORTING ) );
        sortingMenuItem.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent arg0 )
            {
                new OpenSchemaViewSortingDialogAction().run();
            }
        } );
        // Adding the 'Separator' MenuItem
        new MenuItem( leftMenu, SWT.SEPARATOR );
        // Adding the 'Preferences...' MenuItem
        MenuItem preferencesMenuItem = new MenuItem( leftMenu, SWT.PUSH );
        preferencesMenuItem.setText( Messages.getString( "DifferencesWidget.Preferences" ) ); //$NON-NLS-1$
        preferencesMenuItem.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent arg0 )
            {
                new OpenSchemaViewPreferenceAction().run();
            }
        } );

        // TreeViewer
        treeViewer = new TreeViewer( leftComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER );
        GridData gridData = new GridData( SWT.FILL, SWT.FILL, true, true );
        gridData.heightHint = 250;
        treeViewer.getTree().setLayoutData( gridData );
        treeViewer.setContentProvider( new DifferencesWidgetSchemaContentProvider() );
        treeViewer.setLabelProvider( new DifferencesWidgetSchemaLabelProvider() );
        treeViewer.addSelectionChangedListener( new ISelectionChangedListener()
        {
            public void selectionChanged( SelectionChangedEvent event )
            {
                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
                Object element = selection.getFirstElement();
                if ( element instanceof AttributeTypeDifference )
                {
                    AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
                    if ( atd.getType().equals( DifferenceType.MODIFIED ) )
                    {
                        tableViewer.setInput( atd.getDifferences() );
                        return;
                    }
                }
                else if ( element instanceof ObjectClassDifference )
                {
                    ObjectClassDifference ocd = ( ObjectClassDifference ) element;
                    if ( ocd.getType().equals( DifferenceType.MODIFIED ) )
                    {
                        tableViewer.setInput( ocd.getDifferences() );
                        return;
                    }
                }

                // Default
                tableViewer.setInput( null );
            }
        } );
        treeViewer.addDoubleClickListener( new IDoubleClickListener()
        {
            public void doubleClick( DoubleClickEvent event )
            {
                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
                Object element = selection.getFirstElement();
                if ( ( element instanceof Folder ) || ( element instanceof SchemaDifference ) )
                {
                    treeViewer.setExpandedState( element, !treeViewer.getExpandedState( element ) );
                }
            }
        } );

        // Right Composite
        Composite rightComposite = new Composite( composite, SWT.NONE );
        gridLayout = new GridLayout();
        gridLayout.marginBottom = 0;
        gridLayout.marginHeight = 0;
        gridLayout.marginLeft = 0;
        gridLayout.marginRight = 0;
        gridLayout.marginTop = 0;
        gridLayout.marginWidth = 0;
        rightComposite.setLayout( gridLayout );
        rightComposite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );

        // ToolBar
        final ToolBar rightToolBar = new ToolBar( rightComposite, SWT.HORIZONTAL | SWT.FLAT );
        rightToolBar.setLayoutData( new GridData( SWT.RIGHT, SWT.NONE, false, false ) );
        // Creating the 'Menu' ToolBar item
        final ToolItem rightMenuToolItem = new ToolItem( rightToolBar, SWT.PUSH );
        rightMenuToolItem.setImage( Activator.getDefault().getImage( PluginConstants.IMG_TOOLBAR_MENU ) );
        rightMenuToolItem.setToolTipText( Messages.getString( "DifferencesWidget.MenuToolTip" ) ); //$NON-NLS-1$
        // Creating the associated Menu
        final Menu rightMenu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP );
        // Adding the action to display the Menu when the item is clicked
        rightMenuToolItem.addSelectionListener( new SelectionAdapter()
        {
            public void widgetSelected( SelectionEvent event )
            {
                Rectangle rect = rightMenuToolItem.getBounds();
                Point pt = new Point( rect.x, rect.y + rect.height );
                pt = rightToolBar.toDisplay( pt );
                rightMenu.setLocation( pt.x, pt.y );
                rightMenu.setVisible( true );
            }
        } );
        // Adding the 'Group By Property' MenuItem
        groupByProperty = new MenuItem( rightMenu, SWT.CHECK );
        groupByProperty.setText( Messages.getString( "DifferencesWidget.GroupByProperty" ) ); //$NON-NLS-1$
View Full Code Here

        addBundlesAction.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "/icons/brick_add.png"));
    }

    void createContextMenu() {
        MenuManager mgr = new MenuManager();
        Menu menu = mgr.createContextMenu(viewer.getControl());
        viewer.getControl().setMenu(menu);
        mgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
        getSite().registerContextMenu(mgr, viewer);

        mgr.addMenuListener(new IMenuListener() {
View Full Code Here

    public IMenuManager getContextMenuManager( TreeViewer viewer )
    {
        if ( this.contextMenuManager == null )
        {
            this.contextMenuManager = new MenuManager();
            Menu menu = this.contextMenuManager.createContextMenu( viewer.getControl() );
            viewer.getControl().setMenu( menu );
        }
        return this.contextMenuManager;
    }
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.