org.eclipse.jface.bindings.Binding.getSchemeId()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中org.eclipse.jface.bindings.Binding.getSchemeId()方法的一些代码示例,展示了Binding.getSchemeId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Binding.getSchemeId()方法的具体详情如下:
包路径:org.eclipse.jface.bindings.Binding
类名称:Binding
方法名:getSchemeId

Binding.getSchemeId介绍

[英]Returns the identifier of the scheme in which this binding applies.
[中]返回应用此绑定的方案的标识符。

代码示例

代码示例来源:origin: org.eclipse.e4.ui/bindings

  1. /**
  2. * @param currentResult
  3. * @return
  4. */
  5. private boolean isMostActiveScheme(Binding currentResult) {
  6. if (activeSchemeIds == null || activeSchemeIds.length < 2) {
  7. return true;
  8. }
  9. final String mostActive = activeSchemeIds[0];
  10. return mostActive == null ? false : mostActive.equals(currentResult.getSchemeId());
  11. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.bindings

  1. /**
  2. * @param currentResult
  3. * @return
  4. */
  5. private boolean isMostActiveScheme(Binding currentResult) {
  6. if (activeSchemeIds == null || activeSchemeIds.length < 2) {
  7. return true;
  8. }
  9. final String mostActive = activeSchemeIds[0];
  10. return mostActive == null ? false : mostActive.equals(currentResult.getSchemeId());
  11. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.bindings

  1. Binding msb = bindingList.get(0);
  2. Binding lsb = bindingList.get(1);
  3. int rc = compareSchemes(BEST_SEQUENCE.getActiveSchemes(), msb.getSchemeId(),
  4. lsb.getSchemeId());
  5. if (rc == 0) {
  6. ArrayList<Binding> conflictList = conflicts.get(sequence);
  7. while (i.hasNext() && rc == 0) {
  8. Binding next = i.next();
  9. rc = compareSchemes(BEST_SEQUENCE.getActiveSchemes(), prev.getSchemeId(),
  10. next.getSchemeId());
  11. if (rc == 0) {
  12. conflictList.add(next);

代码示例来源:origin: org.eclipse.e4.ui/bindings

  1. Binding msb = bindingList.get(0);
  2. Binding lsb = bindingList.get(1);
  3. int rc = compareSchemes(BEST_SEQUENCE.getActiveSchemes(), msb.getSchemeId(),
  4. lsb.getSchemeId());
  5. if (rc == 0) {
  6. ArrayList<Binding> conflictList = conflicts.get(sequence);
  7. while (i.hasNext() && rc == 0) {
  8. Binding next = i.next();
  9. rc = compareSchemes(BEST_SEQUENCE.getActiveSchemes(), prev.getSchemeId(),
  10. next.getSchemeId());
  11. if (rc == 0) {
  12. conflictList.add(next);

代码示例来源:origin: org.eclipse.e4.ui/bindings

  1. public Binding getPerfectMatch(ContextSet contextSet, TriggerSequence triggerSequence) {
  2. Binding result = null;
  3. Binding currentResult = null;
  4. List<Context> contexts = contextSet.getContexts();
  5. ListIterator<Context> it = contexts.listIterator(contexts.size());
  6. while (it.hasPrevious()) {
  7. Context c = it.previous();
  8. BindingTable table = getTable(c.getId());
  9. if (table != null) {
  10. currentResult = table.getPerfectMatch(triggerSequence);
  11. }
  12. if (currentResult != null) {
  13. if (isMostActiveScheme(currentResult)) {
  14. return currentResult;
  15. }
  16. if (result == null) {
  17. result = currentResult;
  18. } else {
  19. int rc = compareSchemes(result.getSchemeId(), currentResult.getSchemeId());
  20. if (rc < 0) {
  21. result = currentResult;
  22. }
  23. }
  24. }
  25. }
  26. return result;
  27. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.bindings

  1. public Binding getPerfectMatch(ContextSet contextSet, TriggerSequence triggerSequence) {
  2. Binding result = null;
  3. Binding currentResult = null;
  4. List<Context> contexts = contextSet.getContexts();
  5. ListIterator<Context> it = contexts.listIterator(contexts.size());
  6. while (it.hasPrevious()) {
  7. Context c = it.previous();
  8. BindingTable table = getTable(c.getId());
  9. if (table != null) {
  10. currentResult = table.getPerfectMatch(triggerSequence);
  11. }
  12. if (currentResult != null) {
  13. if (isMostActiveScheme(currentResult)) {
  14. return currentResult;
  15. }
  16. if (result == null) {
  17. result = currentResult;
  18. } else {
  19. int rc = compareSchemes(result.getSchemeId(), currentResult.getSchemeId());
  20. if (rc < 0) {
  21. result = currentResult;
  22. }
  23. }
  24. }
  25. }
  26. return result;
  27. }

代码示例来源:origin: org.eclipse.e4.ui/bindings

  1. while (matchesIter.hasNext()) {
  2. bindingToAdd = matchesIter.next();
  3. if (!bindingToAdd.getSchemeId().equals(EBindingService.DEFAULT_SCHEME_ID)) {
  4. sortedMatches.add(bindingToAdd);
  5. break;

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.bindings

  1. while (matchesIter.hasNext()) {
  2. bindingToAdd = matchesIter.next();
  3. if (!bindingToAdd.getSchemeId().equals(EBindingService.DEFAULT_SCHEME_ID)) {
  4. sortedMatches.add(bindingToAdd);
  5. break;

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

  1. return false;
  2. if (!Objects.equals(getSchemeId(), binding.getSchemeId())) {
  3. return false;

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

  1. private MKeyBinding findMKeyBinding(MBindingTable table, Binding binding) {
  2. List<MKeyBinding> mBindings = table.getBindings();
  3. String bindingSchemeId = binding.getSchemeId() == null ? IBindingService.DEFAULT_DEFAULT_ACTIVE_SCHEME_ID
  4. : binding.getSchemeId();

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

  1. String schemeId = binding.getSchemeId();
  2. if (schemeId != null && !schemeId.equals(BindingPersistence.getDefaultSchemeId())) {
  3. if (!modelTags.contains(EBindingService.SCHEME_ID_ATTR_TAG + ":" + schemeId)) //$NON-NLS-1$

代码示例来源:origin: org.eclipse.e4.ui/bindings

  1. public int compare(Binding o1, Binding o2) {
  2. int rc = compareSchemes(activeSchemeIds, o1.getSchemeId(), o2.getSchemeId());
  3. if (rc != 0) {
  4. return rc;
  5. }
  6. /*
  7. * Check to see which has the least number of triggers in the trigger sequence.
  8. */
  9. final Trigger[] bestTriggers = o1.getTriggerSequence().getTriggers();
  10. final Trigger[] currentTriggers = o2.getTriggerSequence().getTriggers();
  11. int compareTo = bestTriggers.length - currentTriggers.length;
  12. if (compareTo != 0) {
  13. return compareTo;
  14. }
  15. /*
  16. * Compare the number of keys pressed in each trigger sequence. Some types of keys count
  17. * less than others (i.e., some types of modifiers keys are less likely to be chosen).
  18. */
  19. compareTo = countStrokes(bestTriggers) - countStrokes(currentTriggers);
  20. if (compareTo != 0) {
  21. return compareTo;
  22. }
  23. // If this is still a tie, then just chose the shortest text.
  24. return o1.getTriggerSequence().format().length()
  25. - o2.getTriggerSequence().format().length();
  26. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

  1. /**
  2. * Compare 2 bindings, taking into account Scheme and type.
  3. *
  4. * @param current
  5. * the existing binding
  6. * @param addition
  7. * the incoming binding
  8. * @return an int indicating current > addition
  9. */
  10. private int compareTo(Binding current, Binding addition) {
  11. final Scheme s1 = manager.getScheme(current.getSchemeId());
  12. final Scheme s2 = manager.getScheme(addition.getSchemeId());
  13. if (!s1.equals(s2)) {
  14. int rc = compareSchemes(s1.getId(), s2.getId());
  15. if (rc != 0) {
  16. // this is because the compare is inverted
  17. return rc > 0 ? -1 : 1;
  18. }
  19. }
  20. return current.getType() - addition.getType();
  21. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.bindings

  1. @Override
  2. public int compare(Binding o1, Binding o2) {
  3. int rc = compareSchemes(activeSchemeIds, o1.getSchemeId(), o2.getSchemeId());
  4. if (rc != 0) {
  5. return rc;
  6. }
  7. /*
  8. * Check to see which has the least number of triggers in the trigger sequence.
  9. */
  10. final Trigger[] bestTriggers = o1.getTriggerSequence().getTriggers();
  11. final Trigger[] currentTriggers = o2.getTriggerSequence().getTriggers();
  12. int compareTo = bestTriggers.length - currentTriggers.length;
  13. if (compareTo != 0) {
  14. return compareTo;
  15. }
  16. /*
  17. * Compare the number of keys pressed in each trigger sequence. Some types of keys count
  18. * less than others (i.e., some types of modifiers keys are less likely to be chosen).
  19. */
  20. compareTo = countStrokes(bestTriggers) - countStrokes(currentTriggers);
  21. if (compareTo != 0) {
  22. return compareTo;
  23. }
  24. // If this is still a tie, then just chose the shortest text.
  25. return o1.getTriggerSequence().format().length()
  26. - o2.getTriggerSequence().format().length();
  27. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

  1. : parameterizedCommand.getId();
  2. element.putString(ATT_COMMAND_ID, commandId);
  3. element.putString(ATT_KEY_CONFIGURATION_ID, binding.getSchemeId());
  4. element.putString(ATT_KEY_SEQUENCE, binding.getTriggerSequence()
  5. .toString());

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

  1. return false;
  2. if (!Util.equals(getSchemeId(), binding.getSchemeId())) {
  3. return false;

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

  1. return false;
  2. if (!Util.equals(getSchemeId(), binding.getSchemeId())) {
  3. return false;

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

  1. /**
  2. * Computes the hash code for this key binding based on all of its
  3. * attributes.
  4. *
  5. * @return The hash code for this key binding.
  6. */
  7. public final int hashCode() {
  8. if (hashCode == HASH_CODE_NOT_COMPUTED) {
  9. hashCode = HASH_INITIAL;
  10. hashCode = hashCode * HASH_FACTOR
  11. + Util.hashCode(getParameterizedCommand());
  12. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getContextId());
  13. hashCode = hashCode * HASH_FACTOR
  14. + Util.hashCode(getTriggerSequence());
  15. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getLocale());
  16. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getPlatform());
  17. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getSchemeId());
  18. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getType());
  19. if (hashCode == HASH_CODE_NOT_COMPUTED) {
  20. hashCode++;
  21. }
  22. }
  23. return hashCode;
  24. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

  1. /**
  2. * Computes the hash code for this key binding based on all of its
  3. * attributes.
  4. *
  5. * @return The hash code for this key binding.
  6. */
  7. @Override
  8. public final int hashCode() {
  9. if (hashCode == HASH_CODE_NOT_COMPUTED) {
  10. hashCode = HASH_INITIAL;
  11. hashCode = hashCode * HASH_FACTOR
  12. + Util.hashCode(getParameterizedCommand());
  13. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getContextId());
  14. hashCode = hashCode * HASH_FACTOR
  15. + Util.hashCode(getTriggerSequence());
  16. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getLocale());
  17. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getPlatform());
  18. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getSchemeId());
  19. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getType());
  20. if (hashCode == HASH_CODE_NOT_COMPUTED) {
  21. hashCode++;
  22. }
  23. }
  24. return hashCode;
  25. }

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

  1. /**
  2. * Computes the hash code for this key binding based on all of its
  3. * attributes.
  4. *
  5. * @return The hash code for this key binding.
  6. */
  7. @Override
  8. public final int hashCode() {
  9. if (hashCode == HASH_CODE_NOT_COMPUTED) {
  10. hashCode = HASH_INITIAL;
  11. hashCode = hashCode * HASH_FACTOR
  12. + Util.hashCode(getParameterizedCommand());
  13. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getContextId());
  14. hashCode = hashCode * HASH_FACTOR
  15. + Util.hashCode(getTriggerSequence());
  16. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getLocale());
  17. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getPlatform());
  18. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getSchemeId());
  19. hashCode = hashCode * HASH_FACTOR + Util.hashCode(getType());
  20. if (hashCode == HASH_CODE_NOT_COMPUTED) {
  21. hashCode++;
  22. }
  23. }
  24. return hashCode;
  25. }

相关文章