コード例 #1
0
ファイル: NewActionProvider.java プロジェクト: eclipse/cdo
  @Override
  public void init(ICommonActionExtensionSite extensionSite) {
    this.extensionSite = extensionSite;
    ICommonViewerSite viewSite = extensionSite.getViewSite();
    if (viewSite instanceof ICommonViewerWorkbenchSite) {
      page = ((ICommonViewerWorkbenchSite) viewSite).getPage();
      IWorkbenchWindow window = page.getWorkbenchWindow();

      showDlgAction = ActionFactory.NEW.create(window);

      CDOCheckoutContentProvider contentProvider = getContentProvider();
      IWizardRegistry wrapperRegistry = new WizardRegistryWrapper(contentProvider);

      newWizardActionGroup =
          new WizardActionGroup(
              window,
              wrapperRegistry,
              WizardActionGroup.TYPE_NEW,
              extensionSite.getContentService());

      viewer = (TreeViewer) extensionSite.getStructuredViewer();
      viewer.addSelectionChangedListener(this);
      updateSelectedObject(viewer.getSelection());
    }
  }
コード例 #2
0
  public MainActionGroup(final RepositoryView view) {

    this.view = view;
    Shell shell = view.getSite().getShell();
    this.drillDownAdapter = new DrillDownAdapter(view.getViewer());

    this.propertyDialogAction = new PropertyDialogAction(this, view.getViewer());
    this.collapseAllAction = new CollapseAllAction("Collapse All");

    this.refreshAction = new RefreshAction("Refresh");
    this.refreshAction.setImageDescriptor(
        WikedPlugin.getInstance().getImageRegistry().getDescriptor(WikedImageRegistry.REFRESH));

    IRepositoryManager mgr = WikedPlugin.getInstance().getRepositoryManager();
    String[] rtypes = mgr.getRepositoryTypes();
    this.addRemoteRepositoryActions = new AddRepositoryAction[rtypes.length];
    for (int i = 0; i < rtypes.length; i++) {
      this.addRemoteRepositoryActions[i] =
          new AddRepositoryAction(view, mgr.getRepositoryDescriptor(rtypes[i]));
    }

    this.addSpaceAction = new AddSpaceAction(view, "Space");
    this.addSpaceAction.setImageDescriptor(
        WikedPlugin.getInstance().getImageRegistry().getDescriptor(WikedImageRegistry.ADD_SPACE));

    this.addPageAction = new AddPageAction(view, "Page");
    this.addPageAction.setImageDescriptor(
        WikedPlugin.getInstance().getImageRegistry().getDescriptor(WikedImageRegistry.ADD_PAGE));

    this.newOtherAction = ActionFactory.NEW.create(view.getSite().getWorkbenchWindow());
    this.deleteAction = new DeleteAction(view, "Delete");
    this.openFileAction = new OpenFileAction(view.getSite().getPage());
    this.cutAction =
        new Action() {
          public void run() {
            IStructuredSelection selection = (IStructuredSelection) view.getViewer().getSelection();
            if (selection.size() > 0) {
              cutAction.setEnabled(true);
            }
          }
        };
    this.pasteAction =
        new Action() {
          public void run() {
            IStructuredSelection selection = (IStructuredSelection) view.getViewer().getSelection();
            doDragAndDrop(selection, DND.DROP_MOVE);
            pasteAction.setEnabled(false);
          }
        };
    pasteAction.setEnabled(false);
  }