Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332291 - [JavaScript-Bridging] Background and Foreground color
Summary: [JavaScript-Bridging] Background and Foreground color
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 1.6.0   Edit
Assignee: Tom Seidel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-10 06:06 EST by Tom Seidel CLA
Modified: 2011-06-30 17:34 EDT (History)
2 users (show)

See Also:


Attachments
Patch with two new commands for setting the colors (4.23 KB, patch)
2010-12-10 08:56 EST, Tom Seidel CLA
no flags Details | Diff
mylyn/context/zip (2.15 KB, application/octet-stream)
2011-06-30 17:34 EDT, Tom Seidel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Seidel CLA 2010-12-10 06:06:36 EST
Setting the back- and foreground color for the current selection. This two commands are TriState commands and dependent from the current selection.
Comment 1 Tom Seidel CLA 2010-12-10 08:56:02 EST
Created attachment 184954 [details]
Patch with two new commands for setting the colors
Comment 2 salever CLA 2010-12-12 01:39:00 EST
I tested the patch, and it works. Here is BackgroundAction:

public class BackgroundAction extends AbstractCommandWrapper {

	public BackgroundAction(HtmlComposer composer) {
		super("Background", IAction.AS_CHECK_BOX, composer); 
                //Missing icon...
	}

	@Override
	protected Command getWrappedCommand() {
		return new SetBackgroundColorCommand();
	}

	public void run() {

		ColorDialog dialog = new ColorDialog(this.composer.getShell());
		RGB rgb = dialog.open();
		if (rgb != null) {
			((SetBackgroundColorCommand) getWrappedCommand()).setColor(rgb);
			super.run();
		}
	}

}
Comment 3 salever CLA 2010-12-14 03:54:32 EST
(In reply to comment #2)
> I tested the patch, and it works. Here is BackgroundAction:
> 
> public class BackgroundAction extends AbstractCommandWrapper {
> 
>     public BackgroundAction(HtmlComposer composer) {
>         super("Background", IAction.AS_CHECK_BOX, composer); 
>                 //Missing icon...
>     }
> 
>     @Override
>     protected Command getWrappedCommand() {
>         return new SetBackgroundColorCommand();
>     }
> 
>     public void run() {
> 
>         ColorDialog dialog = new ColorDialog(this.composer.getShell());
>         RGB rgb = dialog.open();
>         if (rgb != null) {
>             ((SetBackgroundColorCommand) getWrappedCommand()).setColor(rgb);
>             super.run();
>         }
>     }
> 
> }

  ((SetBackgroundColorCommand) getWrappedCommand()).setColor(rgb); should be
 ((SetBackgroundColorCommand) wrappedCommand).setColor(rgb);
Comment 4 salever CLA 2010-12-16 22:55:40 EST
I tested the demo at http://ckeditor.com/demo

Under MAC OS, default browser Safari ,version 5.0.2, set background and foreground color works well. And with Firefox 3.6.13, set background and foreground color also works well.

But using CKEditor in RCP in MAC, set foreground color command behaves like set background color command.
Comment 5 Tom Seidel CLA 2011-06-30 17:08:13 EDT
I have tested this and can reproduce the problem.

There seems to be a problem with the ColorDialog in this scenario. This is not a problem of the HtmlComposer but rather a problem of SWT. I have posted already on the SWT Newsgroup with a reproducable snippet, see http://www.eclipse.org/forums/index.php/t/217160/

You have to provide your own colorchooser dialog in the action to work around this problem, the commands are working like expected.

Closing this as fixed and pushing it to the repository.
Comment 6 Tom Seidel CLA 2011-06-30 17:34:16 EDT
Created attachment 198936 [details]
mylyn/context/zip