private IAction oldAction;
private DeleteVertexHandler deleteVertexHandler;
public void activate( EditToolHandler handler ) {
IActionBars2 actionBars = handler.getContext().getActionBars();
if( actionBars==null )
return;
IWorkbenchPart part=(IWorkbenchPart) ApplicationGISInternal.getActiveEditor();
if( part == null ) return;
oldAction=ApplicationGIS.getToolManager().getDELETEAction();
IKeyBindingService keyBindingService = part.getSite().getKeyBindingService();
if( oldAction!=null )
keyBindingService.unregisterAction(oldAction);
deleteVertexHandler = new DeleteVertexHandler(handler);
if( oldAction!=null ){
deleteVertexHandler.setImageDescriptor(oldAction.getImageDescriptor());
deleteVertexHandler.setDisabledImageDescriptor(oldAction.getDisabledImageDescriptor());
}
ApplicationGIS.getToolManager().setDELETEAction(deleteVertexHandler,part);
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteVertexHandler);
actionBars.updateActionBars();
keyBindingService.registerAction(deleteVertexHandler);
}