Update of /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1394/src/org/jcommander/ui/filepanel/dialogs Modified Files: DetailsDialog.java Added Files: MakeDirectoryDialog.java MessageDialogAll.java DeleteProgressDialog.java Removed Files: CopyReportDialogComposite.java OperationDialogController.java FileQuestionDialogController.java CopyConfirmDialogComposite.java DeleteProgressDialogComposite.java DeleteConfirmDialogComposite.java CustomConfirmDialogComposite.java FileQuestionDialogComposite.java Log Message: further implementation of the move to JFace Dialogs: - deleting files is now a job, thus the DeleteProgressDialog is replaced by the standard job progress dialog - file questions (overwrite, read error, etc) use now JFace dialogs, too. - make directory dialog is now a JFace dialog. --- DeleteProgressDialogComposite.java DELETED --- --- CopyConfirmDialogComposite.java DELETED --- --- OperationDialogController.java DELETED --- --- CopyReportDialogComposite.java DELETED --- --- FileQuestionDialogComposite.java DELETED --- --- NEW FILE: MessageDialogAll.java --- /** * */ package org.jcommander.ui.filepanel.dialogs; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Shell; /** * @author MatthiasK * */ public class MessageDialogAll extends MessageDialog { /** * @param parentShell * @param dialogTitle * @param dialogTitleImage * @param dialogMessage * @param dialogImageType * @param dialogButtonLabels * @param defaultIndex */ public MessageDialogAll(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) { super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); // TODO Auto-generated constructor stub } /** * Convenience method to open a simple Yes/No/YestoAll/NoToAll question dialog. * * @param parent * the parent shell of the dialog, or <code>null</code> if none * @param title * the dialog's title, or <code>null</code> if none * @param message * the message * @return <code>true</code> if the user presses the OK button, * <code>false</code> otherwise */ public static int openQuestionAll(Shell parent, String title, String message) { MessageDialog dialog = new MessageDialog(parent, title, null, // accept // the // default // window // icon message, QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_TO_ALL_LABEL }, 0); // yes is the default int result = dialog.open(); switch (result) { case 0: return IDialogConstants.YES_ID; case 1: return IDialogConstants.NO_ID; case 2: return IDialogConstants.YES_TO_ALL_ID; case 3: return IDialogConstants.NO_TO_ALL_ID; default: return 0; } } /** * Convenience method to open a simple Yes/No/YesToAll/NoToAll question dialog. * * @param parent * the parent shell of the dialog, or <code>null</code> if none * @param title * the dialog's title, or <code>null</code> if none * @param message * the message * @param defaultIndex * the number of the default button: Yes=0, No=1, Yes to all=2, No to all=3. * @return <code>true</code> if the user presses the OK button, * <code>false</code> otherwise */ public static int openQuestionAll(Shell parent, String title, String message, int defaultIndex) { MessageDialog dialog = new MessageDialog(parent, title, null, // accept // the // default // window // icon message, QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_TO_ALL_LABEL }, defaultIndex); // yes is the default int result = dialog.open(); switch (result) { case 0: return IDialogConstants.YES_ID; case 1: return IDialogConstants.NO_ID; case 2: return IDialogConstants.YES_TO_ALL_ID; case 3: return IDialogConstants.NO_TO_ALL_ID; default: return 0; } } /** * Convenience method to open a simple Yes/No/YestoAll/NoToAll question dialog. * * @param parent * the parent shell of the dialog, or <code>null</code> if none * @param title * the dialog's title, or <code>null</code> if none * @param message * the message * @return <code>true</code> if the user presses the OK button, * <code>false</code> otherwise */ public static int openQuestionNoAll(Shell parent, String title, String message) { MessageDialog dialog = new MessageDialog(parent, title, null, // accept // the // default // window // icon message, QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL }, 0); // yes is the default int result = dialog.open(); switch (result) { case 0: return IDialogConstants.YES_ID; case 1: return IDialogConstants.NO_ID; case 2: return IDialogConstants.NO_TO_ALL_ID; default: return 0; } } } --- CustomConfirmDialogComposite.java DELETED --- --- NEW FILE: MakeDirectoryDialog.java --- /** * */ package org.jcommander.ui.filepanel.dialogs; import org.eclipse.jface.dialogs.TitleAreaDialog; 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.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; /** * @author MatthiasK * */ public class MakeDirectoryDialog extends TitleAreaDialog { Text nameText; String newName; /** * @param parentShell */ public MakeDirectoryDialog(Shell parentShell) { super(parentShell); // TODO Auto-generated constructor stub } protected void configureShell(Shell newShell) { // TODO Auto-generated method stub super.configureShell(newShell); newShell.setText("Create new Directory"); } protected Control createDialogArea(Composite parent) { // TODO Auto-generated method stub setTitle("New Directory"); //setMessage("Enter directory name:"); Composite composite = (Composite)super.createDialogArea(parent); Composite dialog = new Composite(composite, SWT.NONE); dialog.setLayout(new GridLayout()); dialog.setLayoutData(new GridData(GridData.FILL_BOTH)); Label label = new Label(dialog, SWT.NONE); label.setText("Enter new directory name:"); nameText = new Text(dialog, SWT.BORDER); GridData nameData = new GridData(GridData.FILL_HORIZONTAL); nameText.setLayoutData(nameData); Label sep = new Label(parent,SWT.SEPARATOR | SWT.HORIZONTAL); GridData labelData = new GridData(); labelData.grabExcessHorizontalSpace=true; labelData.horizontalAlignment=SWT.FILL; labelData.verticalIndent=50; sep.setLayoutData(labelData); return composite; } public boolean close() { newName = nameText.getText(); return super.close(); } public String getName() { return newName; } } --- FileQuestionDialogController.java DELETED --- Index: DetailsDialog.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs/DetailsDialog.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DetailsDialog.java 26 Apr 2006 16:39:19 -0000 1.1 --- DetailsDialog.java 30 Apr 2006 13:10:55 -0000 1.2 *************** *** 1,4 **** /******************************************************************************* ! * from org.eclipse.team.internal.ui.dialogs.DetailsDialog *******************************************************************************/ package org.jcommander.ui.filepanel.dialogs; --- 1,4 ---- /******************************************************************************* ! * adapted from org.eclipse.team.internal.ui.dialogs.DetailsDialog *******************************************************************************/ package org.jcommander.ui.filepanel.dialogs; --- NEW FILE: DeleteProgressDialog.java --- /** * */ package org.jcommander.ui.filepanel.dialogs; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.TrayDialog; import org.eclipse.jface.window.IShellProvider; 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.Label; import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Widget; /** * @author MatthiasK * */ public class DeleteProgressDialog extends TrayDialog { private ProgressBar totalProgressBar; private Label currentFileLabel; /** * @param shell */ public DeleteProgressDialog(Shell shell) { super(shell); } /** * @param parentShell */ public DeleteProgressDialog(IShellProvider parentShell) { super(parentShell); } protected void createButtonsForButtonBar(Composite parent) { createButton(parent, IDialogConstants.STOP_ID, "Pause", true); createButton(parent, IDialogConstants.ABORT_ID, IDialogConstants.ABORT_LABEL, false); } protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText("Deleting"); setShellStyle(SWT.DIALOG_TRIM|SWT.MODELESS); } protected Control createDialogArea(Composite parent) { // create a composite with standard margins and spacing Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(composite); GridData gridData5 = new GridData(); currentFileLabel = new Label(composite, SWT.NONE); GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; currentFileLabel.setText(""); currentFileLabel.setLayoutData(gridData); totalProgressBar = new ProgressBar(composite, SWT.NONE); gridData5.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; gridData5.grabExcessHorizontalSpace = true; totalProgressBar.setLayoutData(gridData5); return composite; } public ProgressBar getTotalProgressBar() { return totalProgressBar; } public Label getCurrentFileLabel() { return currentFileLabel; } } --- DeleteConfirmDialogComposite.java DELETED --- |