01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor.schema;
11:
12: import org.eclipse.jface.dialogs.IDialogConstants;
13: import org.eclipse.jface.dialogs.MessageDialog;
14: import org.eclipse.pde.internal.ui.PDEUIMessages;
15: import org.eclipse.swt.SWT;
16: import org.eclipse.swt.layout.GridData;
17: import org.eclipse.swt.layout.GridLayout;
18: import org.eclipse.swt.widgets.Composite;
19: import org.eclipse.swt.widgets.Control;
20: import org.eclipse.swt.widgets.Shell;
21: import org.eclipse.swt.widgets.Text;
22:
23: public class NewRestrictionDialog extends MessageDialog {
24:
25: private Text fText;
26: private String fRestriction;
27:
28: public NewRestrictionDialog(Shell parent) {
29: super (parent, PDEUIMessages.NewRestrictionDialog_title, null,
30: PDEUIMessages.NewRestrictionDialog_message, QUESTION,
31: new String[] { IDialogConstants.OK_LABEL,
32: IDialogConstants.CANCEL_LABEL }, 0);
33:
34: }
35:
36: protected Control createCustomArea(Composite parent) {
37: Composite comp = new Composite(parent, SWT.NONE);
38: comp.setLayout(new GridLayout());
39: comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
40: fText = new Text(parent, SWT.BORDER);
41: fText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
42: return comp;
43: }
44:
45: public String getNewRestriction() {
46: return fRestriction;
47: }
48:
49: public boolean close() {
50: fRestriction = fText.getText();
51: return super.close();
52: }
53: }
|