Bug 215710 - Compare does not allow a CompareConfiguration subclass or an ICompareInputLabelProvider to clear existing labels/images
Summary: Compare does not allow a CompareConfiguration subclass or an ICompareInputLab...
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Compare-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2008-01-17 16:10 EST by Ben Pryor CLA
Modified: 2019-09-06 16:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Pryor CLA 2008-01-17 16:10:35 EST
Build ID: M20070921-1145

Steps To Reproduce:
Consider a situation in which a structure compare is done, and the implementation wants to display a per-sub-item label and/or image each time an item is selected for a content comparison. In Eclipse 3.2 and lower this was possible. Starting with Eclipse 3.3, if null is returned from: CompareConfiguration#get*Label(), ICompareInputLabelProvider#get*Label(), CompareConfiguratio#get*Image(), ICompareInputLabelProvider#get*Image(), then any existing label or image is preserved instead of cleared.

More information:
In ContentMergeViewer#updateHeader() in Eclipse 3.3, the implementation was changed. Now if null is returned, the underlying CLabel widget is not updated. Previously (Eclipse 3.2 and lower), when null was encountered, it was set into the underlying CLabel widget, clearing its old contents.
Comment 1 Tomasz Zarna CLA 2008-01-18 07:59:24 EST
Ben, I do understand your concern, but imo updating a label/image only if there is a new label/image available is a step forward. A workaround for your problem would be to make the methods you mentioned return respectively "" (an empty string) or an empty image. Moreover, you are free to override the method and modify it's behavior to suit your needs. How does it sound?
Comment 2 Ben Pryor CLA 2008-01-18 09:46:00 EST
OK, if it is by design, I can work around it. Note that subclassing ContentMergeViewer and overriding updateHeader() isn't an option, since the CLabel widget fields are private.

I also think the Javadoc for CompareConfiguration and ICompareInputLabelProvider should be updated. Right now the Javadoc seems to indicate that returning null from get*Label() or get*Image() is meaningful, and the documentation should be updated to reflect the actual behavior.

Finally, I am trying to figure out the best way to create an empty Image. This is what I have come up with so far - is there something easier?

    ImageData imageData = new ImageData(1, 1, 1, new PaletteData(new RGB[] {              
        new RGB(0, 0, 0) }));
    imageData.transparentPixel = imageData.palette.getPixel(new RGB(0, 0, 0));
    Image image = new Image(Display.getDefault(), imageData); 
Comment 3 Michael Valenta CLA 2008-01-18 10:21:01 EST
Ideally, it would be good if we could get the old behavior back so that the behavior of existing clients isn't changed. However, it is possible that the behaviour was changed for a reason so we would need to investigate why it changed.
Comment 4 Eclipse Webmaster CLA 2019-09-06 16:18:47 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.