KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > subscriber > UpdateDialog


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.ui.subscriber;
12
13 import org.eclipse.jface.dialogs.IDialogConstants;
14 import org.eclipse.swt.SWT;
15 import org.eclipse.swt.layout.GridLayout;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.swt.widgets.Shell;
18 import org.eclipse.team.core.synchronize.SyncInfoSet;
19 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
20
21 /**
22  * This dialog prompts for the type of update which should take place
23  * (i.e. update of auto-mergable files or update of all ignore local
24  * changes.
25  */

26 public class UpdateDialog extends SyncInfoSetDetailsDialog {
27
28     public static final int YES = IDialogConstants.YES_ID;
29     
30     public UpdateDialog(Shell parentShell, SyncInfoSet syncSet) {
31         super(parentShell, CVSUIMessages.UpdateDialog_overwriteTitle, syncSet); //
32
}
33
34     /* (non-Javadoc)
35      * @see org.eclipse.team.internal.ui.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite)
36      */

37     protected void createMainDialogArea(Composite parent) {
38         Composite composite = new Composite(parent, SWT.NONE);
39         composite.setLayout(new GridLayout());
40         
41         // TODO: set F1 help
42
//WorkbenchHelp.setHelp(composite, IHelpContextIds.ADD_TO_VERSION_CONTROL_DIALOG);
43

44         createWrappingLabel(composite, CVSUIMessages.UpdateDialog_overwriteMessage);
45     }
46
47     protected void createButtonsForButtonBar(Composite parent) {
48         createButton(parent, YES, IDialogConstants.YES_LABEL, false);
49         createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
50         super.createButtonsForButtonBar(parent);
51     }
52     
53     protected boolean includeOkButton() {
54         return false;
55     }
56     
57     protected boolean includeCancelButton() {
58         return false;
59     }
60
61     protected void buttonPressed(int id) {
62         // hijack yes and no buttons to set the correct return
63
// codes.
64
if(id == YES || id == IDialogConstants.NO_ID) {
65             setReturnCode(id);
66             filterSyncSet();
67             close();
68         } else {
69             super.buttonPressed(id);
70         }
71     }
72 }
73
Popular Tags