From dd3fcbb7a34a65ff89435c0053fc1d288c6fb9d9 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Fri, 14 Jan 2011 12:00:54 +0000 Subject: [PATCH] Bug 275629 - scalability mode popup dialog enhancement Patch by Gaetano Santoro --- .../org/eclipse/cdt/internal/ui/editor/CEditor.java | 11 +++++++++-- .../cdt/internal/ui/editor/CEditorMessages.properties | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index 072de8bee09..d245ee62ccb 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 IBM Corporation and others. + * Copyright (c) 2005, 2011 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 @@ -51,6 +51,7 @@ import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialogWithToggle; import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceDialog; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.BadPositionCategoryException; import org.eclipse.jface.text.DefaultLineTracker; @@ -135,6 +136,7 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.ActionContext; import org.eclipse.ui.actions.ActionGroup; +import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.TextEditor; import org.eclipse.ui.help.IWorkbenchHelpSystem; @@ -1444,7 +1446,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC null, CEditorMessages.Scalability_message, MessageDialog.INFORMATION, - new String[] {IDialogConstants.OK_LABEL}, 0, + new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL}, 0, CEditorMessages.Scalability_reappear, false) { { @@ -1454,6 +1456,11 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC protected void buttonPressed(int buttonId) { PreferenceConstants.getPreferenceStore().setValue(PreferenceConstants.SCALABILITY_ALERT, !getToggleState()); super.buttonPressed(buttonId); + if (buttonId == IDialogConstants.YES_ID) { + PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(Display.getCurrent().getActiveShell(), + "org.eclipse.cdt.ui.preferences.CScalabilityPreferences", null, null); //$NON-NLS-1$ + dialog.open(); + } } }; dialog.setBlockOnOpen(false); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties index 795fc19fb3b..cfe3e70c0b3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.properties @@ -1,5 +1,5 @@ ######################################### -# Copyright (c) 2005, 2010 IBM Corporation and others. +# Copyright (c) 2005, 2011 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 @@ -50,7 +50,7 @@ GotoMatchingBracket_error_invalidSelection=No bracket selected GotoMatchingBracket_error_noMatchingBracket=No matching bracket found GotoMatchingBracket_error_bracketOutsideSelectedElement=Bracket is outside selected element -Scalability_message=You are opening a large file. Scalability mode has been turned on for this editor to help improve performance. Please see the Scalability preference page under Preferences > C/C++ > Editor. +Scalability_message=You are opening a large file. Scalability mode has been turned on for this editor to help improve performance.\n\nDo you want to change scalability settings now? Scalability_info=Editor Scalability Scalability_linkToolTip=Open the Scalability preference page Scalability_reappear=Do not show this message again.