Bug 376394 - Provide menu item to toggle fullscreen on MacOS X Lion
diff --git a/bundles/org.eclipse.ui.cocoa/fragment-cocoa.properties b/bundles/org.eclipse.ui.cocoa/fragment-cocoa.properties
index 7bb5021..07070b5 100644
--- a/bundles/org.eclipse.ui.cocoa/fragment-cocoa.properties
+++ b/bundles/org.eclipse.ui.cocoa/fragment-cocoa.properties
@@ -19,8 +19,14 @@
command.minimize.name=Minimize
command.minimize.desc=Minimizes the current window to the Dock
+command.fullscreen.name=Toggle Full Screen
+command.fullscreen.desc=Toggles the window between full screen and normal
+
+command.disengageFullscreen.name=Disengage Full Screen
+command.disengageFullscreen.desc=Disengage the window from full screen mode
+
command.zoom.name=Zoom
command.zoom.desc=Toggles the window between standard state and user state
command.arrangeWindows.name=Bring All to Front
-command.arrangeWindows.desc=Arranges the application windows in front of all windows
\ No newline at end of file
+command.arrangeWindows.desc=Arranges the application windows in front of all windows
diff --git a/bundles/org.eclipse.ui.cocoa/fragment.xml b/bundles/org.eclipse.ui.cocoa/fragment.xml
index de5ac8e..4a510b0 100644
--- a/bundles/org.eclipse.ui.cocoa/fragment.xml
+++ b/bundles/org.eclipse.ui.cocoa/fragment.xml
@@ -38,6 +38,20 @@
id="org.eclipse.ui.cocoa.arrangeWindowsInFront"
name="%command.arrangeWindows.name">
</command>
+ <command
+ categoryId="org.eclipse.ui.category.window"
+ defaultHandler="org.eclipse.ui.internal.cocoa.FullscreenWindowHandler"
+ description="%command.fullscreen.desc"
+ id="org.eclipse.ui.cocoa.fullscreenWindow"
+ name="%command.fullscreen.name">
+ </command>
+ <command
+ categoryId="org.eclipse.ui.category.window"
+ defaultHandler="org.eclipse.ui.internal.cocoa.DisengageFullscreenWindowHandler"
+ description="%command.disengageFullscreen.desc"
+ id="org.eclipse.ui.cocoa.disengageFullscreenWindow"
+ name="%command.disengageFullscreen.name">
+ </command>
</extension>
<extension
point="org.eclipse.ui.bindings">
@@ -55,6 +69,13 @@
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M">
</key>
+ <key
+ commandId="org.eclipse.ui.cocoa.disengageFullscreenWindow"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ platform="cocoa"
+ sequence="Esc">
+ </key>
</extension>
<extension
point="org.eclipse.ui.internalTweaklets">
diff --git a/bundles/org.eclipse.ui.cocoa/src/org/eclipse/ui/internal/cocoa/DisengageFullscreenWindowHandler.java b/bundles/org.eclipse.ui.cocoa/src/org/eclipse/ui/internal/cocoa/DisengageFullscreenWindowHandler.java
new file mode 100644
index 0000000..f6ba865
--- /dev/null
+++ b/bundles/org.eclipse.ui.cocoa/src/org/eclipse/ui/internal/cocoa/DisengageFullscreenWindowHandler.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Brian de Alwis and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Brian de Alwis - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ui.internal.cocoa;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * @since 3.8
+ */
+public class DisengageFullscreenWindowHandler extends AbstractWindowHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final Shell activeShell = HandlerUtil.getActiveShell(event);
+ if (activeShell != null && !activeShell.isDisposed() && activeShell.getFullScreen()) {
+ activeShell.setFullScreen(false);
+ activeShell.setActive();
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.ui.cocoa/src/org/eclipse/ui/internal/cocoa/FullscreenWindowHandler.java b/bundles/org.eclipse.ui.cocoa/src/org/eclipse/ui/internal/cocoa/FullscreenWindowHandler.java
new file mode 100644
index 0000000..67b1647
--- /dev/null
+++ b/bundles/org.eclipse.ui.cocoa/src/org/eclipse/ui/internal/cocoa/FullscreenWindowHandler.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Brian de Alwis and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Brian de Alwis - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.ui.internal.cocoa;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+/**
+ * @since 3.8
+ */
+public class FullscreenWindowHandler extends AbstractWindowHandler {
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ Shell activeShell = HandlerUtil.getActiveShell(event);
+ if (activeShell != null && !activeShell.isDisposed()) {
+ activeShell.setFullScreen(!activeShell.getFullScreen());
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
index ba7072a..6b6cb92 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
@@ -203,6 +203,8 @@
private CommandContributionItem zoomItem;
+ private CommandContributionItem fullscreenItem;
+
private CommandContributionItem arrangeWindowsItem;
// contribution items
@@ -647,8 +649,8 @@
windowMenu.add(minimizeItem);
windowMenu.add(zoomItem);
+ windowMenu.add(fullscreenItem);
windowMenu.add(new Separator());
-
}
/**
@@ -882,6 +884,7 @@
introAction = null;
minimizeItem = null;
zoomItem = null;
+ fullscreenItem = null;
arrangeWindowsItem = null;
super.dispose();
}
@@ -1164,6 +1167,9 @@
CommandContributionItemParameter zoomParam = new CommandContributionItemParameter(window, null,
"org.eclipse.ui.cocoa.zoomWindow", CommandContributionItem.STYLE_PUSH); //$NON-NLS-1$
zoomItem = new CommandContributionItem(zoomParam);
+ CommandContributionItemParameter fullscreenParam = new CommandContributionItemParameter(
+ window, null, "org.eclipse.ui.cocoa.fullscreenWindow", CommandContributionItem.STYLE_PUSH); //$NON-NLS-1$
+ fullscreenItem = new CommandContributionItem(fullscreenParam);
CommandContributionItemParameter arrangeWindowsParam = new CommandContributionItemParameter(window, null,
"org.eclipse.ui.cocoa.arrangeWindowsInFront", CommandContributionItem.STYLE_PUSH); //$NON-NLS-1$
arrangeWindowsItem = new CommandContributionItem(arrangeWindowsParam);