Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 351107

Summary: ColorDialog returns null while an embedded browser with Richtext has a selection
Product: [Eclipse Project] Platform Reporter: Tom Seidel <tom.seidel>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, grant_gayed, remy.suen
Version: 3.7   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug

Description Tom Seidel CLA 2011-07-04 12:54:08 EDT
Copied from http://www.eclipse.org/forums/index.php/t/217160/

Steps to reproduce:

1. Launch the snippet
2. Wait until the browser-page is loaded completely
3. Select any text in the rich-text of the html-page
4. Press the Color-Button on top of the shell and choose a color.
5. The dialog returns null and the text in the browser has now the color of the chosen color.

I've tried this with Eclipse 3.6. and 3.7 on Snowleopard.

----8<-----------

package snippets;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;

public class Snippet {

	public static void main(String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell(display, SWT.SHELL_TRIM);
		shell.setLayout(new GridLayout());
		ToolBar toolBar = new ToolBar(shell, SWT.NONE);
		ToolBarManager toolBarManager = new ToolBarManager(toolBar);
		toolBarManager.add(new Action("Color") {
			public void run() {
				RGB open = new ColorDialog(shell).open();
				System.out.println(open);
			};
			
		});
		toolBarManager.update(true);
		toolBar.setLayoutData(new GridData(SWT.FILL,SWT.BEGINNING,true,false));
		Browser browser = new Browser(shell, SWT.NONE);
		browser.setUrl("http://ckeditor.com/demo");
		browser.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));

		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}
Comment 1 Felipe Heidrich CLA 2011-07-05 11:27:38 EDT
Grant, are you at fault here ?
or is it a bug in the user-agent ?
Comment 2 Felipe Heidrich CLA 2011-07-05 11:28:23 EDT
(In reply to comment #1)
> Grant, are you at fault here ?
by you I mean we (and by we I mean SWT).
sorry
Comment 3 Lars Vogel CLA 2019-11-14 03:13:11 EST
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.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.