| /******************************************************************************* |
| * Copyright (c) 2005, 2006 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.pde.internal.ui.editor.schema; |
| |
| import org.eclipse.jface.dialogs.IDialogConstants; |
| import org.eclipse.jface.dialogs.MessageDialog; |
| import org.eclipse.pde.internal.ui.IHelpContextIds; |
| import org.eclipse.pde.internal.ui.PDEUIMessages; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.layout.GridData; |
| import org.eclipse.swt.layout.GridLayout; |
| import org.eclipse.swt.widgets.*; |
| import org.eclipse.ui.PlatformUI; |
| |
| public class NewRestrictionDialog extends MessageDialog { |
| |
| private Text fText; |
| private String fRestriction; |
| |
| public NewRestrictionDialog(Shell parent) { |
| super(parent, PDEUIMessages.NewRestrictionDialog_title, null, PDEUIMessages.NewRestrictionDialog_message, QUESTION, new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL}, 0); |
| } |
| |
| /* |
| * @see org.eclipse.jface.window.Window#configureShell(Shell) |
| */ |
| protected void configureShell(Shell shell) { |
| super.configureShell(shell); |
| PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IHelpContextIds.NEW_RESTRICTION_DIALOG); |
| } |
| |
| protected Control createCustomArea(Composite parent) { |
| Composite comp = new Composite(parent, SWT.NONE); |
| comp.setLayout(new GridLayout()); |
| comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| fText = new Text(parent, SWT.BORDER); |
| fText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
| return comp; |
| } |
| |
| public String getNewRestriction() { |
| return fRestriction; |
| } |
| |
| public boolean close() { |
| fRestriction = fText.getText(); |
| return super.close(); |
| } |
| } |