Update of /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23213/src/org/jcommander/ui/filepanel/dialogs Modified Files: CopyConfirmDialogComposite.java DeleteConfirmDialogComposite.java CustomConfirmDialogComposite.java Log Message: - Added support for different Buttons in CustomConfirmDialogComposite: Yes/No and Ok/Cancel - Text in CopyConfirmDialogComposite depends of whether one is moving or copying. Index: CopyConfirmDialogComposite.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs/CopyConfirmDialogComposite.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CopyConfirmDialogComposite.java 17 Apr 2006 14:53:59 -0000 1.13 --- CopyConfirmDialogComposite.java 17 Apr 2006 17:58:31 -0000 1.14 *************** *** 21,24 **** --- 21,26 ---- public class CopyConfirmDialogComposite extends CustomConfirmDialogComposite { + private static String moveMsg = "Move selected files"; + private static String copyMsg = "Copy selected files"; private Composite listComposite; private Label labelConfirmQuestion; *************** *** 27,37 **** private Button deleteCheckBox; private boolean delete; public CopyConfirmDialogComposite(Composite parent, int style) { ! super(parent, style); } public CopyConfirmDialogComposite(Shell parent, int style) { ! super(parent,style); } --- 29,40 ---- private Button deleteCheckBox; private boolean delete; + private String target; public CopyConfirmDialogComposite(Composite parent, int style) { ! super(parent, style, OK_CANCEL); } public CopyConfirmDialogComposite(Shell parent, int style) { ! super(parent,style, OK_CANCEL); } *************** *** 120,124 **** public void setCopyTarget(String target) { ! labelConfirmQuestion.setText("Copy selected files to "+target+"?"); } --- 123,128 ---- public void setCopyTarget(String target) { ! this.target=target; ! updateConfirmMsg(); } *************** *** 153,156 **** --- 157,170 ---- .getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));*/ } + delete=deleteCheckBox.getSelection(); + updateConfirmMsg(); + } + + private String getConfirmMsg(){ + return (delete?moveMsg:copyMsg)+((target=="")?"?":" to "+target+"?"); + } + + private void updateConfirmMsg(){ + labelConfirmQuestion.setText(getConfirmMsg()); } Index: CustomConfirmDialogComposite.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs/CustomConfirmDialogComposite.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CustomConfirmDialogComposite.java 17 Apr 2006 14:53:59 -0000 1.3 --- CustomConfirmDialogComposite.java 17 Apr 2006 17:58:31 -0000 1.4 *************** *** 23,26 **** --- 23,29 ---- public class CustomConfirmDialogComposite extends Composite { + public static final int YES_NO = 1; + public static final int OK_CANCEL = 2; + private Composite buttonsComposite = null; private Composite detailsComposite = null; *************** *** 34,37 **** --- 37,41 ---- private int detailsHeight = 0; + private int buttons = 0; /** *************** *** 39,44 **** * @param style */ ! public CustomConfirmDialogComposite(Composite parent, int style) { super(parent, style); initialize(); } --- 43,49 ---- * @param style */ ! public CustomConfirmDialogComposite(Composite parent, int style, int buttons) { super(parent, style); + this.buttons=buttons; initialize(); } *************** *** 64,72 **** buttonsComposite = new Composite(this, SWT.NONE); ! Label fillLabel = new Label(buttonsComposite, SWT.NONE); ! GridData gridDataFill = new GridData(); ! gridDataFill.grabExcessHorizontalSpace=true; ! gridDataFill.minimumWidth=200; ! fillLabel.setLayoutData(gridDataFill); yesButton = new Button(buttonsComposite, SWT.NONE); --- 69,77 ---- buttonsComposite = new Composite(this, SWT.NONE); ! // Label fillLabel = new Label(buttonsComposite, SWT.NONE); ! // GridData gridDataFill = new GridData(); ! // gridDataFill.grabExcessHorizontalSpace=true; ! // gridDataFill.minimumWidth=200; ! // fillLabel.setLayoutData(gridDataFill); yesButton = new Button(buttonsComposite, SWT.NONE); *************** *** 78,85 **** buttonsComposite.setLayoutData(buttonsData); buttonsComposite.setLayout(buttonsLayout); ! buttonsLayout.numColumns = 4; buttonsLayout.marginHeight = 1; buttonsLayout.marginWidth = 1; ! yesButton.setText("&Yes"); // GridLayout buttonLayout1 = new GridLayout(); GridData yesButtonData = new GridData(); --- 83,91 ---- buttonsComposite.setLayoutData(buttonsData); buttonsComposite.setLayout(buttonsLayout); ! buttonsLayout.numColumns = 3; buttonsLayout.marginHeight = 1; buttonsLayout.marginWidth = 1; ! buttonsLayout.marginLeft=200; ! // GridLayout buttonLayout1 = new GridLayout(); GridData yesButtonData = new GridData(); *************** *** 92,100 **** //l2.horizontalAlignment=SWT.FILL; noButtonData.minimumWidth=75; - noButton.setText("&No"); noButton.setLayoutData(noButtonData); detailsButton = new Button(buttonsComposite, SWT.NONE); GridData detailsButtonData = new GridData(); detailsButtonData.minimumWidth=75; detailsButton.setLayoutData(detailsButtonData); --- 98,115 ---- //l2.horizontalAlignment=SWT.FILL; noButtonData.minimumWidth=75; noButton.setLayoutData(noButtonData); + if (buttons==YES_NO) { + yesButton.setText("&Yes"); + noButton.setText("&No"); + } + else if (buttons==OK_CANCEL) { + yesButton.setText("&Ok"); + noButton.setText("&Cancel"); + } + detailsButton = new Button(buttonsComposite, SWT.NONE); GridData detailsButtonData = new GridData(); + detailsButtonData.grabExcessHorizontalSpace=true; detailsButtonData.minimumWidth=75; detailsButton.setLayoutData(detailsButtonData); *************** *** 173,176 **** --- 188,199 ---- /** + * Gets the Ok button. + */ + public Button getOkButton() { + return yesButton; + } + + + /** * Gets the no button. */ *************** *** 180,183 **** --- 203,213 ---- /** + * Gets the Cancel button. + */ + public Button getCancelButton() { + return noButton; + } + + /** * * @return whether the details are currently showing Index: DeleteConfirmDialogComposite.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs/DeleteConfirmDialogComposite.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DeleteConfirmDialogComposite.java 17 Apr 2006 14:53:59 -0000 1.12 --- DeleteConfirmDialogComposite.java 17 Apr 2006 17:58:31 -0000 1.13 *************** *** 34,38 **** public DeleteConfirmDialogComposite(Composite parent, int style) { ! super(parent, style); } --- 34,38 ---- public DeleteConfirmDialogComposite(Composite parent, int style) { ! super(parent, style, YES_NO); } |