private CCPActionGroup(IWorkbenchSite site) { fSite= site; fClipboard= new Clipboard(site.getShell().getDisplay()); fPasteAction= new PasteAction(fSite, fClipboard); fPasteAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.PASTE); fCopyAction= new CopyToClipboardAction(fSite, fClipboard); fCopyAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY); fCopyQualifiedNameAction= new CopyQualifiedNameAction(fSite); fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID); fCutAction= new CutAction(fSite, fClipboard); fCutAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.CUT); fDeleteAction= new DeleteAction(fSite); fDeleteAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE); fActions= new SelectionDispatchAction[] { fCutAction, fCopyAction, fCopyQualifiedNameAction, fPasteAction, fDeleteAction }; registerActionsAsSelectionChangeListeners(); }
private SelectionDispatchAction getCopyQualifiedNameAction() { if (fCopyQualifiedNameAction == null) { fCopyQualifiedNameAction= new CopyQualifiedNameAction(getSite()); fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID); } return fCopyQualifiedNameAction; }
private SelectionDispatchAction getCopyQualifiedNameAction() { if (fCopyQualifiedNameAction == null) { fCopyQualifiedNameAction= new CopyQualifiedNameAction(getSite()); fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID); } return fCopyQualifiedNameAction; }
/** * Sets actionDefinitionId, updates enablement, adds to fActions, * and adds selection changed listener if provider is not <code>null</code>. * * @param action * @param provider can be <code>null</code> * @param selection * @param actionDefinitionId */ private void initUpdatingAction(SelectionDispatchAction action, ISelectionProvider provider, ISelection selection, String actionDefinitionId){ action.setActionDefinitionId(actionDefinitionId); action.update(selection); if (provider != null) provider.addSelectionChangedListener(action); fActions.add(action); }
/** * Sets actionDefinitionId, updates enablement, adds to fActions, * and adds selection changed listener if provider is not <code>null</code>. * * @param action the action * @param provider can be <code>null</code> * @param specialProvider a special selection provider or <code>null</code> * @param selection the selection * @param actionDefinitionId the action definition id */ private void initUpdatingAction(SelectionDispatchAction action, ISelectionProvider provider, ISelectionProvider specialProvider, ISelection selection, String actionDefinitionId) { action.setActionDefinitionId(actionDefinitionId); action.update(selection); if (provider != null) provider.addSelectionChangedListener(action); if (specialProvider != null) action.setSpecialSelectionProvider(specialProvider); fActions.add(action); }
fCopyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY); fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID); fPasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE); fDeleteAction= new DeleteAction(site); fDeleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE); fCutAction= new CutAction(site); fCutAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT); fActions= new SelectionDispatchAction[] { fCutAction, fCopyAction, fCopyQualifiedNameAction, fPasteAction, fDeleteAction }; } else {
fCopyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY); fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID); fPasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE); fDeleteAction= new DeleteAction(site); fDeleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE); fCutAction= new CutAction(site); fCutAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT); fActions= new SelectionDispatchAction[] { fCutAction, fCopyAction, fCopyQualifiedNameAction, fPasteAction, fDeleteAction }; } else {
/** * Sets actionDefinitionId, updates enablement, adds to fActions, * and adds selection changed listener if provider is not <code>null</code>. * * @param action the action * @param provider can be <code>null</code> * @param specialProvider a special selection provider or <code>null</code> * @param selection the selection * @param actionDefinitionId the action definition id */ private void initUpdatingAction(SelectionDispatchAction action, ISelectionProvider provider, ISelectionProvider specialProvider, ISelection selection, String actionDefinitionId) { action.setActionDefinitionId(actionDefinitionId); action.update(selection); if (provider != null) provider.addSelectionChangedListener(action); if (specialProvider != null) action.setSpecialSelectionProvider(specialProvider); fActions.add(action); }