public Binding createBinding(TriggerSequence sequence, ParameterizedCommand command, String contextId, Map<String, String> attributes) { String schemeId = DEFAULT_SCHEME_ID; String locale = null; String platform = null; int bindingType = Binding.SYSTEM; if (sequence != null && !sequence.isEmpty() && contextId != null) { if (attributes != null) { String tmp = attributes.get(SCHEME_ID_ATTR_TAG); if (tmp != null && tmp.length() > 0) { schemeId = tmp; } locale = attributes.get(LOCALE_ATTR_TAG); platform = attributes.get(PLATFORM_ATTR_TAG); if (USER_TYPE.equals(attributes.get(TYPE_ATTR_TAG))) { bindingType = Binding.USER; } } return new KeyBinding((KeySequence) sequence, command, schemeId, contextId, locale, platform, null, bindingType); } return null; }
private static void getBindingForPlatform(KeySequence keySequence, String platform, ParameterizedCommand parameterizedCommand, String schemeId, String contextId, String locale, List bindings, String modifiedSequence, String[] platforms) throws ParseException { int j = 0; for (; j < platforms.length; j++) { if(platforms[j].equals(SWT.getPlatform())) { KeyBinding newBinding = new KeyBinding(KeySequence .getInstance(modifiedSequence), parameterizedCommand, schemeId, contextId, locale, platforms[j], null, Binding.SYSTEM); bindings.add(newBinding); break; } } if(j == platforms.length) { // platform doesn't match. use the unmodified sequence KeyBinding newBinding = new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale, null, null, Binding.SYSTEM); bindings.add(newBinding); } }
@Override public Binding createBinding(TriggerSequence sequence, ParameterizedCommand command, String contextId, Map<String, String> attributes) { String schemeId = DEFAULT_SCHEME_ID; String locale = null; String platform = null; int bindingType = Binding.SYSTEM; if (sequence != null && !sequence.isEmpty() && contextId != null) { if (attributes != null) { String tmp = attributes.get(SCHEME_ID_ATTR_TAG); if (tmp != null && tmp.length() > 0) { schemeId = tmp; } locale = attributes.get(LOCALE_ATTR_TAG); platform = attributes.get(PLATFORM_ATTR_TAG); if (USER_TYPE.equals(attributes.get(TYPE_ATTR_TAG))) { bindingType = Binding.USER; } } return new KeyBinding((KeySequence) sequence, command, schemeId, contextId, locale, platform, null, bindingType); } return null; }
private static void addGenericBindings(KeySequence keySequence, ParameterizedCommand parameterizedCommand, String schemeId, String contextId, String locale, List bindings, String modifiedSequence, String[] platforms) throws ParseException { KeyBinding originalBinding = new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale, null, null, Binding.SYSTEM); bindings.add(originalBinding); String platform = SWT.getPlatform(); boolean modifierExists = false; for (String currentPlatform : platforms) { if(currentPlatform.equals(platform)) { modifierExists = true; break; } } if(modifierExists) { KeyBinding newBinding = new KeyBinding(KeySequence.getInstance(modifiedSequence), parameterizedCommand, schemeId, contextId, locale, SWT.getPlatform(), null, Binding.SYSTEM); KeyBinding deleteBinding = new KeyBinding(keySequence, null, schemeId, contextId, locale, SWT.getPlatform(), null, Binding.SYSTEM); bindings.add(newBinding); bindings.add(deleteBinding); } }
KeyBinding binding = new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale, platform, null, Binding.SYSTEM);
/** * Handles the selection event on the remove button. This removes all * user-defined bindings matching the given key sequence, scheme and * context. It then adds a new deletion binding for the selected trigger * sequence. */ private void selectedButtonRemove() { final String contextId = getContextId(); final String schemeId = getSchemeId(); final KeySequence keySequence = getKeySequence(); localChangeManager.removeBindings(keySequence, schemeId, contextId, null, null, null, Binding.USER); localChangeManager.addBinding(new KeyBinding(keySequence, null, schemeId, contextId, null, null, null, Binding.USER)); update(true); }
cocoaTempList.add(new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale, Util.WS_COCOA, null, Binding.SYSTEM));
/** * Handles the selection event on the add button. This removes all * user-defined bindings matching the given key sequence, scheme and * context. It then adds a new binding with the current selections. */ private void selectedButtonAdd() { final ParameterizedCommand command = getParameterizedCommand(); final String contextId = getContextId(); final String schemeId = getSchemeId(); final KeySequence keySequence = getKeySequence(); localChangeManager.removeBindings(keySequence, schemeId, contextId, null, null, null, Binding.USER); localChangeManager.addBinding(new KeyBinding(keySequence, command, schemeId, contextId, null, null, null, Binding.USER)); update(true); }
KeyBinding keyBinding = (KeyBinding) obj; if (!keyBinding.getContextId().equals(context.getId())) { final KeyBinding binding = new KeyBinding(keyBinding .getKeySequence(), keyBinding.getParameterizedCommand(), activeSchemeId, fBindingManager.removeBinding(keyBinding); } else { fBindingManager.addBinding(new KeyBinding(keyBinding .getKeySequence(), null, keyBinding.getSchemeId(), keyBinding.getContextId(), null, null, null,
String activeContextId = selectedElement == null ? IContextService.CONTEXT_ID_WINDOW : selectedElement.getId(); final KeyBinding binding = new KeyBinding(keySequence, keyBinding.getParameterizedCommand(), activeSchemeId, activeContextId, null, null, null, fBindingManager.removeBinding(keyBinding); } else { fBindingManager.addBinding(new KeyBinding(keyBinding .getKeySequence(), null, keyBinding .getSchemeId(), keyBinding.getContextId(), fBindingManager.removeBinding(keyBinding); } else { fBindingManager.addBinding(new KeyBinding(keyBinding .getKeySequence(), null, keyBinding .getSchemeId(), keyBinding.getContextId(), String activeContextId = selectedElement == null ? IContextService.CONTEXT_ID_WINDOW : selectedElement.getId(); final KeyBinding binding = new KeyBinding(keySequence, cmd, activeSchemeId, activeContextId, null, null, null, Binding.USER);
bindingManager.addBinding(new KeyBinding(keySequence, null, keyBinding.getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER));
memento, warningsToLog, command) : null; final Binding binding = new KeyBinding(keySequence, parameterizedCommand, schemeId, contextId, locale, platform, null, Binding.USER);