KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > compare > internal > NavigationEndDialog


1 /*******************************************************************************
2  * Copyright (c) 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.compare.internal;
12
13 import org.eclipse.jface.dialogs.*;
14 import org.eclipse.jface.preference.RadioGroupFieldEditor;
15 import org.eclipse.swt.graphics.Image;
16 import org.eclipse.swt.widgets.*;
17
18 public class NavigationEndDialog extends MessageDialogWithToggle {
19     
20     private final String JavaDoc[][] labelsAndValues;
21     private RadioGroupFieldEditor editor;
22
23     public NavigationEndDialog(Shell parentShell, String JavaDoc dialogTitle,
24             Image dialogTitleImage, String JavaDoc dialogMessage, String JavaDoc[][] labelsAndValues) {
25         super(parentShell, dialogTitle, dialogTitleImage, dialogMessage,
26                 QUESTION, new String JavaDoc[] { IDialogConstants.OK_LABEL , IDialogConstants.CANCEL_LABEL}, 0,
27                 CompareMessages.NavigationEndDialog_0, false);
28         this.labelsAndValues = labelsAndValues;
29     }
30     
31     protected Control createCustomArea(Composite parent) {
32         editor = new RadioGroupFieldEditor(ICompareUIConstants.PREF_NAVIGATION_END_ACTION_LOCAL, CompareMessages.NavigationEndDialog_1, 1,
33                 labelsAndValues,
34                 parent, true);
35         editor.setPreferenceStore(CompareUIPlugin.getDefault().getPreferenceStore());
36         editor.fillIntoGrid(parent, 1);
37         editor.load();
38         return parent;
39     }
40     
41     protected void buttonPressed(int buttonId) {
42         if (buttonId == IDialogConstants.OK_ID) {
43             editor.store();
44         }
45         super.buttonPressed(buttonId);
46     }
47
48 }
49
Popular Tags