@Override
  public void buildContextMenu(IMenuManager menu) {
    GEFActionConstants.addStandardActionGroups(menu);

    //      menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(EditAction.ID));
    menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.UNDO.getId()));
    menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.REDO.getId()));
    menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.DELETE.getId()));
    menu.appendToGroup(GEFActionConstants.GROUP_PRINT, getAction(ActionFactory.PRINT.getId()));
    menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.IMPORT.getId()));
    menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.EXPORT.getId()));
  }
  /** @generated */
  protected void fillCoolBar(ICoolBarManager toolBar) {
    IMenuManager popUpMenu = new MenuManager();
    popUpMenu.add(new ActionContributionItem(lockToolBarAction));
    popUpMenu.add(new ActionContributionItem(toggleCoolbarAction));
    toolBar.setContextMenuManager(popUpMenu);

    toolBar.add(new GroupMarker("group.file"));

    {
      IToolBarManager toolBarX = new ToolBarManager();

      toolBarX.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP));

      toolBarX.add(getAction(ActionFactory.SAVE.getId()));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));

      toolBarX.add(getAction(ActionFactory.PRINT.getId()));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));

      // toolBarX.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
      toolBar.add(new ToolBarContributionItem(toolBarX, IWorkbenchActionConstants.TOOLBAR_FILE));
    }

    toolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

    toolBar.add(new GroupMarker("group.nav"));

    toolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR));

    toolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP));

    {
      IToolBarManager toolBarX = new ToolBarManager();

      toolBarX.add(new Separator(IWorkbenchActionConstants.GROUP_HELP));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
      toolBar.add(new ToolBarContributionItem(toolBarX, IWorkbenchActionConstants.TOOLBAR_HELP));
    }
  }
Exemplo n.º 3
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
   */
  @Override
  public void init(IViewSite site, IMemento memento) throws PartInitException {
    super.init(site, memento);

    this.memento = memento;
    this.preferenceStore = UIActivator.getDefault().getPreferenceStore();

    try {
      dialogSettings =
          UIActivator.getDefault()
              .getDialogSettings()
              .getSection(K_VIEWS)
              .getSection(site.getSecondaryId());
      uri = new URI(dialogSettings.get(K_URI));

      IRepositoryService repositoryService = UIActivator.getDefault().getRepositoryService();
      security = repositoryService.getSecurityFromURI(uri);

      String privateTemplate = dialogSettings.get(K_PRIVATE_TEMPLATE);
      if (privateTemplate != null) {
        template = unmarshal(privateTemplate);
      }

      if (template == null) {
        IPath templatePath = new Path("data"); // $NON-NLS-1$
        if (dialogSettings.get(K_TEMPLATE) != null) {
          templatePath = templatePath.append(dialogSettings.get(K_TEMPLATE));
        } else {
          templatePath = templatePath.append("basic-template.xml");
        }
        InputStream stream =
            FileLocator.openStream(UIActivator.getDefault().getBundle(), templatePath, false);
        template = unmarshal(stream);
      }
    } catch (Exception e) {
      Status status =
          new Status(
              IStatus.ERROR,
              UIActivator.PLUGIN_ID,
              Messages.ChartViewPart_LoadingErrorMessage + site.getSecondaryId(),
              e);
      UIActivator.getDefault().getLog().log(status);
    }

    site.setSelectionProvider(new SelectionProvider());

    createActions();
    createPeriodActions();

    IActionBars actionBars = site.getActionBars();

    IMenuManager menuManager = actionBars.getMenuManager();
    menuManager.add(new Separator("periods.top")); // $NON-NLS-1$
    menuManager.add(new Separator("periods")); // $NON-NLS-1$
    menuManager.add(new Separator("periods.bottom")); // $NON-NLS-1$
    menuManager.add(currentPriceLineAction);
    menuManager.add(currentBookAction);

    menuManager.appendToGroup("periods.top", periodAllAction); // $NON-NLS-1$
    if (periodActions != null) {
      for (int i = 0; i < periodActions.length; i++) {
        menuManager.appendToGroup("periods", periodActions[i]);
      }
    }

    IToolBarManager toolBarManager = actionBars.getToolBarManager();
    toolBarManager.add(new Separator("additions")); // $NON-NLS-1$
    toolBarManager.add(updateAction);

    TimeSpan periodTimeSpan = TimeSpan.fromString(dialogSettings.get(K_PERIOD));
    TimeSpan resolutionTimeSpan = TimeSpan.fromString(dialogSettings.get(K_RESOLUTION));
    setPeriodActionSelection(periodTimeSpan, resolutionTimeSpan);

    actionBars.setGlobalActionHandler(cutAction.getId(), cutAction);
    actionBars.setGlobalActionHandler(copyAction.getId(), copyAction);
    actionBars.setGlobalActionHandler(pasteAction.getId(), pasteAction);
    actionBars.setGlobalActionHandler(deleteAction.getId(), deleteAction);

    actionBars.setGlobalActionHandler(ActionFactory.PRINT.getId(), printAction);

    ToolAction toolAction =
        new ToolAction(
            Messages.ChartViewPart_LineAction, this, "org.eclipsetrader.ui.charts.tools.line");
    actionBars.setGlobalActionHandler(toolAction.getId(), toolAction);
    toolAction =
        new ToolAction(
            Messages.ChartViewPart_FiboLineAction,
            this,
            "org.eclipsetrader.ui.charts.tools.fiboline");
    actionBars.setGlobalActionHandler(toolAction.getId(), toolAction);
    toolAction =
        new ToolAction(
            Messages.ChartViewPart_FanLineAction,
            this,
            "org.eclipsetrader.ui.charts.tools.fanline");
    actionBars.setGlobalActionHandler(toolAction.getId(), toolAction);
    toolAction =
        new ToolAction(
            Messages.ChartViewPart_FiboArcAction,
            this,
            "org.eclipsetrader.ui.charts.tools.fiboarc");
    actionBars.setGlobalActionHandler(toolAction.getId(), toolAction);

    actionBars.setGlobalActionHandler(zoomInAction.getActionDefinitionId(), zoomInAction);
    actionBars.setGlobalActionHandler(zoomOutAction.getActionDefinitionId(), zoomOutAction);
    actionBars.setGlobalActionHandler(zoomResetAction.getActionDefinitionId(), zoomResetAction);
    actionBars.setGlobalActionHandler(propertiesAction.getId(), propertiesAction);
    actionBars.updateActionBars();
  }
  /** @generated NOT */
  protected void fillMenuBar(IMenuManager menu) {

    ContributionItemFactory.VIEWS_SHORTLIST.create(getWindow());

    {
      IMenuManager menuX =
          new MenuManager(Messages.ApplicationMenuName_File, IWorkbenchActionConstants.M_FILE);

      menuX.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));

      {
        IMenuManager menuXX = new MenuManager(Messages.ApplicationMenuName_New, "new");

        menuXX.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
        menuX.add(menuXX);
      }

      menuX.add(new Separator());

      menuX.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

      menuX.add(new Separator());

      menuX.add(getAction(ActionFactory.SAVE.getId()));

      menuX.add(getAction(ActionFactory.SAVE_AS.getId()));

      menuX.add(getAction(ActionFactory.SAVE_ALL.getId()));
      /*++ added*/
      menuX.add(new Separator());
      IMenuManager menuExport = new MenuManager("Export", "export");
      menuExport.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
      menuX.add(menuExport);
      menuX.add(getAction(ActionFactory.PRINT.getId()));

      menuX.add(new Separator());

      menuX.add(getAction(ActionFactory.QUIT.getId()));

      menuX.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
      menu.add(menuX);
    }

    {
      IMenuManager menuX =
          new MenuManager(Messages.ApplicationMenuName_Edit, IWorkbenchActionConstants.M_EDIT);

      menuX.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));

      menuX.add(getAction(ActionFactory.UNDO.getId()));

      menuX.add(getAction(ActionFactory.REDO.getId()));

      menuX.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));

      menuX.add(new Separator());

      menuX.add(getAction(ActionFactory.CUT.getId()));

      menuX.add(getAction(ActionFactory.COPY.getId()));

      menuX.add(getAction(ActionFactory.PASTE.getId()));

      menuX.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));

      menuX.add(new Separator());

      menuX.add(getAction(ActionFactory.DELETE.getId()));

      menuX.add(getAction(ActionFactory.SELECT_ALL.getId()));

      menuX.add(new Separator());

      menuX.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));

      menuX.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));

      menuX.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));

      menu.add(menuX);
    }

    // menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

    IMenuManager menuX =
        new MenuManager(Messages.ApplicationMenuName_Help, IWorkbenchActionConstants.M_HELP);

    menuX.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));

    menuX.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));

    menuX.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    menu.add(menuX);
  }
 /** @see org.eclipse.gef.ui.actions.ActionBarContributor#declareGlobalActionKeys() */
 @Override
 protected void declareGlobalActionKeys() {
   addGlobalActionKey(ActionFactory.PRINT.getId());
   addGlobalActionKey(ActionFactory.SELECT_ALL.getId());
   addGlobalActionKey(ActionFactory.PASTE.getId());
 }