Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-05-11 15:36:59 +0000
committerMichael Valenta2004-05-11 15:36:59 +0000
commit8564a36bfae454ef0a0761f89ad3eb9b31516870 (patch)
treeac44d80c97cb4e27be53af3404899aeff8a31715
parent62cdb6590ecb4d936c87127e650ae56cadbacb90 (diff)
downloadeclipse.platform.team-8564a36bfae454ef0a0761f89ad3eb9b31516870.tar.gz
eclipse.platform.team-8564a36bfae454ef0a0761f89ad3eb9b31516870.tar.xz
eclipse.platform.team-8564a36bfae454ef0a0761f89ad3eb9b31516870.zip
Bug 61665: problem with message in Confirm Move Existing Tag dialog
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/MessageDialogWithToggle.java256
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java8
2 files changed, 5 insertions, 259 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/MessageDialogWithToggle.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/MessageDialogWithToggle.java
deleted file mode 100644
index 0867c280b..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/MessageDialogWithToggle.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.team.internal.ccvs.ui;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-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;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * A message dialog which also allows the user to adjust a toggle setting.
- *
- * This is typically used to allow the user to indicate whether the dialog
- * should be shown in the future.
- */
-public class MessageDialogWithToggle extends MessageDialog {
-
- /**
- * The message displayed to the user, with the toggle button
- */
- private String toggleMessage = null;
- private boolean toggleState = false;
- private Button toggleButton = null;
-
- /**
- * The preference store which will be affected by the toggle button
- */
- IPreferenceStore fStore = null;
-
- /**
- * Creates a message dialog with a toggle.
- * See the superclass constructor for info on the other parameters.
- *
- * @param toggleMessage the message for the toggle control, or <code>null</code>
- * for the default message ("Do not show this message again").
- * @param toggleState the initial state for the toggle
- *
- */
- public MessageDialogWithToggle(Shell parentShell, String dialogTitle, Image image, String message, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, String toggleMessage, boolean toggleState) {
- super(parentShell, dialogTitle, image, message, dialogImageType, dialogButtonLabels, defaultIndex);
- this.toggleMessage = toggleMessage;
- this.toggleState = toggleState;
- }
-
- /**
- * Returns the toggle state. This can be called even after the dialog
- * is closed.
- *
- * @return <code>true</code> if the toggle button is checked,
- * <code>false</code> if not
- */
- public boolean getToggleState() {
- return toggleState;
- }
-
- /* (non-Javadoc)
- * Method declared in Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- Composite dialogArea = (Composite) super.createDialogArea(parent);
- toggleButton = createToggleButton(dialogArea);
- return dialogArea;
- }
-
- /**
- * Creates a toggle button with the toggle message and state.
- */
- protected Button createToggleButton(Composite parent) {
- final Button button= new Button(parent, SWT.CHECK | SWT.LEFT);
- String text = toggleMessage;
- if (text == null) {
- text = WorkbenchMessages.getString("MessageDialogWithToggle.defaultToggleMessage"); //$NON-NLS-1$
- }
- button.setText(text);
- button.setSelection(toggleState);
-
- GridData data = new GridData(SWT.NONE);
- data.horizontalSpan= 2;
- data.horizontalAlignment= GridData.CENTER;
- button.setLayoutData(data);
- button.setFont(parent.getFont());
-
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- toggleState = button.getSelection();
- }
-
- });
- return button;
- }
-
- /**
- * Returns the toggle button.
- *
- * @return the toggle button
- */
- protected Button getToggleButton() {
- return toggleButton;
- }
-
- /**
- * Convenience method to open a simple confirm (OK/Cancel) dialog.
- *
- * @param parent the parent shell of the dialog, or <code>null</code> if none
- * @param title the dialog's title, or <code>null</code> if none
- * @param message the message
- * @param toggleMessage the message for the toggle control, or <code>null</code>
- * for the default message ("Don't show me this message again").
- * @param toggleState the initial state for the toggle
- * @return the dialog, after being closed by the user, which the client can
- * only call <code>getReturnCode()</code> or <code>getToggleState()</code>
- */
- public static MessageDialogWithToggle openConfirm(Shell parent, String title, String message, String toggleMessage, boolean toggleState) {
- MessageDialogWithToggle dialog = new MessageDialogWithToggle(
- parent,
- title,
- null, // accept the default window icon
- message,
- QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0, // OK is the default
- toggleMessage,
- toggleState);
- dialog.open();
- return dialog;
- }
-
- /**
- * Convenience method to open a standard error dialog.
- *
- * @param parent the parent shell of the dialog, or <code>null</code> if none
- * @param title the dialog's title, or <code>null</code> if none
- * @param message the message
- * @param toggleMessage the message for the toggle control, or <code>null</code>
- * for the default message ("Don't show me this message again").
- * @param toggleState the initial state for the toggle
- * @return the dialog, after being closed by the user, which the client can
- * only call <code>getReturnCode()</code> or <code>getToggleState()</code>
- */
- public static MessageDialogWithToggle openError(Shell parent, String title, String message, String toggleMessage, boolean toggleState) {
- MessageDialogWithToggle dialog = new MessageDialogWithToggle(
- parent,
- title,
- null, // accept the default window icon
- message,
- ERROR,
- new String[] {IDialogConstants.OK_LABEL},
- 0, // ok is the default
- toggleMessage,
- toggleState);
- dialog.open();
- return dialog;
- }
-
- /**
- * Convenience method to open a standard information dialog.
- *
- * @param parent the parent shell of the dialog, or <code>null</code> if none
- * @param title the dialog's title, or <code>null</code> if none
- * @param message the message
- * @param toggleMessage the message for the toggle control, or <code>null</code>
- * for the default message ("Don't show me this message again").
- * @param toggleState the initial state for the toggle
- * @return the dialog, after being closed by the user, which the client can
- * only call <code>getReturnCode()</code> or <code>getToggleState()</code>
- */
- public static MessageDialogWithToggle openInformation(Shell parent, String title, String message, String toggleMessage, boolean toggleState) {
- MessageDialogWithToggle dialog = new MessageDialogWithToggle(
- parent,
- title,
- null, // accept the default window icon
- message,
- INFORMATION,
- new String[] { IDialogConstants.OK_LABEL },
- 0, // ok is the default
- toggleMessage,
- toggleState);
- dialog.open();
- return dialog;
- }
-
- /**
- * Convenience method to open a simple Yes/No question dialog.
- *
- * @param parent the parent shell of the dialog, or <code>null</code> if none
- * @param title the dialog's title, or <code>null</code> if none
- * @param message the message
- * @param toggleMessage the message for the toggle control, or <code>null</code>
- * for the default message ("Don't show me this message again").
- * @param toggleState the initial state for the toggle
- * @return the dialog, after being closed by the user, which the client can
- * only call <code>getReturnCode()</code> or <code>getToggleState()</code>
- */
- public static MessageDialogWithToggle openQuestion(Shell parent, String title, String message, String toggleMessage, boolean toggleState) {
- MessageDialogWithToggle dialog = new MessageDialogWithToggle(
- parent,
- title,
- null, // accept the default window icon
- message,
- QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 1, // no is the default
- toggleMessage,
- toggleState);
- dialog.open();
- return dialog;
- }
-
- /**
- * Convenience method to open a standard warning dialog.
- *
- * @param parent the parent shell of the dialog, or <code>null</code> if none
- * @param title the dialog's title, or <code>null</code> if none
- * @param message the message
- * @param toggleMessage the message for the toggle control, or <code>null</code>
- * for the default message ("Don't show me this message again").
- * @param toggleState the initial state for the toggle
- * @return the dialog, after being closed by the user, which the client can
- * only call <code>getReturnCode()</code> or <code>getToggleState()</code>
- */
- public static MessageDialogWithToggle openWarning(Shell parent, String title, String message, String toggleMessage, boolean toggleState) {
- MessageDialogWithToggle dialog = new MessageDialogWithToggle(
- parent,
- title,
- null, // accept the default window icon
- message,
- WARNING,
- new String[] {IDialogConstants.OK_LABEL},
- 0, // ok is the default
- toggleMessage,
- toggleState);
- dialog.open();
- return dialog;
- }
-
-}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
index dfbdd71f8..99f8a5c76 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/TagAction.java
@@ -16,6 +16,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.window.Window;
@@ -25,7 +26,6 @@ import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.MessageDialogWithToggle;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.TagAsVersionDialog;
import org.eclipse.team.internal.ccvs.ui.operations.ITagOperation;
@@ -86,11 +86,13 @@ public abstract class TagAction extends WorkspaceAction {
// The user has indicated they want to force a move. Make sure they really do.
if (dialog.shouldMoveTag() && store.getBoolean(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG)) {
- MessageDialogWithToggle confirmDialog = MessageDialogWithToggle.openQuestion(getShell(),
+ MessageDialogWithToggle confirmDialog = MessageDialogWithToggle.openYesNoQuestion(getShell(),
Policy.bind("TagAction.moveTagConfirmTitle"), //$NON-NLS-1$
Policy.bind("TagAction.moveTagConfirmMessage", dialog.getTagName()), //$NON-NLS-1$
null,
- false);
+ false,
+ null,
+ null);
if (confirmDialog.getReturnCode() == IDialogConstants.OK_ID) {
store.setValue(ICVSUIConstants.PREF_CONFIRM_MOVE_TAG, !confirmDialog.getToggleState());

Back to the top