From: <bh...@us...> - 2006-12-15 16:28:44
|
Revision: 350 http://svn.sourceforge.net/cishell/?rev=350&view=rev Author: bh2 Date: 2006-12-15 08:28:26 -0800 (Fri, 15 Dec 2006) Log Message: ----------- Committing fix to allow Swing/AWT based algorithms (visualizations) to work on Mac OSX Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/Activator.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/Activator.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/Activator.java 2006-12-11 20:29:25 UTC (rev 349) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/Activator.java 2006-12-15 16:28:26 UTC (rev 350) @@ -5,9 +5,12 @@ import org.cishell.reference.gui.menumanager.menu.MenuAdapter; import org.cishell.reference.gui.workspace.CIShellApplication; import org.eclipse.jface.action.IMenuManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.awt.SWT_AWT; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IStartup; import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -48,11 +51,22 @@ windows = getWorkbench().getWorkbenchWindows(); } - Shell shell = windows[0].getShell(); + final Shell shell = windows[0].getShell(); IMenuManager menuManager = CIShellApplication.getMenuManager(); CIShellContext ciContext = new LocalCIShellContext(context); menuAdapter = new MenuAdapter(menuManager,shell,context,ciContext); + + try { + //Fix to make swing based algorithms work on Macs + shell.getDisplay().syncExec(new Runnable(){ + public void run() { + //This will simply initialize the SWT_AWT compatibility mode + SWT_AWT.new_Frame(new Shell(SWT.EMBEDDED)); + }}); + } catch (Exception e) { + e.printStackTrace(); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |