Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Problems with ColorDialog in combination with Browser on Macos
Problems with ColorDialog in combination with Browser on Macos [message #691118] Thu, 30 June 2011 18:39 Go to next message
Tom Seidel is currently offline Tom Seidel
Messages: 90
Registered: July 2009
Member
Hi,

I have a very strange problem with the Color-Dialog on Mac.

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. Any ideas how to avoid this behavior?

Thx,
Tom

Here's the snippet:

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();
	}
}


Re: Problems with ColorDialog in combination with Browser on Macos [message #692400 is a reply to message #691118] Mon, 04 July 2011 11:37 Go to previous message
Lakshmi Shanmugam
Messages: 274
Registered: July 2009
Location: India
Senior Member
Hi,

This looks like a bug, please open a bug with SWT here --> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=SWT

Thanks.


Lakshmi P Shanmugam
Previous Topic:How to initiate an inactive view in an IFolderLayout
Next Topic:org.eclipse.swt.SWTException: Widget is disposed
Goto Forum:
  


Current Time: Thu Oct 02 04:48:36 GMT 2014

Powered by FUDForum. Page generated in 0.09889 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software