KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > schema > NewRestrictionDialog


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.pde.internal.ui.editor.schema;
12
13 import org.eclipse.jface.dialogs.IDialogConstants;
14 import org.eclipse.jface.dialogs.MessageDialog;
15 import org.eclipse.pde.internal.ui.PDEUIMessages;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.layout.GridData;
18 import org.eclipse.swt.layout.GridLayout;
19 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.swt.widgets.Control;
21 import org.eclipse.swt.widgets.Shell;
22 import org.eclipse.swt.widgets.Text;
23
24 public class NewRestrictionDialog extends MessageDialog {
25
26     private Text fText;
27     private String JavaDoc fRestriction;
28     public NewRestrictionDialog(Shell parent) {
29         super(parent, PDEUIMessages.NewRestrictionDialog_title, null, PDEUIMessages.NewRestrictionDialog_message,
30                 QUESTION,
31                 new String JavaDoc[] {
32                     IDialogConstants.OK_LABEL,
33                     IDialogConstants.CANCEL_LABEL},
34                 0);
35         
36     }
37     protected Control createCustomArea(Composite parent) {
38         Composite comp = new Composite(parent, SWT.NONE);
39         comp.setLayout(new GridLayout());
40         comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
41         fText = new Text(parent, SWT.BORDER);
42         fText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
43         return comp;
44     }
45     
46     public String JavaDoc getNewRestriction() {
47         return fRestriction;
48     }
49     
50     public boolean close() {
51         fRestriction = fText.getText();
52         return super.close();
53     }
54 }
55
Popular Tags