org.eclipse.swt.graphics.RGB.equals()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(108)

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

RGB.equals介绍

[英]Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
[中]将参数与接收方进行比较,如果它们使用特定于类的比较表示相同对象,则返回true。

代码示例

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

public boolean setColor(RGB color) {
  RGB oldColor= fIndicatorColor;
  fIndicatorColor= color;
  if (color == null)
    return oldColor != null;
  if (oldColor != null)
    return !color.equals(oldColor);
  return true;
}

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

@Override
public boolean equals(Object obj) {
  if (obj instanceof RGBColorDescriptor) {
    RGBColorDescriptor other = (RGBColorDescriptor) obj;
    return other.color.equals(color) && other.originalColor == originalColor;
  }
  return false;
}

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

@Override
public boolean equals(Object obj) {
  if (obj instanceof RGBColorDescriptor) {
    RGBColorDescriptor other = (RGBColorDescriptor) obj;
    return other.color.equals(color) && other.originalColor == originalColor;
  }
  return false;
}

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

public boolean setColor(RGB color) {
  RGB oldColor= fIndicatorColor;
  fIndicatorColor= color;
  if (color == null)
    return oldColor != null;
  if (oldColor != null)
    return !color.equals(oldColor);
  return true;
}

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

public boolean equals(Object obj) {
  if (obj instanceof RGBColorDescriptor) {
    RGBColorDescriptor other = (RGBColorDescriptor) obj;
    
    return other.color.equals(color) && other.originalColor == originalColor;
  }
  
  return false;
}

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

@Override
public boolean equals(Object obj) {
  if (obj instanceof AbstractImageDescriptor) {
    AbstractImageDescriptor id = (AbstractImageDescriptor)obj;
    if (id.fRGBs.length == fRGBs.length) {
      boolean result = id.fLength == fLength;
      for (int i = 0; i < fRGBs.length && result; i++) {
        result = result && id.fRGBs[i].equals(fRGBs[i]);
      }
      return result;
    }
  }
  return false;
}

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

@Override
public boolean equals(Object obj) {
  if (obj instanceof AbstractImageDescriptor) {
    AbstractImageDescriptor id = (AbstractImageDescriptor)obj;
    if (id.fRGBs.length == fRGBs.length) {
      boolean result = id.fLength == fLength;
      for (int i = 0; i < fRGBs.length && result; i++) {
        result = result && id.fRGBs[i].equals(fRGBs[i]);
      }
      return result;
    }
  }
  return false;
}

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

public void setColorValue(RGB rgb) {
  if (fColorValue.equals(rgb))
    return;
  RGB oldrgb = fColorValue;
  fColorValue = rgb;
  firePropertyChange(new PropertyChangeEvent(this, fColorKey, oldrgb, rgb));
}

代码示例来源:origin: rinde/RinSim

@Override
public boolean equals(Object o) {
 if (o == this) {
  return true;
 }
 if (o instanceof CommRenderer.Builder) {
  CommRenderer.Builder that = (CommRenderer.Builder) o;
  return (this.reliableColor.equals(that.reliableColor()))
     && (this.unreliableColor.equals(that.unreliableColor()))
     && (this.viewOptions.equals(that.viewOptions()));
 }
 return false;
}

代码示例来源:origin: rherrmann/eclipse-extras

private static boolean equals( Color color1, Color color2 ) {
  return color1.getRGB().equals( color2.getRGB() );
 }
}

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

private void putColor(String property, RGB setting) {
  Color oldColor = fColorTable.get(property);
  if (oldColor != null) {
    if (oldColor.getRGB().equals(setting))
      return;
    oldColor.dispose();
  }
  fColorTable.put(property, new Color(Display.getCurrent(), setting));
}

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

private void checkForColorUpdate(Display display) {
  if (fIsUsingSystemBackground) {
    RGB bg= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
    if (!bg.equals(getBackground(display))) {
      updateColors(display);
    }
  }
}

代码示例来源:origin: BiglySoftware/BiglyBT

private boolean setForeground(final RGB rgb) {
  Color colorFG = getForeground();
  boolean changed = colorFG == null || colorFG.isDisposed()
      || !colorFG.getRGB().equals(rgb);
  if (changed) {
    Utils.execSWTThread(new AERunnable() {
      @Override
      public void runSupport() {
        setForeground(ColorCache.getColor(Display.getCurrent(), rgb));
      }
    });
  }
  return changed;
}

代码示例来源:origin: BiglySoftware/BiglyBT

private boolean setForeground(final RGB rgb) {
  Color colorFG = getForegroundSWT();
  boolean changed = colorFG == null || colorFG.isDisposed()
      || !colorFG.getRGB().equals(rgb);
  if (changed) {
    Utils.execSWTThread(new SWTRunnable() {
      @Override
      public void runWithDisplay(Display display) {
        setForeground(ColorCache.getColor(Display.getCurrent(), rgb));
      }
    });
  }
  return changed;
}

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

/**
   * Sets the current value of the preference with the given name
   * in the given preference store.
   *
   * @param store the preference store
   * @param name the name of the preference
   * @param value the new current value of the preference
   */
  public static void setValue(IPreferenceStore store, String name, RGB value) {
    RGB oldValue = getColor(store, name);
    if (oldValue == null || !oldValue.equals(value)) {
      store.putValue(name, StringConverter.asString(value));
      store.firePropertyChangeEvent(name, oldValue, value);
    }
  }
}

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

/**
   * Sets the current value of the preference with the given name
   * in the given preference store.
   *
   * @param store the preference store
   * @param name the name of the preference
   * @param value the new current value of the preference
   */
  public static void setValue(IPreferenceStore store, String name, RGB value) {
    RGB oldValue = getColor(store, name);
    if (oldValue == null || !oldValue.equals(value)) {
      store.putValue(name, StringConverter.asString(value));
      store.firePropertyChangeEvent(name, oldValue, value);
    }
  }
}

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

/**
   * Sets the current value of the preference with the given name
   * in the given preference store.
   *
   * @param store the preference store
   * @param name the name of the preference
   * @param value the new current value of the preference
   */
  public static void setValue(IPreferenceStore store, String name, RGB value) {
    RGB oldValue = getColor(store, name);
    if (oldValue == null || !oldValue.equals(value)) {
      store.putValue(name, StringConverter.asString(value));
      store.firePropertyChangeEvent(name, oldValue, value);
    }
  }
}

代码示例来源:origin: anb0s/LogViewer

public boolean equals(Object object) {
  if(!(object instanceof RulePreferenceData)) {
    return false;
  }
  RulePreferenceData data = (RulePreferenceData)object;
  if(		data.getPosition() == this.getPosition() &
      data.getBackgroundColor().equals(this.getBackgroundColor()) &
      data.getForegroundColor().equals(this.getForegroundColor()) &
      data.getRuleName().equals(this.getRuleName()) &
      data.getRuleValue().equals(this.getRuleValue()) &
      data.isCaseInsensitive() == this.isCaseInsensitive() &
      data.getMatchMode().equals(this.getMatchMode())) {
    return true;
  }
  return false;
}

代码示例来源:origin: diffplug/gradle-and-eclipse-rcp

private void roundTripTestCase(int r, int g, int b) {
    RGB expected = new RGB(r, g, b);
    RGB yCbCr = ColorPicker.toYCbCr(expected);
    RGB roundTrip = ColorPicker.fromYCbCr(yCbCr);
    if (!expected.equals(roundTrip)) {
      // if they don't match exactly, allow a maximum delta of 1 for rounding errors 
      int deltaR = Math.abs(roundTrip.red - expected.red);
      int deltaG = Math.abs(roundTrip.green - expected.green);
      int deltaB = Math.abs(roundTrip.blue - expected.blue);
      int maxDelta = Math.max(Math.max(deltaR, deltaG), deltaB);
      Assert.assertTrue(maxDelta <= 1);
    }
  }
}

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

private void editColor(ColorDefinition definition, Display display) {
  if (definition == null)
    return;
  RGB currentColor = colorRegistry.getRGB(definition.getId());
  ColorDialog colorDialog = new ColorDialog(display.getActiveShell());
  colorDialog.setRGB(currentColor);
  RGB selectedColor =  colorDialog.open();
  if ((selectedColor != null) && (!selectedColor.equals(currentColor))) {
    setColorPreferenceValue(definition, selectedColor, false);
    setRegistryValue(definition, selectedColor);
    refreshElement(definition);
  }
}

相关文章