Java Code Examples for org.eclipse.jface.bindings.keys.KeyBinding#getKeySequence()
The following examples show how to use
org.eclipse.jface.bindings.keys.KeyBinding#getKeySequence() .
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: KeyController2.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
private void updateBindingContext(ContextElement context) { if (context == null) { return; } BindingElement activeBinding = (BindingElement) bindingModel.getSelectedElement(); if (activeBinding == null) { return; } String activeSchemeId = fSchemeModel.getSelectedElement().getId(); Object obj = activeBinding.getModelObject(); if (obj instanceof KeyBinding) { KeyBinding keyBinding = (KeyBinding) obj; if (!keyBinding.getContextId().equals(context.getId())) { final KeyBinding binding = new KeyBinding(keyBinding.getKeySequence(), keyBinding.getParameterizedCommand(), activeSchemeId, context.getId(), null, null, null, Binding.USER); if (keyBinding.getType() == Binding.USER) { fBindingManager.removeBinding(keyBinding); } else { fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null, keyBinding .getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER)); } bindingModel.getBindingToElement().remove(activeBinding.getModelObject()); fBindingManager.addBinding(binding); activeBinding.fill(binding, contextModel); bindingModel.getBindingToElement().put(binding, activeBinding); } } }
Example 2
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private void updateBindingContext(ContextElement context) { if (context == null) { return; } BindingElement activeBinding = (BindingElement) bindingModel.getSelectedElement(); if (activeBinding == null) { return; } String activeSchemeId = fSchemeModel.getSelectedElement().getId(); Object obj = activeBinding.getModelObject(); if (obj instanceof KeyBinding) { KeyBinding keyBinding = (KeyBinding) obj; if (!keyBinding.getContextId().equals(context.getId())) { final KeyBinding binding = new KeyBinding(keyBinding.getKeySequence(), keyBinding.getParameterizedCommand(), activeSchemeId, context.getId(), null, null, null, Binding.USER); if (keyBinding.getType() == Binding.USER) { fBindingManager.removeBinding(keyBinding); } else { fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null, keyBinding .getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER)); } bindingModel.getBindingToElement().remove(activeBinding.getModelObject()); fBindingManager.addBinding(binding); activeBinding.fill(binding, contextModel); bindingModel.getBindingToElement().put(binding, activeBinding); } } }
Example 3
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
private void updateBindingContext(ContextElement context) { if (context == null) { return; } BindingElement activeBinding = (BindingElement) bindingModel.getSelectedElement(); if (activeBinding == null) { return; } String activeSchemeId = fSchemeModel.getSelectedElement().getId(); Object obj = activeBinding.getModelObject(); if (obj instanceof KeyBinding) { KeyBinding keyBinding = (KeyBinding) obj; if (!keyBinding.getContextId().equals(context.getId())) { final KeyBinding binding = new KeyBinding(keyBinding.getKeySequence(), keyBinding.getParameterizedCommand(), activeSchemeId, context.getId(), null, null, null, Binding.USER); if (keyBinding.getType() == Binding.USER) { fBindingManager.removeBinding(keyBinding); } else { fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null, keyBinding .getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER)); } bindingModel.getBindingToElement().remove(activeBinding.getModelObject()); fBindingManager.addBinding(binding); activeBinding.fill(binding, contextModel); bindingModel.getBindingToElement().put(binding, activeBinding); } } }
Example 4
Source File: BindingModel2.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * Removes the <code>bindingElement</code> binding. * @param bindingElement */ public void remove(BindingElement bindingElement) { if (bindingElement == null || !(bindingElement.getModelObject() instanceof Binding)) { return; } KeyBinding keyBinding = (KeyBinding) bindingElement.getModelObject(); if (keyBinding.getType() == Binding.USER) { bindingManager.removeBinding(keyBinding); } else { KeySequence keySequence = keyBinding.getKeySequence(); // Add the delete binding bindingManager.addBinding(new KeyBinding(keySequence, null, keyBinding.getSchemeId(), keyBinding .getContextId(), null, null, null, Binding.USER)); // Unbind any conflicts affected by the delete binding ConflictModel conflictModel = controller.getConflictModel(); conflictModel.updateConflictsFor(bindingElement); Collection conflictsList = conflictModel.getConflicts(); if (conflictsList != null) { Object[] conflicts = conflictsList.toArray(); for (int i = 0; i < conflicts.length; i++) { BindingElement be = (BindingElement) conflicts[i]; if (be == bindingElement) { continue; } Object modelObject = be.getModelObject(); if (modelObject instanceof Binding) { Binding binding = (Binding) modelObject; if (binding.getType() != Binding.SYSTEM) { continue; } ParameterizedCommand pCommand = binding.getParameterizedCommand(); be.fill(pCommand); commandToElement.put(pCommand, be); } } } } ParameterizedCommand parameterizedCommand = keyBinding.getParameterizedCommand(); bindingElement.fill(parameterizedCommand); commandToElement.put(parameterizedCommand, bindingElement); controller.firePropertyChange(this, PROP_CONFLICT_ELEMENT_MAP, null, bindingElement); }
Example 5
Source File: BindingModel2.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * Removes the <code>bindingElement</code> binding. * @param bindingElement */ public void remove(BindingElement bindingElement) { if (bindingElement == null || !(bindingElement.getModelObject() instanceof Binding)) { return; } KeyBinding keyBinding = (KeyBinding) bindingElement.getModelObject(); if (keyBinding.getType() == Binding.USER) { bindingManager.removeBinding(keyBinding); } else { KeySequence keySequence = keyBinding.getKeySequence(); // Add the delete binding bindingManager.addBinding(new KeyBinding(keySequence, null, keyBinding.getSchemeId(), keyBinding .getContextId(), null, null, null, Binding.USER)); // Unbind any conflicts affected by the delete binding ConflictModel conflictModel = controller.getConflictModel(); conflictModel.updateConflictsFor(bindingElement); Collection conflictsList = conflictModel.getConflicts(); if (conflictsList != null) { Object[] conflicts = conflictsList.toArray(); for (int i = 0; i < conflicts.length; i++) { BindingElement be = (BindingElement) conflicts[i]; if (be == bindingElement) { continue; } Object modelObject = be.getModelObject(); if (modelObject instanceof Binding) { Binding binding = (Binding) modelObject; if (binding.getType() != Binding.SYSTEM) { continue; } ParameterizedCommand pCommand = binding.getParameterizedCommand(); be.fill(pCommand); commandToElement.put(pCommand, be); } } } } ParameterizedCommand parameterizedCommand = keyBinding.getParameterizedCommand(); bindingElement.fill(parameterizedCommand); commandToElement.put(parameterizedCommand, bindingElement); controller.firePropertyChange(this, PROP_CONFLICT_ELEMENT_MAP, null, bindingElement); }
Example 6
Source File: BindingModel2.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * Removes the <code>bindingElement</code> binding. * @param bindingElement */ public void remove(BindingElement bindingElement) { if (bindingElement == null || !(bindingElement.getModelObject() instanceof Binding)) { return; } KeyBinding keyBinding = (KeyBinding) bindingElement.getModelObject(); if (keyBinding.getType() == Binding.USER) { bindingManager.removeBinding(keyBinding); } else { KeySequence keySequence = keyBinding.getKeySequence(); // Add the delete binding bindingManager.addBinding(new KeyBinding(keySequence, null, keyBinding.getSchemeId(), keyBinding .getContextId(), null, null, null, Binding.USER)); // Unbind any conflicts affected by the delete binding ConflictModel conflictModel = controller.getConflictModel(); conflictModel.updateConflictsFor(bindingElement); Collection conflictsList = conflictModel.getConflicts(); if (conflictsList != null) { Object[] conflicts = conflictsList.toArray(); for (int i = 0; i < conflicts.length; i++) { BindingElement be = (BindingElement) conflicts[i]; if (be == bindingElement) { continue; } Object modelObject = be.getModelObject(); if (modelObject instanceof Binding) { Binding binding = (Binding) modelObject; if (binding.getType() != Binding.SYSTEM) { continue; } ParameterizedCommand pCommand = binding.getParameterizedCommand(); be.fill(pCommand); commandToElement.put(pCommand, be); } } } } ParameterizedCommand parameterizedCommand = keyBinding.getParameterizedCommand(); bindingElement.fill(parameterizedCommand); commandToElement.put(parameterizedCommand, bindingElement); controller.firePropertyChange(this, PROP_CONFLICT_ELEMENT_MAP, null, bindingElement); }