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

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

本文整理了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

/**
 * <p>
 * Tests whether the locale for the binding matches one of the active
 * locales.
 * </p>
 * <p>
 * This method completes in <code>O(n)</code>, where <code>n</code> is
 * the number of active locales.
 * </p>
 *
 * @param binding
 *            The binding with which to test; must not be <code>null</code>.
 * @return <code>true</code> if the binding's locale matches;
 *         <code>false</code> otherwise.
 */
private final boolean localeMatches(final Binding binding) {
  boolean matches = false;
  final String locale = binding.getLocale();
  if (locale == null) {
    return true; // shortcut a common case
  }
  for (String localString : locales) {
    if (Objects.equals(localString, locale)) {
      matches = true;
      break;
    }
  }
  return matches;
}

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

/**
 * <p>
 * Tests whether the locale for the binding matches one of the active
 * locales.
 * </p>
 * <p>
 * This method completes in <code>O(n)</code>, where <code>n</code> is
 * the number of active locales.
 * </p>
 *
 * @param binding
 *            The binding with which to test; must not be <code>null</code>.
 * @return <code>true</code> if the binding's locale matches;
 *         <code>false</code> otherwise.
 */
private final boolean localeMatches(final Binding binding) {
  boolean matches = false;
  final String locale = binding.getLocale();
  if (locale == null) {
    return true; // shortcut a common case
  }
  for (int i = 0; i < locales.length; i++) {
    if (Util.equals(locales[i], locale)) {
      matches = true;
      break;
    }
  }
  return matches;
}

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

/**
 * <p>
 * Tests whether the locale for the binding matches one of the active
 * locales.
 * </p>
 * <p>
 * This method completes in <code>O(n)</code>, where <code>n</code> is
 * the number of active locales.
 * </p>
 *
 * @param binding
 *            The binding with which to test; must not be <code>null</code>.
 * @return <code>true</code> if the binding's locale matches;
 *         <code>false</code> otherwise.
 */
private final boolean localeMatches(final Binding binding) {
  boolean matches = false;
  final String locale = binding.getLocale();
  if (locale == null) {
    return true; // shortcut a common case
  }
  for (int i = 0; i < locales.length; i++) {
    if (Util.equals(locales[i], locale)) {
      matches = true;
      break;
    }
  }
  return matches;
}

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

/**
 * Tests whether this binding is intended to delete another binding. The
 * receiver must have a <code>null</code> command identifier.
 *
 * @param binding
 *            The binding to test; must not be <code>null</code>.
 *            This binding must be a <code>SYSTEM</code> binding.
 * @return <code>true</code> if the receiver deletes the binding defined by
 *             the argument.
 */
final boolean deletes(final Binding binding) {
  boolean deletes = true;
  deletes &= Objects.equals(getContextId(), binding.getContextId());
  deletes &= Objects.equals(getTriggerSequence(), binding
      .getTriggerSequence());
  if (getLocale() != null) {
    deletes &= !Objects.equals(getLocale(), binding.getLocale());
  }
  if (getPlatform() != null) {
    deletes &= !Objects.equals(getPlatform(), binding.getPlatform());
  }
  deletes &= (binding.getType() == SYSTEM);
  deletes &= Objects.equals(getParameterizedCommand(), null);
  return deletes;
}

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

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

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

static final boolean deletes(final Binding del, final Binding binding) {
  boolean deletes = true;
  deletes &= Util.equals(del.getContextId(), binding.getContextId());
  deletes &= Util.equals(del.getTriggerSequence(), binding
      .getTriggerSequence());
  if (del.getLocale() != null) {
    deletes &= Util.equals(del.getLocale(), binding.getLocale());
  }
  if (del.getPlatform() != null) {
    deletes &= Util.equals(del.getPlatform(), binding.getPlatform());
  }
  deletes &= (binding.getType() == Binding.SYSTEM);
  deletes &= Util.equals(del.getParameterizedCommand(), null);
  return deletes;
}

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

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

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

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

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

/**
 * Tests whether this binding is intended to delete another binding. The
 * receiver must have a <code>null</code> command identifier.
 * 
 * @param binding
 *            The binding to test; must not be <code>null</code>.
 *            This binding must be a <code>SYSTEM</code> binding.
 * @return <code>true</code> if the receiver deletes the binding defined by
 *             the argument.
 */
final boolean deletes(final Binding binding) {
  boolean deletes = true;
  deletes &= Util.equals(getContextId(), binding.getContextId());
  deletes &= Util.equals(getTriggerSequence(), binding
      .getTriggerSequence());
  if (getLocale() != null) {
    deletes &= !Util.equals(getLocale(), binding.getLocale());
  }
  if (getPlatform() != null) {
    deletes &= !Util.equals(getPlatform(), binding.getPlatform());
  }
  deletes &= (binding.getType() == SYSTEM);
  deletes &= Util.equals(getParameterizedCommand(), null);
  return deletes;
}

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

/**
 * Tests whether this binding is intended to delete another binding. The
 * receiver must have a <code>null</code> command identifier.
 *
 * @param binding
 *            The binding to test; must not be <code>null</code>.
 *            This binding must be a <code>SYSTEM</code> binding.
 * @return <code>true</code> if the receiver deletes the binding defined by
 *             the argument.
 */
final boolean deletes(final Binding binding) {
  boolean deletes = true;
  deletes &= Util.equals(getContextId(), binding.getContextId());
  deletes &= Util.equals(getTriggerSequence(), binding
      .getTriggerSequence());
  if (getLocale() != null) {
    deletes &= !Util.equals(getLocale(), binding.getLocale());
  }
  if (getPlatform() != null) {
    deletes &= !Util.equals(getPlatform(), binding.getPlatform());
  }
  deletes &= (binding.getType() == SYSTEM);
  deletes &= Util.equals(getParameterizedCommand(), null);
  return deletes;
}

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

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

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

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

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

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

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

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

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

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

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

/**
 * Computes the hash code for this key binding based on all of its
 * attributes.
 * 
 * @return The hash code for this key binding.
 */
public final int hashCode() {
  if (hashCode == HASH_CODE_NOT_COMPUTED) {
    hashCode = HASH_INITIAL;
    hashCode = hashCode * HASH_FACTOR
        + Util.hashCode(getParameterizedCommand());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getContextId());
    hashCode = hashCode * HASH_FACTOR
        + Util.hashCode(getTriggerSequence());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getLocale());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getPlatform());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getSchemeId());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getType());
    if (hashCode == HASH_CODE_NOT_COMPUTED) {
      hashCode++;
    }
  }
  return hashCode;
}

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

/**
 * Computes the hash code for this key binding based on all of its
 * attributes.
 *
 * @return The hash code for this key binding.
 */
@Override
public final int hashCode() {
  if (hashCode == HASH_CODE_NOT_COMPUTED) {
    hashCode = HASH_INITIAL;
    hashCode = hashCode * HASH_FACTOR
        + Util.hashCode(getParameterizedCommand());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getContextId());
    hashCode = hashCode * HASH_FACTOR
        + Util.hashCode(getTriggerSequence());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getLocale());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getPlatform());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getSchemeId());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getType());
    if (hashCode == HASH_CODE_NOT_COMPUTED) {
      hashCode++;
    }
  }
  return hashCode;
}

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

/**
 * Computes the hash code for this key binding based on all of its
 * attributes.
 *
 * @return The hash code for this key binding.
 */
@Override
public final int hashCode() {
  if (hashCode == HASH_CODE_NOT_COMPUTED) {
    hashCode = HASH_INITIAL;
    hashCode = hashCode * HASH_FACTOR
        + Util.hashCode(getParameterizedCommand());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getContextId());
    hashCode = hashCode * HASH_FACTOR
        + Util.hashCode(getTriggerSequence());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getLocale());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getPlatform());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getSchemeId());
    hashCode = hashCode * HASH_FACTOR + Util.hashCode(getType());
    if (hashCode == HASH_CODE_NOT_COMPUTED) {
      hashCode++;
    }
  }
  return hashCode;
}

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

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

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

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

相关文章