Java Code Examples for org.eclipse.ui.keys.IBindingService#getBestActiveBindingFormattedFor()

The following examples show how to use org.eclipse.ui.keys.IBindingService#getBestActiveBindingFormattedFor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepeatedContentAssistProcessor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected String getStatusMessage() {
	String binding = "<binding>";
	if (workbench != null) {
		IBindingService bindingService = workbench.getAdapter(IBindingService.class);
		binding = bindingService.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.EDIT_CONTENT_ASSIST);
	}
	String category = getModeAwareProposalProvider().getNextCategory();
	return binding + " to show " + category;
}
 
Example 2
Source File: RenameRefactoringPopup.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * WARNING: only works in workbench window context!
 * 
 * @return the keybinding for Refactor &gt; Rename
 */
protected static String getOpenDialogBinding() {
	IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class);
	if (bindingService == null)
		return ""; //$NON-NLS-1$
	String binding = bindingService
			.getBestActiveBindingFormattedFor("org.eclipse.xtext.ui.refactoring.RenameElement");
	return binding == null ? "" : binding; //$NON-NLS-1$
}
 
Example 3
Source File: RenameInformationPopup.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * WARNING: only works in workbench window context!
 * @return the keybinding for Refactor &gt; Rename
 */
private static String getOpenDialogBinding() {
	IBindingService bindingService= PlatformUI.getWorkbench().getAdapter(IBindingService.class);
	if (bindingService == null)
		return ""; //$NON-NLS-1$
	String binding= bindingService.getBestActiveBindingFormattedFor(ITypeScriptEditorActionDefinitionIds.RENAME_ELEMENT);
	return binding == null ? "" : binding; //$NON-NLS-1$
}
 
Example 4
Source File: QuickOutline.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
public QuickOutline(Shell parent, JsonEditor editor, String fileContentType) {
      super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true, true, true, true, null, null);
this.fileContentType = fileContentType;

      IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
      this.bindingKey = bindingService.getBestActiveBindingFormattedFor(COMMAND_ID);
      this.triggerSequence = bindingService.getBestActiveBindingFor(COMMAND_ID);
      this.editor = editor;

      setInfoText(statusMessage());
      create();
  }
 
Example 5
Source File: JsonContentAssistProcessor.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
protected String[] initTextMessages() {
	IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
	String bindingKey = bindingService.getBestActiveBindingFormattedFor(EDIT_CONTENT_ASSIST);
       ContextType contextType = currentModel != null
               ? referenceProposalProvider.getContextTypes().get(currentModel, getCurrentPath())
               : null;
	String context = contextType != null ? contextType.label() : "";

	return new String[] { //
			String.format(Messages.content_assist_proposal_project, bindingKey, context),
			String.format(Messages.content_assist_proposal_workspace, bindingKey, context),
			String.format(Messages.content_assist_proposal_local, bindingKey, context) };
}
 
Example 6
Source File: RenameInformationPopup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * WARNING: only works in workbench window context!
 * @return the keybinding for Refactor &gt; Rename
 */
private static String getOpenDialogBinding() {
	IBindingService bindingService= (IBindingService)PlatformUI.getWorkbench().getAdapter(IBindingService.class);
	if (bindingService == null)
		return ""; //$NON-NLS-1$
	String binding= bindingService.getBestActiveBindingFormattedFor(IJavaEditorActionDefinitionIds.RENAME_ELEMENT);
	return binding == null ? "" : binding; //$NON-NLS-1$
}
 
Example 7
Source File: OpenViewActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private String getShowInMenuLabel() {
	String keyBinding= null;

	IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
	if (bindingService != null)
		keyBinding= bindingService.getBestActiveBindingFormattedFor(IWorkbenchCommandConstants.NAVIGATE_SHOW_IN_QUICK_MENU);

	if (keyBinding == null)
		keyBinding= ""; //$NON-NLS-1$

	return ActionMessages.OpenViewActionGroup_showInAction_label + '\t' + keyBinding;
}