Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 385795 - [TabbedProperties] Need support for changing color of a tab-label and displaying dynamic images on a tab in Tabbed Properties View
Summary: [TabbedProperties] Need support for changing color of a tab-label and display...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.3 M2   Edit
Assignee: Paul Webster CLA
QA Contact: Anthony Hunter CLA
URL:
Whiteboard:
Keywords:
Depends on: 386417
Blocks:
  Show dependency tree
 
Reported: 2012-07-23 17:41 EDT by Amit Joglekar CLA
Modified: 2012-09-07 14:18 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix for this defect (148.49 KB, patch)
2012-07-23 17:55 EDT, Amit Joglekar CLA
no flags Details | Diff
Information about the proposed fix (21.50 KB, text/plain)
2012-07-23 17:58 EDT, Amit Joglekar CLA
no flags Details
Information about the proposed fix (1.86 KB, text/plain)
2012-07-23 18:04 EDT, Amit Joglekar CLA
no flags Details
Proposed fix for this defect (16.42 KB, patch)
2012-07-25 11:04 EDT, Amit Joglekar CLA
no flags Details | Diff
Proposed fix for this defect (10.87 KB, patch)
2012-08-01 18:51 EDT, Amit Joglekar CLA
no flags Details | Diff
Information about the proposed fix (1.92 KB, text/plain)
2012-08-01 18:56 EDT, Amit Joglekar CLA
no flags Details
Proposed fix for this defect (10.96 KB, patch)
2012-08-06 18:22 EDT, Amit Joglekar CLA
no flags Details | Diff
Information about the proposed fix (1.94 KB, text/plain)
2012-08-06 18:23 EDT, Amit Joglekar CLA
no flags Details
Proposed fix for this defect (8.15 KB, patch)
2012-08-29 17:25 EDT, Amit Joglekar CLA
no flags Details | Diff
Information about the proposed fix (1.10 KB, text/plain)
2012-08-29 17:26 EDT, Amit Joglekar CLA
no flags Details
Added / modified JUnit tests for bug fixes 386417 and 385795 (22.31 KB, patch)
2012-08-29 17:41 EDT, Amit Joglekar CLA
no flags Details | Diff
Information about the proposed fix (1.09 KB, text/plain)
2012-09-04 12:48 EDT, Amit Joglekar CLA
no flags Details
Code changes that address the review comments. (3.80 KB, patch)
2012-09-04 12:54 EDT, Amit Joglekar CLA
no flags Details | Diff
Code changes that address additional review comments in #17 (5.62 KB, patch)
2012-09-07 12:17 EDT, Amit Joglekar CLA
no flags Details | Diff
Code changes that address additional review comments in #17 (7.26 KB, patch)
2012-09-07 13:35 EDT, Amit Joglekar CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Joglekar CLA 2012-07-23 17:41:11 EDT
Build Identifier: Latest release / Juno

The Eclipse Tabbed Properties Framework does not support tab-decorations i.e. dynamic images on tabs or dynamically changing color of a tab label. Tab labels are always displayed in black-color. An image can be added to a tab using propertyTabs extension in plugin.xml; the image is displayed when the tab is in selected state otherwise it is not displayed. But the image is not dynamic enough because one cannot programatically control whether an image should be displayed or not.

This fix can be used to improve usability of tabbed properties UI because tab-decorations can be used to convey, at a glance, information about current state of UI on a tab.

The fix should make a provision for possibly setting different number of images for different tabs.

Reproducible: Always
Comment 1 Amit Joglekar CLA 2012-07-23 17:55:16 EDT
Created attachment 219083 [details]
Proposed fix for this defect
Comment 2 Amit Joglekar CLA 2012-07-23 17:58:15 EDT
Created attachment 219084 [details]
Information about the proposed fix
Comment 3 Amit Joglekar CLA 2012-07-23 18:04:30 EDT
Created attachment 219085 [details]
Information about the proposed fix
Comment 4 Paul Webster CLA 2012-07-24 10:08:42 EDT
Hi Amit,

I'd like to have a quick look at your patch, but right now it includes a lot of extraneous changes.

It looks like you did use git to generate your patch, http://git.eclipse.org/c/platform/eclipse.platform.ui.git which is good, but it includes too much stuff.

Could you please re-generate your patch?

PW
Comment 5 Amit Joglekar CLA 2012-07-25 11:04:40 EDT
Created attachment 219163 [details]
Proposed fix for this defect

Thanks Paul for helping me with recreating the right patch. Please review the changes and let me know your comments.
Comment 6 Amit Joglekar CLA 2012-08-01 18:51:59 EDT
Created attachment 219462 [details]
Proposed fix for this defect

Note: This patch should be applied on top of patch for another bug 386417 (A tab label in Tabbed Properties View is cut-off towards right-side).
Comment 7 Amit Joglekar CLA 2012-08-01 18:56:18 EDT
Created attachment 219463 [details]
Information about the proposed fix
Comment 8 Amit Joglekar CLA 2012-08-06 18:22:39 EDT
Created attachment 219600 [details]
Proposed fix for this defect

Added one more protected method viz getCurrentSelection() to TabbedPropertySheetPage class.
Comment 9 Amit Joglekar CLA 2012-08-06 18:23:57 EDT
Created attachment 219601 [details]
Information about the proposed fix
Comment 10 Paul Webster CLA 2012-08-14 09:46:42 EDT
(In reply to comment #8)
> Created attachment 219600 [details]
> Proposed fix for this defect

The use of this interface needs to be included in the static and dynamic JUnit tests for the Tabbed Properties view.  We'll need an updated patch for that.

PW
Comment 11 Amit Joglekar CLA 2012-08-29 17:25:11 EDT
Created attachment 220489 [details]
Proposed fix for this defect



Removed ISectionDescriptorProvider2 from the earlier patch because it is not necessary anymore. Rolled back the changes in TabbedPropertyRegistry because those changes are not needed any more after ISectionDescriptorProvider2 has been removed.

Note: Apply this patch on top of the patch for another bug 386417 in TabbedPropertyList class (Title: A tab label in Tabbed Properties View is cut-off towards right-side).
Comment 12 Amit Joglekar CLA 2012-08-29 17:26:55 EDT
Created attachment 220490 [details]
Information about the proposed fix
Comment 13 Amit Joglekar CLA 2012-08-29 17:41:08 EDT
Created attachment 220491 [details]
Added / modified JUnit tests for bug fixes 386417 and 385795


I have included JUnit tests for bug fixes 386417 and 385795 in one single patch because I could not figure out how to separate those changes in my Git environment. Sorry for the inconvenience this may cause. These two bug-fixes are interdependent, so it seemed okay to combine JUnit tests for both.

To try out these changes, apply the patches in following sequence:
1. Apply patch for another bug 386417 in TabbedPropertyList class (Title: A tab label in Tabbed Properties View is cut-off towards right-side)
2. Apply patch for proposed fix for this bug#385795
3. Apply patch for JUnit tests for bug fixes 386417 and 385795

Added a new helper method named getWidestLabelIndex() to TabbedPropertyList class. This method is used only in JUnit tests.

Following changes test fix for bug 386417:
1. New GIF icons for error, information and warning
2. Changes in plugin.xml to display these icons on corresponding tabs
3. Three new tests in TabbedPropertySheetPageTest suite. One of these tests, test_widestLabelIndex3(), fails in the absence of fix for bug 386417.

Other changes test fix for bug 385795.
Comment 14 Amit Joglekar CLA 2012-09-04 12:48:43 EDT
Created attachment 220690 [details]
Information about the proposed fix
Comment 15 Amit Joglekar CLA 2012-09-04 12:54:23 EDT
Created attachment 220691 [details]
Code changes that address the review comments.

This patch should be applied on top of the three patches described in the previous comment. Apply the patches in following sequence:
1. Apply patch for another bug 386417 in TabbedPropertyList class (Title: A tab label in Tabbed Properties View is cut-off towards right-side)
2. Apply patch for proposed fix for this bug#385795
3. Apply patch for JUnit tests for bug fixes 386417 and 385795
4. Apply patch that addresses the review comments
Comment 16 Paul Webster CLA 2012-09-06 13:30:36 EDT
I've pushed your combined changes up to a topic branch in our git repo, that's what we'll review against.  Please give it a quick once over, I followed the steps in comment #15 and all elements appear to be there.


It will be visible on git.eclipse.org and http://github.com/eclipse.

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=869e212de39a901e2165957835e7c9bc478c4bdc

PW
Comment 17 Paul Webster CLA 2012-09-06 15:32:54 EDT
(In reply to comment #16)
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=869e212de39a901e2165957835e7c9bc478c4bdc

Overall, it looks good.

1)

@@ -606,7 +607,10 @@ public class TabbedPropertySheetPage
}
}
- private void disposeTabs(Collection tabs) {
+ /**
+ * @since 3.6
+ */
+ protected void disposeTabs(Collection tabs) {

when you make this protected, you should update the javadoc to describe any pre/post conditions.  ex, the tabs this method disposes must not include the current tab (or it has to have been reset before this method is called).

Also the disposed tabs have to somehow be removed from descriptorToTab (or if they're all disposed, it needs to be reset), like org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.updateTabs(ITabDescriptor[]) or org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.disposeContributor()

2)

The tests are fine and check tab widths.  But you need 2 or 3 tests that test adding the images and seeing that they're used correctly, showDynamicImage and hide, and setTextColor.

Could you try and base your changes off of the commit above?  Either a patch against that, or a commit from a fork at http://github.com/

PW
Comment 18 Amit Joglekar CLA 2012-09-07 12:17:29 EDT
Created attachment 220847 [details]
Code changes that address additional review comments in #17


I verified the contents on pwebster/bug385795 branch. This patch has been created on top of those changes, it addresses review comments #17.

Do we need to add @since annotation for newly added/changed methods in TabbedPropertyList and TabbedPropertyList.ListElement classes?

Changes in this patch:
1. Added null check in setTextColor() method of TabbedPropertyList.ListElement
2. Added JavaDoc to disposeTabs() method in TabbedPropertySheetPage class
3. Modified the test-class TabbedPropertySheetPageWithDecorations to invoke newly added methods in TabbedPropertyList.ListElement
Comment 19 Amit Joglekar CLA 2012-09-07 13:35:58 EDT
Created attachment 220848 [details]
Code changes that address additional review comments in #17


Added a couple more JavaDoc comments to TabbedPropertyList class.