public void registerMenu(IMenuManager menu) { view.getViewSite() .getActionBars() .setGlobalActionHandler(ActionFactory.CUT.getId(), this.cutAction); view.getViewSite() .getActionBars() .setGlobalActionHandler(ActionFactory.PASTE.getId(), this.pasteAction); }
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); }
private void fillOpenWithMenu(IMenuManager menu, Object object) { if (object instanceof IAdaptable) { MenuManager submenu = new MenuManager("Open With", OPEN_WITH_ID); submenu.add(new OpenWithMenu(view.getSite().getPage(), (IAdaptable) object)); menu.add(submenu); } }
public Shell getShell() { return view.getSite().getShell(); }