diff options
| author | Patrik Suzzi | 2016-04-18 16:48:58 +0000 |
|---|---|---|
| committer | Lars Vogel | 2016-04-19 19:08:32 +0000 |
| commit | 92c580c0005389fb9f86838517828ce1994aa18b (patch) | |
| tree | be9ea43b49641e27b79dedb1ae60b30565a45f4b | |
| parent | a13473aeb156855d65ef648453ece233c88ad337 (diff) | |
| download | eclipse.platform.ui-92c580c0005389fb9f86838517828ce1994aa18b.tar.gz eclipse.platform.ui-92c580c0005389fb9f86838517828ce1994aa18b.tar.xz eclipse.platform.ui-92c580c0005389fb9f86838517828ce1994aa18b.zip | |
Bug 491785 - Update popup of full screen mode to allow user to hide this
dialog
Popup how shows the actual keyb. shortcut, and adds "Do not show again"
checkbox.
Change-Id: I6423a8c5eaf82eb7000437de5b882855b69935d1
Signed-off-by: Patrik Suzzi <psuzzi@gmail.com>
3 files changed, 37 insertions, 11 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java index dfceca53be3..28233ac45b8 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2015 IBM Corporation and others. + * Copyright (c) 2005, 2016 IBM Corporation 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 @@ -14,6 +14,7 @@ * Implemented workbench auto-save to correctly restore state in case of crash. * Andrey Loskutov <loskutov@gmx.de> - Bug 388476, 445538, 463262 * Alain Bernard <alain.bernard1224@gmail.com> - Bug 281490 + * Patrik Suzzi <psuzzi@gmail.com> - Bug 491785 *******************************************************************************/ package org.eclipse.ui.internal; @@ -460,6 +461,7 @@ public class WorkbenchMessages extends NLS { public static String ViewsPreference_useColoredLabels; public static String ToggleFullScreenMode_ActivationPopup_Description; public static String ToggleFullScreenMode_ActivationPopup_Description_NoKeybinding; + public static String ToggleFullScreenMode_ActivationPopup_DoNotShowAgain; // --- File Editors --- public static String FileEditorPreference_fileTypes; diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/FullScreenHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/FullScreenHandler.java index aafce5901cb..05cca4f3da1 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/FullScreenHandler.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/FullScreenHandler.java @@ -6,7 +6,7 @@ * * Contributors: * Simon Scholz <simon.scholz@vogella.com> - initial API and implementation; - * Patrik Suzzi <psuzzi@gmail.com> - Bug 491572 + * Patrik Suzzi <psuzzi@gmail.com> - Bug 491572, 491785 ******************************************************************************/ package org.eclipse.ui.internal.handlers; @@ -31,6 +31,7 @@ import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Link; @@ -39,6 +40,7 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.internal.WorkbenchMessages; +import org.eclipse.ui.internal.WorkbenchPlugin; import org.eclipse.ui.keys.IBindingService; /** @@ -50,6 +52,9 @@ import org.eclipse.ui.keys.IBindingService; public class FullScreenHandler extends AbstractHandler { private static final String FULL_SCREEN_COMMAND_ID = "org.eclipse.ui.window.fullscreenmode"; //$NON-NLS-1$ + private static final String FULL_SCREEN_COMMAND_DO_NOT_SHOW_INFO_AGAIN_PREF_ID = "org.eclipse.ui.window.fullscreenmode.donotshowinfoagain"; //$NON-NLS-1$ + + private boolean showInfoPopup; @Override public Object execute(ExecutionEvent event) { @@ -60,6 +65,9 @@ public class FullScreenHandler extends AbstractHandler { BindingTableManager bindingTableManager = window.getService(BindingTableManager.class); IContextService bindingContextService = window.getService(IContextService.class); + showInfoPopup = !WorkbenchPlugin.getDefault().getPreferenceStore() + .getBoolean(FULL_SCREEN_COMMAND_DO_NOT_SHOW_INFO_AGAIN_PREF_ID); + Optional<TriggerSequence> sequence = getKeybindingSequence(bindingService, commandService, bindingTableManager, bindingContextService, FULL_SCREEN_COMMAND_ID); @@ -72,9 +80,11 @@ public class FullScreenHandler extends AbstractHandler { if (!keybinding.isEmpty()) { message = NLS.bind(WorkbenchMessages.ToggleFullScreenMode_ActivationPopup_Description, keybinding); } - FullScreenInfoPopup fullScreenInfoPopup = new FullScreenInfoPopup(shell, PopupDialog.HOVER_SHELLSTYLE, true, - false, false, false, false, null, null, message); - fullScreenInfoPopup.open(); + if (showInfoPopup) { + FullScreenInfoPopup fullScreenInfoPopup = new FullScreenInfoPopup(shell, PopupDialog.HOVER_SHELLSTYLE, + true, false, false, false, false, null, null, message); + fullScreenInfoPopup.open(); + } } return Status.OK_STATUS; } @@ -82,6 +92,7 @@ public class FullScreenHandler extends AbstractHandler { private static class FullScreenInfoPopup extends PopupDialog { private String message; + private String messageDoNotShowAgain; public FullScreenInfoPopup(Shell parent, int shellStyle, boolean takeFocusOnOpen, boolean persistSize, boolean persistLocation, boolean showDialogMenu, boolean showPersistActions, String titleText, @@ -89,6 +100,7 @@ public class FullScreenHandler extends AbstractHandler { super(parent, shellStyle, takeFocusOnOpen, persistSize, persistLocation, showDialogMenu, showPersistActions, titleText, infoText); this.message = message; + this.messageDoNotShowAgain = WorkbenchMessages.ToggleFullScreenMode_ActivationPopup_DoNotShowAgain; } @Override @@ -105,19 +117,30 @@ public class FullScreenHandler extends AbstractHandler { protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); - Link link = new Link(composite, SWT.BORDER); + Link link = new Link(composite, SWT.NONE); link.setText(message); + GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); + gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; + gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; + link.setLayoutData(gd); + + Button btnDoNotShow = new Button(composite, SWT.CHECK); + btnDoNotShow.setText(messageDoNotShowAgain); + btnDoNotShow.setSelection(WorkbenchPlugin.getDefault().getPreferenceStore() + .getBoolean(FULL_SCREEN_COMMAND_DO_NOT_SHOW_INFO_AGAIN_PREF_ID)); + GridData gd2 = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); + gd2.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; + gd2.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; + btnDoNotShow.setLayoutData(gd2); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { + WorkbenchPlugin.getDefault().getPreferenceStore() + .setValue(FULL_SCREEN_COMMAND_DO_NOT_SHOW_INFO_AGAIN_PREF_ID, btnDoNotShow.getSelection()); close(); } }); - GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); - gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; - gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; - link.setLayoutData(gd); return composite; } diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties index b3a18ee5af8..58ccdb47b9b 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties @@ -18,7 +18,7 @@ # Andrey Loskutov <loskutov@gmx.de> - Bug 445538 # Alain Bernard <alain.bernard1224@gmail.com> - Bug 281490 # Lars Vogel <Lars.Vogel@vogella.com> - Bug 407432 -# Patrik Suzzi <psuzzi@gmail.com> - Bug 491572 +# Patrik Suzzi <psuzzi@gmail.com> - Bug 491572, 491785 ############################################################################### # package: org.eclipse.ui @@ -414,6 +414,7 @@ ViewsPreference_visibleTabs_description = Visible tabs on overflow: ViewsPreference_enableMRU = Show &most recently used tabs ToggleFullScreenMode_ActivationPopup_Description=You have gone full screen. Use {0} to deactivate. <a>Close</a> ToggleFullScreenMode_ActivationPopup_Description_NoKeybinding=You have gone full screen. Use Quick Access and run "Toggle Full Screen" to deactivate. <a>Close</a> +ToggleFullScreenMode_ActivationPopup_DoNotShowAgain=Do not show again # --- File Editors --- FileEditorPreference_fileTypes = File &types: FileEditorPreference_add = &Add... |
