Java Code Examples for org.eclipse.swt.graphics.Image#equals()

The following examples show how to use org.eclipse.swt.graphics.Image#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomMessageDialog.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
private String getAccessibleMessageFor(Image image) {
	if (image.equals(getErrorImage())) {
		return JFaceResources.getString("error");//$NON-NLS-1$
	}

	if (image.equals(getWarningImage())) {
		return JFaceResources.getString("warning");//$NON-NLS-1$
	}

	if (image.equals(getInfoImage())) {
		return JFaceResources.getString("info");//$NON-NLS-1$
	}

	if (image.equals(getQuestionImage())) {
		return JFaceResources.getString("question"); //$NON-NLS-1$
	}

	return null;
}
 
Example 2
Source File: CustomMessageDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private String getAccessibleMessageFor(Image image) {
	if (image.equals(getErrorImage())) {
		return JFaceResources.getString("error");//$NON-NLS-1$
	}

	if (image.equals(getWarningImage())) {
		return JFaceResources.getString("warning");//$NON-NLS-1$
	}

	if (image.equals(getInfoImage())) {
		return JFaceResources.getString("info");//$NON-NLS-1$
	}

	if (image.equals(getQuestionImage())) {
		return JFaceResources.getString("question"); //$NON-NLS-1$
	}

	return null;
}
 
Example 3
Source File: ForkedColorsAndFontsPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Dispose the image if it was created locally to avoid a leak. Do not
 * dispose the images in the registry.
 * 
 * @param image
 */
protected void disposeImage(Image image) {
    if (image == null) {
        return;
    }
    
    if (image.equals(DiagramUIPropertiesImages
        .get(DiagramUIPropertiesImages.IMG_FILL_COLOR))
        || image.equals(DiagramUIPropertiesImages
            .get(DiagramUIPropertiesImages.IMG_LINE_COLOR))
        || image.equals(DiagramUIPropertiesImages
            .get(DiagramUIPropertiesImages.IMG_FONT_COLOR))) {
        return;
    }

    if (! image.isDisposed()) {
        image.dispose();
    }
}
 
Example 4
Source File: TransitionManager.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Update an image related to a control.
 * @param img Image to update.
 * @param ctrlIndex Index of the control related to the image.
 */
private void updateControlImage(Image img, int ctrlIndex) {
    Image previousImg = _images.put(ctrlIndex, img);
    if (previousImg != null && !previousImg.equals(img)) {
        previousImg.dispose();
    }
}
 
Example 5
Source File: UISWTGraphicImpl.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean equals(Object obj) {
	if (super.equals(obj)) {
		return true;
	}
	if (obj instanceof UISWTGraphic) {
		Image img2 = ((UISWTGraphic) obj).getImage();
		if (img2 == null) {
			return img == null;
		}
		return img2.equals(img);
	}
	return false;
}
 
Example 6
Source File: BonitaRulerGridPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void disposeImage(Image image) {
	if (image == null) {
		return;
	}

	if (image.equals(DiagramUIPropertiesImages
			.get(DiagramUIPropertiesImages.IMG_LINE_COLOR))) {
		return;
	}

	if (!image.isDisposed()) {
		image.dispose();
	}
}