| /******************************************************************************* |
| * Copyright (c) 2000, 2003 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Common Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/cpl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.team.internal.ccvs.ui; |
| |
| import org.eclipse.core.resources.IResource; |
| import org.eclipse.jface.dialogs.Dialog; |
| import org.eclipse.jface.util.IPropertyChangeListener; |
| import org.eclipse.jface.util.PropertyChangeEvent; |
| import org.eclipse.swt.SWT; |
| import org.eclipse.swt.layout.GridData; |
| import org.eclipse.swt.layout.GridLayout; |
| import org.eclipse.swt.widgets.Composite; |
| import org.eclipse.swt.widgets.Control; |
| import org.eclipse.swt.widgets.Shell; |
| import org.eclipse.ui.help.WorkbenchHelp; |
| |
| /** |
| * Prompts the user for a multi-line comment for releasing to CVS. |
| */ |
| public class ReleaseCommentDialog extends Dialog { |
| |
| CommitCommentArea commitCommentArea; |
| |
| /** |
| * ReleaseCommentDialog constructor. |
| * |
| * @param parentShell the parent of this dialog |
| */ |
| public ReleaseCommentDialog(Shell parentShell, IResource[] resourcesToCommit) { |
| super(parentShell); |
| int shellStyle = getShellStyle(); |
| setShellStyle(shellStyle | SWT.RESIZE); |
| commitCommentArea = new CommitCommentArea(this, null); |
| // Get a project from which the commit template can be obtained |
| if (resourcesToCommit.length > 0) |
| commitCommentArea.setProject(resourcesToCommit[0].getProject()); |
| } |
| |
| /* |
| * @see Dialog#createDialogArea(Composite) |
| */ |
| protected Control createDialogArea(Composite parent) { |
| getShell().setText(Policy.bind("ReleaseCommentDialog.title")); //$NON-NLS-1$ |
| Composite composite = new Composite(parent, SWT.NULL); |
| composite.setLayout(new GridLayout()); |
| composite.setLayoutData(new GridData(GridData.FILL_BOTH)); |
| |
| commitCommentArea.createArea(composite); |
| commitCommentArea.addPropertyChangeListener(new IPropertyChangeListener() { |
| public void propertyChange(PropertyChangeEvent event) { |
| if (event.getProperty() == CommitCommentArea.OK_REQUESTED) |
| okPressed(); |
| } |
| }); |
| |
| // set F1 help |
| WorkbenchHelp.setHelp(composite, IHelpContextIds.RELEASE_COMMENT_DIALOG); |
| |
| return composite; |
| } |
| |
| /** |
| * Returns the comment. |
| * @return String |
| */ |
| public String getComment() { |
| return commitCommentArea.getComment(); |
| } |
| |
| } |