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

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

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

Binding.getLocale介绍

[英]Returns the locale in which this binding applies. If the locale is null, then this binding applies to all locales. This string is the same format as returned by Locale.getDefault().toString().
[中]返回应用此绑定的区域设置。如果区域设置为null,则此绑定适用于所有区域设置。此字符串的格式与Locale.getDefault().toString()返回的格式相同。

代码示例

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

  1. /**
  2. * <p>
  3. * Tests whether the locale for the binding matches one of the active
  4. * locales.
  5. * </p>
  6. * <p>
  7. * This method completes in <code>O(n)</code>, where <code>n</code> is
  8. * the number of active locales.
  9. * </p>
  10. *
  11. * @param binding
  12. * The binding with which to test; must not be <code>null</code>.
  13. * @return <code>true</code> if the binding's locale matches;
  14. * <code>false</code> otherwise.
  15. */
  16. private final boolean localeMatches(final Binding binding) {
  17. boolean matches = false;
  18. final String locale = binding.getLocale();
  19. if (locale == null) {
  20. return true; // shortcut a common case
  21. }
  22. for (String localString : locales) {
  23. if (Objects.equals(localString, locale)) {
  24. matches = true;
  25. break;
  26. }
  27. }
  28. return matches;
  29. }

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

  1. /**
  2. * <p>
  3. * Tests whether the locale for the binding matches one of the active
  4. * locales.
  5. * </p>
  6. * <p>
  7. * This method completes in <code>O(n)</code>, where <code>n</code> is
  8. * the number of active locales.
  9. * </p>
  10. *
  11. * @param binding
  12. * The binding with which to test; must not be <code>null</code>.
  13. * @return <code>true</code> if the binding's locale matches;
  14. * <code>false</code> otherwise.
  15. */
  16. private final boolean localeMatches(final Binding binding) {
  17. boolean matches = false;
  18. final String locale = binding.getLocale();
  19. if (locale == null) {
  20. return true; // shortcut a common case
  21. }
  22. for (int i = 0; i < locales.length; i++) {
  23. if (Util.equals(locales[i], locale)) {
  24. matches = true;
  25. break;
  26. }
  27. }
  28. return matches;
  29. }

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

  1. /**
  2. * <p>
  3. * Tests whether the locale for the binding matches one of the active
  4. * locales.
  5. * </p>
  6. * <p>
  7. * This method completes in <code>O(n)</code>, where <code>n</code> is
  8. * the number of active locales.
  9. * </p>
  10. *
  11. * @param binding
  12. * The binding with which to test; must not be <code>null</code>.
  13. * @return <code>true</code> if the binding's locale matches;
  14. * <code>false</code> otherwise.
  15. */
  16. private final boolean localeMatches(final Binding binding) {
  17. boolean matches = false;
  18. final String locale = binding.getLocale();
  19. if (locale == null) {
  20. return true; // shortcut a common case
  21. }
  22. for (int i = 0; i < locales.length; i++) {
  23. if (Util.equals(locales[i], locale)) {
  24. matches = true;
  25. break;
  26. }
  27. }
  28. return matches;
  29. }

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

  1. /**
  2. * Tests whether this binding is intended to delete another binding. The
  3. * receiver must have a <code>null</code> command identifier.
  4. *
  5. * @param binding
  6. * The binding to test; must not be <code>null</code>.
  7. * This binding must be a <code>SYSTEM</code> binding.
  8. * @return <code>true</code> if the receiver deletes the binding defined by
  9. * the argument.
  10. */
  11. final boolean deletes(final Binding binding) {
  12. boolean deletes = true;
  13. deletes &= Objects.equals(getContextId(), binding.getContextId());
  14. deletes &= Objects.equals(getTriggerSequence(), binding
  15. .getTriggerSequence());
  16. if (getLocale() != null) {
  17. deletes &= !Objects.equals(getLocale(), binding.getLocale());
  18. }
  19. if (getPlatform() != null) {
  20. deletes &= !Objects.equals(getPlatform(), binding.getPlatform());
  21. }
  22. deletes &= (binding.getType() == SYSTEM);
  23. deletes &= Objects.equals(getParameterizedCommand(), null);
  24. return deletes;
  25. }

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

  1. equals &= Objects.equals(schemeId, binding.getSchemeId());
  2. equals &= Objects.equals(contextId, binding.getContextId());
  3. equals &= Objects.equals(locale, binding.getLocale());
  4. equals &= Objects.equals(platform, binding.getPlatform());
  5. equals &= (type == binding.getType());

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

  1. static final boolean deletes(final Binding del, final Binding binding) {
  2. boolean deletes = true;
  3. deletes &= Util.equals(del.getContextId(), binding.getContextId());
  4. deletes &= Util.equals(del.getTriggerSequence(), binding
  5. .getTriggerSequence());
  6. if (del.getLocale() != null) {
  7. deletes &= Util.equals(del.getLocale(), binding.getLocale());
  8. }
  9. if (del.getPlatform() != null) {
  10. deletes &= Util.equals(del.getPlatform(), binding.getPlatform());
  11. }
  12. deletes &= (binding.getType() == Binding.SYSTEM);
  13. deletes &= Util.equals(del.getParameterizedCommand(), null);
  14. return deletes;
  15. }

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

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

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

  1. return false;
  2. String locale = binding.getLocale();
  3. if (locale != null) {
  4. if (!modelTags.contains(EBindingService.LOCALE_ATTR_TAG + ":" + locale)) //$NON-NLS-1$

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

  1. /**
  2. * Tests whether this binding is intended to delete another binding. The
  3. * receiver must have a <code>null</code> command identifier.
  4. *
  5. * @param binding
  6. * The binding to test; must not be <code>null</code>.
  7. * This binding must be a <code>SYSTEM</code> binding.
  8. * @return <code>true</code> if the receiver deletes the binding defined by
  9. * the argument.
  10. */
  11. final boolean deletes(final Binding binding) {
  12. boolean deletes = true;
  13. deletes &= Util.equals(getContextId(), binding.getContextId());
  14. deletes &= Util.equals(getTriggerSequence(), binding
  15. .getTriggerSequence());
  16. if (getLocale() != null) {
  17. deletes &= !Util.equals(getLocale(), binding.getLocale());
  18. }
  19. if (getPlatform() != null) {
  20. deletes &= !Util.equals(getPlatform(), binding.getPlatform());
  21. }
  22. deletes &= (binding.getType() == SYSTEM);
  23. deletes &= Util.equals(getParameterizedCommand(), null);
  24. return deletes;
  25. }

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

  1. /**
  2. * Tests whether this binding is intended to delete another binding. The
  3. * receiver must have a <code>null</code> command identifier.
  4. *
  5. * @param binding
  6. * The binding to test; must not be <code>null</code>.
  7. * This binding must be a <code>SYSTEM</code> binding.
  8. * @return <code>true</code> if the receiver deletes the binding defined by
  9. * the argument.
  10. */
  11. final boolean deletes(final Binding binding) {
  12. boolean deletes = true;
  13. deletes &= Util.equals(getContextId(), binding.getContextId());
  14. deletes &= Util.equals(getTriggerSequence(), binding
  15. .getTriggerSequence());
  16. if (getLocale() != null) {
  17. deletes &= !Util.equals(getLocale(), binding.getLocale());
  18. }
  19. if (getPlatform() != null) {
  20. deletes &= !Util.equals(getPlatform(), binding.getPlatform());
  21. }
  22. deletes &= (binding.getType() == SYSTEM);
  23. deletes &= Util.equals(getParameterizedCommand(), null);
  24. return deletes;
  25. }

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

  1. tags.add(EBindingService.SCHEME_ID_ATTR_TAG + ":" + binding.getSchemeId()); //$NON-NLS-1$
  2. if (binding.getLocale() != null) {
  3. tags.add(EBindingService.LOCALE_ATTR_TAG + ":" + binding.getLocale()); //$NON-NLS-1$

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

  1. element.putString(ATT_KEY_SEQUENCE, binding.getTriggerSequence()
  2. .toString());
  3. element.putString(ATT_LOCALE, binding.getLocale());
  4. element.putString(ATT_PLATFORM, binding.getPlatform());
  5. if (parameterizedCommand != null) {

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

  1. final String bestLocale = bestBinding.getLocale();
  2. final String currentLocale = currentBinding.getLocale();
  3. if ((bestLocale == null) && (currentLocale != null)) {
  4. bestBinding = currentBinding;

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

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

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

  1. return false;
  2. if (!Util.equals(getLocale(), binding.getLocale())) {
  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. }

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

  1. equals &= Util.equals(schemeId, binding.getSchemeId());
  2. equals &= Util.equals(contextId, binding.getContextId());
  3. equals &= Util.equals(locale, binding.getLocale());
  4. equals &= Util.equals(platform, binding.getPlatform());
  5. equals &= (type == binding.getType());

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

  1. equals &= Util.equals(schemeId, binding.getSchemeId());
  2. equals &= Util.equals(contextId, binding.getContextId());
  3. equals &= Util.equals(locale, binding.getLocale());
  4. equals &= Util.equals(platform, binding.getPlatform());
  5. equals &= (type == binding.getType());

相关文章