/** * Returns the text to be shown in the popups's information area. * May return <code>null</code>. * <p> * By default, if this dialog has a persistence command associated with it, * the text displayed is of the form "Press {key-sequence} to {action}". The * action text is specified by the method <code>getActionText()</code>. * </p> * @return The text to be shown in the popup's information area or <code>null</code> */ protected String getInfoText() { if (getCommandId() != null && getActionText() != null) { IWorkbench workbench = PlatformUI.getWorkbench(); IBindingService bindingService = workbench.getAdapter(IBindingService.class); String formattedBinding = bindingService.getBestActiveBindingFormattedFor(getCommandId()); String infoText = null; if (formattedBinding != null) { infoText = MessageFormat.format(DebugUIViewsMessages.InspectPopupDialog_1, new Object[] { formattedBinding, getActionText() }); } return infoText; } return null; }
@Override public int open() { IWorkbench workbench = PlatformUI.getWorkbench(); String commandId = getCommandId(); if (commandId != null) { IHandler fCloseHandler = new AbstractHandler() { @Override public Object execute(ExecutionEvent event) throws ExecutionException { persist(); close(); return null; } }; fHandlerService = workbench.getAdapter(IHandlerService.class); fActivation = fHandlerService.activateHandler(commandId, fCloseHandler); } String infoText = getInfoText(); if (infoText != null) { setInfoText(infoText); } return super.open(); }