1 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 fRestriction; 28 public NewRestrictionDialog(Shell parent) { 29 super(parent, PDEUIMessages.NewRestrictionDialog_title, null, PDEUIMessages.NewRestrictionDialog_message, 30 QUESTION, 31 new String [] { 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 getNewRestriction() { 47 return fRestriction; 48 } 49 50 public boolean close() { 51 fRestriction = fText.getText(); 52 return super.close(); 53 } 54 } 55 | Popular Tags |