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

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

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

Binding.getType介绍

[英]Returns the type for this binding. As it stands now, this value will either be SYSTEM or USER. In the future, more types might be added.
[中]返回此绑定的类型。目前,该值将为SYSTEMUSER。将来,可能会添加更多类型。

代码示例

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

.getBestActiveBindingFor(cmd.getId());
Binding binding = bindingManager.getPerfectMatch(trigger);
if (binding != null && binding.getType() == Binding.SYSTEM) {
  return;
  removalBindings.add(managerBinding);
} else if (managerBinding.getParameterizedCommand().equals(cmd)) {
  if (managerBinding.getType() == Binding.USER) {
    bindingManager.removeBinding(managerBinding);
  } else if (managerBinding.getType() == Binding.SYSTEM) {
    systemBindings.add(managerBinding);
while (j.hasNext()) {
  Binding del = (Binding) j.next();
  if (deletes(del, sys) && del.getType() == Binding.USER) {
    bindingManager.removeBinding(del);

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

/**
 * @param b
 * @param model
 */
public void init(Binding b, ContextModel model) {
  setCommandInfo(b.getParameterizedCommand());
  setTrigger(b.getTriggerSequence());
  setContext((ContextElement) model.getContextIdToElement().get(
      b.getContextId()));
  setUserDelta(Integer.valueOf(b.getType()));
  setModelObject(b);
}

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

return false;
return (getType() == binding.getType());

代码示例来源: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.ui.workbench

/**
 * Compare 2 bindings, taking into account Scheme and type.
 *
 * @param current
 *            the existing binding
 * @param addition
 *            the incoming binding
 * @return an int indicating current > addition
 */
private int compareTo(Binding current, Binding addition) {
  final Scheme s1 = manager.getScheme(current.getSchemeId());
  final Scheme s2 = manager.getScheme(addition.getSchemeId());
  if (!s1.equals(s2)) {
    int rc = compareSchemes(s1.getId(), s2.getId());
    if (rc != 0) {
      // this is because the compare is inverted
      return rc > 0 ? -1 : 1;
    }
  }
  return current.getType() - addition.getType();
}

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

return false;
if (binding.getType() == Binding.USER) {
  if (!modelTags.contains(EBindingService.TYPE_ATTR_TAG + ":user")) //$NON-NLS-1$
    return false;

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

if (binding.getType() == Binding.USER) {
  mKeyBinding = this.findMKeyBinding(table, binding);
  if (mKeyBinding != null) {

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

if (binding.getType() == Binding.SYSTEM) {
  tableItem.setImage(0, IMAGE_BLANK);
} else {

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

for (int i = 0; i < bindingsLength; i++) {
  final Binding binding = bindings[i];
  if (binding.getType() == Binding.USER) {
    writeBindingToPreferences(xmlMemento, binding);

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

/**
 * Sets the bindings to default.
 *
 * @param bindingService
 */
public void setDefaultBindings(IBindingService bindingService) {
  // Fix the scheme in the local changes.
  final String defaultSchemeId = bindingService.getDefaultSchemeId();
  final Scheme defaultScheme = fBindingManager.getScheme(defaultSchemeId);
  try {
    fBindingManager.setActiveScheme(defaultScheme);
  } catch (final NotDefinedException e) {
    // At least we tried....
  }
  // Restore any User defined bindings
  for (Binding binding : fBindingManager.getBindings()) {
    if (binding.getType() == Binding.USER) {
      fBindingManager.removeBinding(binding);
    }
  }
  bindingModel.refresh(contextModel);
  saveBindings(bindingService);
}

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

for (int i = 0; i < currentBindingsLength; i++) {
  final Binding binding = currentBindings[i];
  if (binding.getType() != Binding.USER) {
    trimmedBindings.add(binding);

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

if (modelObject instanceof Binding) {
  Binding binding = (Binding) modelObject;
  if (binding.getType() != Binding.SYSTEM) {
    continue;

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

return false;
return (getType() == binding.getType());

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

return false;
return (getType() == 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.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

/**
 * 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.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;
}

相关文章