diff options
author | Michael Valenta | 2007-03-21 15:46:34 +0000 |
---|---|---|
committer | Michael Valenta | 2007-03-21 15:46:34 +0000 |
commit | ebdc284e58ddb58946e87b10212bf017b91493fa (patch) | |
tree | 24328017c59122e42c8cb8f47bdc5b7ab65bedab | |
parent | a21d008cebf74800392f0a6f6bed60f61bb84163 (diff) | |
download | eclipse.platform.team-ebdc284e58ddb58946e87b10212bf017b91493fa.tar.gz eclipse.platform.team-ebdc284e58ddb58946e87b10212bf017b91493fa.tar.xz eclipse.platform.team-ebdc284e58ddb58946e87b10212bf017b91493fa.zip |
Bug 39392: Replace AvoidableMessageDialog with MessageDialogWithToggle
4 files changed, 10 insertions, 83 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java deleted file mode 100644 index 69400f275..000000000 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ccvs.ui; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Image; -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.Shell; - -public class AvoidableMessageDialog extends MessageDialog { - Button dontShowAgain; - boolean dontShow; - boolean showOption; - - public AvoidableMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) { - this(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex, true); - } - - public AvoidableMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, boolean showOption) { - super(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); - this.showOption = showOption; - } - - protected Control createCustomArea(Composite composite) { - if ( ! showOption) return null; - dontShow = false; - dontShowAgain = new Button(composite, SWT.CHECK); - GridData data = new GridData(); - data.horizontalIndent = 50; - dontShowAgain.setLayoutData(data); - dontShowAgain.setText(CVSUIMessages.AvoidableMessageDialog_dontShowAgain); - dontShowAgain.setSelection(dontShow); - dontShowAgain.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - dontShow = dontShowAgain.getSelection(); - } - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } - - }); - return dontShowAgain; - } - - public boolean isDontShowAgain() { - return dontShow; - } - -} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java index a7a3fdbfa..4e12894e5 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java @@ -112,8 +112,6 @@ public class CVSUIMessages extends NLS { public static String AddToVersionControlDialog_thereIsAnUnaddedResource; public static String AddToVersionControlDialog_thereAreUnaddedResources; - public static String AvoidableMessageDialog_dontShowAgain; - public static String BranchWizard_title; public static String BranchWizardPage_pageDescription; public static String BranchWizardPage_pageDescriptionVersion; @@ -1138,4 +1136,6 @@ public class CVSUIMessages extends NLS { public static String NewLocationWizard_2; public static String NewLocationWizard_3; public static String NewLocationWizard_4; + + public static String CVSAction_doNotShowThisAgain; } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java index 96da060da..0dd5bbc74 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java @@ -545,20 +545,13 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg // consider BASE to be equal the parent tag since we don't make BASE sticky on replace if (!CVSTag.equalTags(tag, parentTag) && !CVSTag.equalTags(tag, CVSTag.BASE)) { shell.getDisplay().syncExec(new Runnable() { - public void run() { - AvoidableMessageDialog dialog = new AvoidableMessageDialog( - shell, - CVSUIMessages.CVSAction_mixingTagsTitle, - null, // accept the default window icon - NLS.bind(CVSUIMessages.CVSAction_mixingTags, new String[] { tag.getName() }), - MessageDialog.QUESTION, - new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, - 0); - - result[0] = dialog.open() == 0; - if(result[0] && dialog.isDontShowAgain()) { - store.setValue(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, false); - } + public void run() { + MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(shell, + CVSUIMessages.CVSAction_mixingTagsTitle, + NLS.bind(CVSUIMessages.CVSAction_mixingTags, new String[] { tag.getName() }), + CVSUIMessages.CVSAction_doNotShowThisAgain, false, + store, ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS); + result[0] = dialog.getReturnCode() == 0; } }); // only prompt once diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties index 51e4ce1a1..bef6f75e6 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties @@ -41,10 +41,6 @@ AddToVersionControlDialog_title=Add to CVS Version Control AddToVersionControlDialog_thereIsAnUnaddedResource=There is {0} resource that is not under CVS version control. Do you want to add it? AddToVersionControlDialog_thereAreUnaddedResources=There are {0} resources that are not under CVS version control. Do you want to add them? - - -AvoidableMessageDialog_dontShowAgain=Don't show this again - BranchWizard_title=Create a new CVS Branch BranchWizardPage_pageDescription=Creates a new branch and a starting point version. BranchWizardPage_pageDescriptionVersion=Creates a new branch based on the version in the workspace. @@ -275,6 +271,7 @@ CVSUIPlugin_refreshMultipleQuestion={0} Would you like to refresh the selected r CVSAction_disabledTitle=Information CVSAction_disabledMessage=The chosen operation is not enabled. +CVSAction_doNotShowThisAgain=Do not show this again CVSAction_refreshTitle=Refresh Project? CVSAction_refreshQuestion={0} Would you like to refresh project ''{1}''? CVSAction_refreshMultipleQuestion={0} Would you like to refresh the projects of the selected resources? |