Example #1
0
  @Override
  public void createPartControl(Composite parent) {
    super.createPartControl(parent);

    // Remove the Pin item
    IMenuManager menuManager = getViewSite().getActionBars().getMenuManager();
    menuManager.removeAll();
    //        for(IContributionItem item : menuManager.getItems()) {
    //            if(item instanceof ActionContributionItem) {
    //                if(((ActionContributionItem)item).getAction() instanceof
    // PinPropertySheetAction) {
    //                    menuManager.remove(item);
    //                    break;
    //                }
    //            }
    //        }

    IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager();
    toolBarManager.removeAll();
    //        for(IContributionItem item : toolBarManager.getItems()) {
    //            if(item instanceof ActionContributionItem) {
    //                if(((ActionContributionItem)item).getAction() instanceof
    // PinPropertySheetAction) {
    //                    toolBarManager.remove(item);
    //                    break;
    //                }
    //            }
    //        }
  }
  public void placeActions() {
    IActionBars actionBars = getViewSite().getActionBars();

    IMenuManager mm = actionBars.getMenuManager();
    mm.removeAll();
    mm.add(SaveTreeViewAction.getAction(getSite().getShell()));
    mm.add(CapturePSDAction.getAction(getSite().getShell()));
    mm.add(new Separator());
    mm.add(RefreshViewAction.getAction());
    mm.add(DisplayViewAction.getAction(getSite().getShell()));
    mm.add(new Separator());
    mm.add(InvalidateAction.getAction());
    mm.add(RequestLayoutAction.getAction());
    mm.add(DumpDisplayListAction.getAction());
    mm.add(ProfileNodesAction.getAction());

    IToolBarManager tm = actionBars.getToolBarManager();
    tm.removeAll();
    tm.add(SaveTreeViewAction.getAction(getSite().getShell()));
    tm.add(CapturePSDAction.getAction(getSite().getShell()));
    tm.add(new Separator());
    tm.add(RefreshViewAction.getAction());
    tm.add(DisplayViewAction.getAction(getSite().getShell()));
    tm.add(new Separator());
    tm.add(InvalidateAction.getAction());
    tm.add(RequestLayoutAction.getAction());
    tm.add(DumpDisplayListAction.getAction());
    tm.add(ProfileNodesAction.getAction());
  }
 private void updateToolbar() {
   IActionBars bars = getSite().getActionBars();
   IToolBarManager manager = bars.getToolBarManager();
   manager.removeAll();
   if (fCurrentPage == fTapestryOutlinePage)
     fTapestryOutlinePage.makeContributions(null, manager, null);
   manager.add(fToggleAction);
   bars.updateActionBars();
 }
  // this should be called each time the current component is changed OR the tab inside a component
  // is changed
  void fillToolBar(ViewersMultiSandboxViewComponent c) {
    // add items for the multi operation

    IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
    mgr.removeAll();
    mgr.add(getSwitchSashingAction);
    mgr.add(getAddNewComponentAction);
    mgr.add(getCloseCurrentComponentAction);
    mgr.add(new Separator());

    c.fillToolBarBasedOnCurrentTab();

    getViewSite().getActionBars().updateActionBars();
  }
Example #5
0
  /** @since 3.0 */
  public void updateHeaderToolBar() {
    if (isHeaderFormDisposed()) {
      return;
    }

    final Form form = getHeaderForm().getForm().getForm();
    toolBarManager = form.getToolBarManager();

    toolBarManager.removeAll();
    //		toolBarManager.update(true);

    TaskRepository outgoingNewRepository = TasksUiUtil.getOutgoingNewTaskRepository(task);
    final TaskRepository taskRepository =
        (outgoingNewRepository != null)
            ? outgoingNewRepository
            : taskEditorInput.getTaskRepository();
    ControlContribution repositoryLabelControl =
        new ControlContribution(Messages.AbstractTaskEditorPage_Title) {
          @Override
          protected Control createControl(Composite parent) {
            FormToolkit toolkit = getHeaderForm().getToolkit();
            Composite composite = toolkit.createComposite(parent);
            RowLayout layout = new RowLayout();
            if (PlatformUiUtil.hasNarrowToolBar()) {
              layout.marginTop = 0;
              layout.marginBottom = 0;
              layout.center = true;
            }
            composite.setLayout(layout);
            composite.setBackground(null);
            String label = taskRepository.getRepositoryLabel();
            if (label.indexOf("//") != -1) { // $NON-NLS-1$
              label =
                  label.substring(
                      (taskRepository.getRepositoryUrl().indexOf("//") + 2)); // $NON-NLS-1$
            }

            ImageHyperlink link = new ImageHyperlink(composite, SWT.NONE);
            link.setText(label);
            link.setFont(JFaceResources.getBannerFont());
            link.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
            link.setToolTipText(Messages.TaskEditor_Edit_Task_Repository_ToolTip);
            link.addHyperlinkListener(
                new HyperlinkAdapter() {
                  @Override
                  public void linkActivated(HyperlinkEvent e) {
                    TasksUiUtil.openEditRepositoryWizard(taskRepository);
                  }
                });

            return composite;
          }
        };
    toolBarManager.add(repositoryLabelControl);

    toolBarManager.add(new GroupMarker("repository")); // $NON-NLS-1$
    toolBarManager.add(new GroupMarker("new")); // $NON-NLS-1$
    toolBarManager.add(new GroupMarker("open")); // $NON-NLS-1$
    toolBarManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

    openWithBrowserAction = new OpenWithBrowserAction();
    openWithBrowserAction.selectionChanged(new StructuredSelection(task));
    if (openWithBrowserAction.isEnabled()) {
      //			ImageDescriptor overlay =
      // TasksUiPlugin.getDefault().getOverlayIcon(taskRepository.getConnectorKind());
      //			ImageDescriptor compositeDescriptor = new
      // TaskListImageDescriptor(TasksUiImages.REPOSITORY_SMALL_TOP,
      //					overlay, false, true);
      openWithBrowserAction.setImageDescriptor(CommonImages.WEB);
      // openWithBrowserAction.setImageDescriptor(CommonImages.BROWSER_OPEN_TASK);
      openWithBrowserAction.setToolTipText(Messages.AbstractTaskEditorPage_Open_with_Web_Browser);
      toolBarManager.appendToGroup("open", openWithBrowserAction); // $NON-NLS-1$
    } else {
      openWithBrowserAction = null;
    }

    if (activateAction == null) {
      activateAction =
          new ToggleTaskActivationAction(task) {
            @Override
            public void run() {
              TaskList taskList = TasksUiPlugin.getTaskList();
              if (taskList.getTask(task.getRepositoryUrl(), task.getTaskId()) == null) {
                setMessage(
                    Messages.TaskEditor_Task_added_to_the_Uncategorized_container,
                    IMessageProvider.INFORMATION);
              }
              super.run();
            }
          };
    }

    toolBarManager.add(new Separator("planning")); // $NON-NLS-1$
    disposeScheduleAction();
    scheduleAction = new TaskEditorScheduleAction(task);
    toolBarManager.add(scheduleAction);

    toolBarManager.add(new GroupMarker("page")); // $NON-NLS-1$
    for (IFormPage page : getPages()) {
      if (page instanceof TaskFormPage) {
        TaskFormPage taskEditorPage = (TaskFormPage) page;
        taskEditorPage.fillToolBar(toolBarManager);
      }
    }

    toolBarManager.add(new Separator("activation")); // $NON-NLS-1$

    //		ContributionItem spacer = new ContributionItem() {
    //			@Override
    //			public void fill(ToolBar toolbar, int index) {
    //				ToolItem item = new ToolItem(toolbar, SWT.NONE);
    //				int scaleHeight = 42;
    //				if (PlatformUtil.needsCarbonToolBarFix()) {
    //					scaleHeight = 32;
    //				}
    //				final Image image = new Image(toolbar.getDisplay(),
    // CommonImages.getImage(CommonImages.BLANK)
    //						.getImageData()
    //						.scaledTo(1, scaleHeight));
    //				item.setImage(image);
    //				item.addDisposeListener(new DisposeListener() {
    //					public void widgetDisposed(DisposeEvent e) {
    //						image.dispose();
    //					}
    //				});
    //				item.setWidth(5);
    //				item.setEnabled(false);
    //			}
    //		};
    //		toolBarManager.add(spacer);

    //		for (IFormPage page : getPages()) {
    //			if (page instanceof AbstractTaskEditorPage) {
    //				AbstractTaskEditorPage taskEditorPage = (AbstractTaskEditorPage) page;
    //				taskEditorPage.fillLeftHeaderToolBar(toolBarManager);
    //			} else if (page instanceof TaskPlanningEditor) {
    //				TaskPlanningEditor taskEditorPage = (TaskPlanningEditor) page;
    //				taskEditorPage.fillLeftHeaderToolBar(toolBarManager);
    //			}
    //		}

    // add external contributions
    menuService = (IMenuService) getSite().getService(IMenuService.class);
    if (menuService != null && toolBarManager instanceof ContributionManager) {
      menuService.populateContributionManager(
          (ContributionManager) toolBarManager,
          "toolbar:" //$NON-NLS-1$
              + ID_TOOLBAR_HEADER
              + "."
              + taskRepository.getConnectorKind()); // $NON-NLS-1$
      menuService.populateContributionManager(
          (ContributionManager) toolBarManager,
          "toolbar:" //$NON-NLS-1$
              + ID_TOOLBAR_HEADER);
    }

    toolBarManager.update(true);

    // XXX move this call
    updateLeftHeaderToolBar();
    updateHeader();
  }