Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 25124 Details for
Bug 104280
Support the 'toolbar' button on OS X
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch against org.eclipse.ui.carbon
Bug104280-Carbon-2.txt (text/plain), 7.90 KB, created by
Kim Horne
on 2005-07-21 08:47:12 EDT
(
hide
)
Description:
Patch against org.eclipse.ui.carbon
Filename:
MIME Type:
Creator:
Kim Horne
Created:
2005-07-21 08:47:12 EDT
Size:
7.90 KB
patch
obsolete
>Index: .settings/org.eclipse.jdt.core.prefs >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.carbon/.settings/org.eclipse.jdt.core.prefs,v >retrieving revision 1.5 >diff -u -r1.5 org.eclipse.jdt.core.prefs >--- .settings/org.eclipse.jdt.core.prefs 22 Jun 2005 19:35:03 -0000 1.5 >+++ .settings/org.eclipse.jdt.core.prefs 21 Jul 2005 12:45:11 -0000 >@@ -1,4 +1,4 @@ >-#Wed May 25 13:12:47 EDT 2005 >+#Mon Jul 18 11:56:01 EDT 2005 > eclipse.preferences.version=1 > org.eclipse.jdt.core.builder.cleanOutputFolder=clean > org.eclipse.jdt.core.builder.duplicateResourceTask=warning >@@ -28,7 +28,7 @@ > org.eclipse.jdt.core.compiler.problem.deprecation=warning > org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled > org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled >-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning >+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore > org.eclipse.jdt.core.compiler.problem.emptyStatement=warning > org.eclipse.jdt.core.compiler.problem.enumIdentifier=error > org.eclipse.jdt.core.compiler.problem.fieldHiding=warning >Index: .settings/org.eclipse.jdt.ui.prefs >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.carbon/.settings/org.eclipse.jdt.ui.prefs,v >retrieving revision 1.2 >diff -u -r1.2 org.eclipse.jdt.ui.prefs >--- .settings/org.eclipse.jdt.ui.prefs 25 May 2005 18:19:27 -0000 1.2 >+++ .settings/org.eclipse.jdt.ui.prefs 21 Jul 2005 12:45:11 -0000 >@@ -1,5 +1,6 @@ >-#Tue Apr 26 09:53:11 EDT 2005 >+#Mon Jul 18 11:56:01 EDT 2005 > eclipse.preferences.version=1 >+internal.default.compliance=user > org.eclipse.jdt.ui.exception.name=e > org.eclipse.jdt.ui.gettersetter.use.is=true > org.eclipse.jdt.ui.javadoc=false >Index: src/org/eclipse/ui/carbon/CarbonUIEnhancer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.carbon/src/org/eclipse/ui/carbon/CarbonUIEnhancer.java,v >retrieving revision 1.10 >diff -u -r1.10 CarbonUIEnhancer.java >--- src/org/eclipse/ui/carbon/CarbonUIEnhancer.java 6 Jul 2005 09:00:11 -0000 1.10 >+++ src/org/eclipse/ui/carbon/CarbonUIEnhancer.java 21 Jul 2005 12:45:11 -0000 >@@ -25,9 +25,12 @@ > import org.eclipse.swt.widgets.Menu; > import org.eclipse.swt.widgets.MenuItem; > import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Widget; > import org.eclipse.ui.IStartup; >+import org.eclipse.ui.IWindowListener; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.WorkbenchWindow; > > /** > * The CarbonUIEnhancer provides the standard "About" and "Preference" menu items >@@ -44,6 +47,7 @@ > private static final int kHICommandServices = ('s' << 24) + ('e' << 16) + ('r' << 8) + 'v'; > > private static final String RESOURCE_BUNDLE = "org.eclipse.ui.carbon.Messages"; //$NON-NLS-1$ >+ private static final String TOOLBAR_BUTTON_TOGGLE_FLAGS = "toolbarButtonToggleFlags"; //$NON-NLS-1$ > > private String fAboutActionName; > >@@ -79,12 +83,145 @@ > final Display display = Display.getDefault(); > display.syncExec(new Runnable() { > public void run() { >- hookApplicationMenu(display); >- } >+ hookApplicationMenu(display); >+ hookToolbarButtonCallback(); >+ hookWorkbenchListener(); >+ // modify all shells opened on startup >+ IWorkbenchWindow[] windows = PlatformUI.getWorkbench() >+ .getWorkbenchWindows(); >+ for (int i = 0; i < windows.length; i++) { >+ modifyWindowShell(windows[i]); >+ } >+ } > }); > } > > /** >+ * Hooks a listener that tweaks newly opened workbench window shells with >+ * the proper OS flags. >+ * >+ * @since 3.2 >+ */ >+ protected void hookWorkbenchListener() { >+ PlatformUI.getWorkbench().addWindowListener(new IWindowListener() { >+ >+ public void windowActivated(IWorkbenchWindow window) { >+ // no-op >+ } >+ >+ public void windowDeactivated(IWorkbenchWindow window) { >+ // no-op >+ } >+ >+ public void windowClosed(IWorkbenchWindow window) { >+ // no-op >+ } >+ >+ public void windowOpened(IWorkbenchWindow window) { >+ modifyWindowShell(window); >+ }}); >+ } >+ >+ /** >+ * Modify the given workbench window shell bits to show the toolbar toggle >+ * button. >+ * >+ * @param window >+ * the window to modify >+ * @since 3.2 >+ */ >+ protected void modifyWindowShell(IWorkbenchWindow window) { >+ // only add the button when either the coolbar or perspectivebar >+ // is initially visible. This is so that RCP apps can choose to use >+ // this fragment without fear that their explicitly invisble bars >+ // can't be shown. >+ boolean coolBarInitiallyVsible = ((WorkbenchWindow) window) >+ .getCoolBarVisible(); >+ boolean perspectiveBarInitiallyVsible = ((WorkbenchWindow) window) >+ .getPerspectiveBarVisible(); >+ >+ if (coolBarInitiallyVsible || perspectiveBarInitiallyVsible) { >+ // modify the newly opened window with the correct OS X >+ // style bits such that it possesses the toolbar button >+ Shell shell = window.getShell(); >+ boolean[] switchArray = new boolean[] { coolBarInitiallyVsible, >+ perspectiveBarInitiallyVsible }; >+ shell.setData(TOOLBAR_BUTTON_TOGGLE_FLAGS, switchArray); >+ int windowHandle = OS.GetControlOwner(shell.handle); >+ OS.ChangeWindowAttributes(windowHandle, >+ OS.kWindowToolbarButtonAttribute, 0); >+ } >+ } >+ >+ /** >+ * Hook the window toolbar button to toggle the visibility of the coolbar >+ * and perspective bar. >+ * >+ * @since 3.2 >+ */ >+ protected void hookToolbarButtonCallback() { >+ Object target = new Object() { >+ int toolbarProc (int nextHandler, int theEvent, int userData) { >+ int eventKind = OS.GetEventKind (theEvent); >+ if (eventKind != OS.kEventWindowToolbarSwitchMode) >+ return OS.eventNotHandledErr; >+ >+ int [] theWindow = new int [1]; >+ OS.GetEventParameter (theEvent, OS.kEventParamDirectObject, OS.typeWindowRef, null, 4, null, theWindow); >+ >+ int [] theRoot = new int [1]; >+ OS.GetRootControl (theWindow [0], theRoot); >+ Widget widget = Display.getCurrent().findWidget(theRoot [0]); >+ >+ if (!(widget instanceof Shell)) { >+ return OS.eventNotHandledErr; >+ } >+ Shell shell = (Shell) widget; >+ IWorkbenchWindow[] windows = PlatformUI.getWorkbench() >+ .getWorkbenchWindows(); >+ for (int i = 0; i < windows.length; i++) { >+ if (windows[i].getShell() == shell) { >+ WorkbenchWindow castedWindow = (WorkbenchWindow) windows[i]; >+ // get the switch flags that were set on the shell by >+ // the window listener >+ boolean[] switchFlags = (boolean[]) shell >+ .getData(TOOLBAR_BUTTON_TOGGLE_FLAGS); >+ if (switchFlags == null) >+ return OS.eventNotHandledErr; >+ boolean coolbarVisible = castedWindow >+ .getCoolBarVisible(); >+ boolean perspectivebarVisible = castedWindow >+ .getPerspectiveBarVisible(); >+ // only toggle the visibility of the components that >+ // were on initially >+ if (switchFlags[0]) >+ castedWindow.setCoolBarVisible(!coolbarVisible); >+ if (switchFlags[1]) >+ castedWindow >+ .setPerspectiveBarVisible(!perspectivebarVisible); >+ shell.layout(); >+ return OS.noErr; >+ } >+ } >+ return OS.eventNotHandledErr; >+ } >+ >+ }; >+ >+ final Callback commandCallback = new Callback(target, "toolbarProc", 3); //$NON-NLS-1$ >+ int commandProc = commandCallback.getAddress(); >+ if (commandProc == 0) { >+ commandCallback.dispose(); >+ return; // give up >+ } >+ >+ int[] mask = new int[] { OS.kEventClassWindow, OS.kEventWindowToolbarSwitchMode }; >+ OS.InstallEventHandler(OS.GetApplicationEventTarget(), commandProc, >+ mask.length / 2, mask, 0, null); >+ >+ } >+ >+ /** > * See Apple Technical Q&A 1079 (http://developer.apple.com/qa/qa2001/qa1079.html) > */ > private void hookApplicationMenu(Display display) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 104280
:
24950
|
24952
| 25124