Bug 183150 - [RulersGrid] Properties view: Rulers and Grid page: Custom color dialog should use currently selected color
Summary: [RulersGrid] Properties view: Rulers and Grid page: Custom color dialog shoul...
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: 2.0.1   Edit
Assignee: Carson Li CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-04-19 05:57 EDT by Yury Chernikov CLA
Modified: 2007-11-06 09:57 EST (History)
3 users (show)

See Also:


Attachments
Proposed Patch (69.17 KB, text/plain)
2007-11-05 11:04 EST, Carson Li CLA
no flags Details
Proposed patch updated (64.66 KB, text/plain)
2007-11-05 16:30 EST, Carson Li CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yury Chernikov CLA 2007-04-19 05:57:04 EDT
Steps to repeat:
open diagram,
open Rulers and Grid page of its properties,
set some color,
open "custom color" dialog  - selected color is always black

it would be a good thing, if this dialog opened with currently selected color
Comment 1 Alex Shatalin CLA 2007-04-19 06:21:20 EDT
This is applicable for all the property sections allowing to change color. Since generated code just using runtime classes to contribute corresponding property sections, redirecting this request to the runtime team.
Comment 2 Carson Li CLA 2007-10-10 10:29:13 EDT
I have come up with a possible solution but I have a minor problem with the 3rd scenario. We currently have 3 scenarios.

1) In the situation where a "normal" color is being selected (e.g blue), when opening up the palette, and clicking "custom colors", the dialog will be opened up automatically selected to blue, that's because blue exists. No problem

2) If a "custom color" was chosen where you elected to "add to custom colors", in the section near the bottom of the dialog, the dialog would also open up with that color selected as default. No problem

3) Choose your custom color, but don't add this custom color to the bottom of the dialog. you use the color and later on when you open up the palette, since the color does not exist on this palette, the default color, black will be chosen. however if you open up the "define custom colors" palette, the specifics of the color are still preserved

in terms of usability I think this is fine, because automatically adding the custom color would render the "add custom color" action useless.  There are 16 slots for the user to define custom colors, and how he/she deals with adding them should also be their concern.  Therefore, I think defaulting the selection to black would be appropriate under the 3rd scenario. Let me know what you think before I post the proposed fix.
Comment 3 Alex Shatalin CLA 2007-10-12 06:49:54 EDT
(In reply to comment #2)
Looks reasonable for me. Can we select corresponding color on the "rainbow" if user pressed "Define custom colors" button in 3)?
Comment 4 Carson Li CLA 2007-10-12 09:21:42 EDT
(In reply to comment #3)
> (In reply to comment #2)
> Looks reasonable for me. Can we select corresponding color on the "rainbow" if
> user pressed "Define custom colors" button in 3)?

yes you can, i should have said this earlier, but basically the behaviour of this palette is using the color palette in windows paint as a standard (open paint, color tab, more colors)
Comment 5 Carson Li CLA 2007-11-05 11:04:37 EST
Created attachment 82101 [details]
Proposed Patch

The proposed patch includes a number of fixes.
#1) Sets the last color used as the initial color selected for the windows color palette.  This involves the fontColor, lineColor, and fillColor on the toolbar. The fix occurs in ColorPropertyContributionItem.java.

#2) Same as above except instead of the toolbar, the fix is in the appearance properties view.  (i.e ColorsAndFontsPropertySection.java)

#3) Same as problem #1, except instead of the toolbar, the fix is in the Rulers&Grid section, in specific, the grid line color. (i.e RulerGridPropertySection.java)

#4) Fixed the overlay image on the grid line color.  Now you can see what color you selected by simply looking at the icon. (the overlay image is that thin strip of color below the brush)

Note: I have moved the static class ColorOverlayImageDescriptor out of ColorsAndFontsPropertySection and placed the class in the package "org.eclipse.gmf.runtime.diagram.ui.properties.internal".
This was done since the apperance and the gridline property section both use this class.  Also this way, future proprety sections can also use this class.
Comment 6 Carson Li CLA 2007-11-05 16:30:40 EST
Created attachment 82128 [details]
Proposed patch updated

Minor fixes from the patch proposed before.
1) the dispose method in RulerGridPropertySection was changed to private
2) the ColorOverlayImageDescriptor static class was put back into ColorsAndFontPropertySection and the RulerGridPropertySection because the original class was protected and placed in the ColorsAndFontPropertySection.
Comment 7 Cherie Revells CLA 2007-11-06 09:00:13 EST
Contributed Carson's patch.
Comment 8 Eclipse Webmaster CLA 2010-07-19 12:30:27 EDT
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug