Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » How to unbind F2 key programatically in eclipse java plugin development ( How to unbind F2 key programatically in eclipse java plugin development )
How to unbind F2 key programatically in eclipse java plugin development [message #1805791] Wed, 24 April 2019 06:41 Go to next message
Sharmila D is currently offline Sharmila DFriend
Messages: 81
Registered: June 2018
Member
Hii

Could anyone Please help me on How to unbind F2 key programatically in eclipse java plugin development so that we need to avoid user in renaming the file
Re: How to unbind F2 key programatically in eclipse java plugin development [message #1805812 is a reply to message #1805791] Wed, 24 April 2019 14:12 Go to previous message
Sharmila D is currently offline Sharmila DFriend
Messages: 81
Registered: June 2018
Member
Hi

Please find the piece of code
Getting exception during unbind of F2 key

ContextManager contextManager = new ContextManager();

BindingManager bindingManager = new BindingManager(contextManager,
commandManager);
IBindingService bindingService = (IBindingService) PlatformUI.
getWorkbench().getAdapter(IBindingService.class);
Binding[] bindings = bindingService.getBindings();
for (Binding binding : bindings) {
if(binding.getTriggerSequence().format().equals("F2"))
{
KeyBinding keyBinding = (KeyBinding) binding;
String contextId = binding.getContextId();
String schemeId = binding.getSchemeId();
KeySequence triggerSequence = keyBinding.getKeySequence();

ParameterizedCommand parameterizedCommand = binding
.getParameterizedCommand();
Command command = parameterizedCommand.getCommand();
KeyBinding deleteBinding = new KeyBinding(triggerSequence,
null, schemeId, contextId, null, null, null,
Binding.USER);

bindingManager.addBinding(deleteBinding);
}
}
If I tried to activate bindingManager Iam getting exceptions
try {

bindingManager
.setActiveScheme(bindingService.getActiveScheme());
} catch (final NotDefinedException e) {
throw new Error(
"Error"); //$NON-NLS-1$
}
If I save the active binding Iam getting exceptions.
try {
bindingService.savePreferences(
bindingManager .getActiveScheme(), bindingManager
.getBindings());
} catch (IOException e) {
e.printStackTrace();
}

Iam adding this code in my perspective plugin. I hope Iam unbinding F2 key but Iam not getting how to activate and save
PLease find the below stack Trace
Cannot get the parent identifier from an undefined scheme. org.eclipse.ui.defaultAcceleratorConfiguration
Previous Topic:[EMF Search] How to use from RCP app
Next Topic:EMF Refactor & Modisco Java model
Goto Forum:
  


Current Time: Thu Apr 25 11:33:33 GMT 2024

Powered by FUDForum. Page generated in 0.03162 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top