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

The following examples show how to use org.eclipse.ui.keys.IBindingService#setKeyFilterEnabled() . 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: KeyBindingHelper.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public static void handleEvent(Event e)
{
	IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);

	Listener keyDownFilter = ((BindingService) bindingService).getKeyboard().getKeyDownFilter();
	boolean enabled = bindingService.isKeyFilterEnabled();
	Control focusControl = e.display.getFocusControl();
	try
	{
		bindingService.setKeyFilterEnabled(true);
		keyDownFilter.handleEvent(e);
	}
	finally
	{
		if (focusControl == e.display.getFocusControl()) // $codepro.audit.disable useEquals
		{
			bindingService.setKeyFilterEnabled(enabled);
		}
	}
}
 
Example 2
Source File: FindBarActions.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void setFindBarContextActive(boolean activate)
{
	fActivated = activate;
	IWorkbenchPartSite site = textEditor.getSite();
	IHandlerService handlerService = (IHandlerService) site.getService(IHandlerService.class);
	IBindingService service = (IBindingService) site.getService(IBindingService.class);

	if (activate)
	{

		// These will be the only active commands (note that they may have multiple keybindings
		// defined in plugin.xml)
		for (Map.Entry<String, AbstractHandler> entry : fCommandToHandler.entrySet())
		{
			AbstractHandler handler = entry.getValue();
			if (handler != null)
			{
				fHandlerActivations.add(handlerService.activateHandler(entry.getKey(), handler));
			}
		}

		// Yes, no longer execute anything from the binding service (we'll do our own handling so that the commands
		// we need still get executed).
		service.setKeyFilterEnabled(false);

		service.addBindingManagerListener(fClearCommandToBindingOnChangesListener);
	}
	else
	{
		fCommandToBinding = null;
		service.setKeyFilterEnabled(true);

		service.removeBindingManagerListener(fClearCommandToBindingOnChangesListener);
		handlerService.deactivateHandlers(fHandlerActivations);
		fHandlerActivations.clear();
	}
}
 
Example 3
Source File: TmMatchEditDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the dialog.
 * @param parentShell
 */
public TmMatchEditDialog(Shell parentShell, FuzzySearchResult fuzzyResult) {
	super(parentShell);
	this.fuzzyResult = fuzzyResult;
	setShellStyle(getShellStyle() | SWT.RESIZE);
	IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
	bindingService.setKeyFilterEnabled(false);
}
 
Example 4
Source File: TmMatchEditDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean close() {
	IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
	bindingService.setKeyFilterEnabled(true);
	srcSegmentViewer.reset();
	tgtSegmentViewer.reset();
	return super.close();
}
 
Example 5
Source File: TmMatchEditDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the dialog.
 * @param parentShell
 */
public TmMatchEditDialog(Shell parentShell, FuzzySearchResult fuzzyResult) {
	super(parentShell);
	this.fuzzyResult = fuzzyResult;
	setShellStyle(getShellStyle() | SWT.RESIZE);
	IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
	bindingService.setKeyFilterEnabled(false);
}
 
Example 6
Source File: TmMatchEditDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean close() {
	IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
	bindingService.setKeyFilterEnabled(true);
	srcSegmentViewer.reset();
	tgtSegmentViewer.reset();
	return super.close();
}