|
From: Matthias K <mat...@us...> - 2006-04-26 16:39:24
|
Update of /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3053/src/org/jcommander/ui/filepanel/dialogs Modified Files: CopyConfirmDialogComposite.java HideableComposite.java Added Files: DeleteConfirmDialog.java DetailsDialog.java CopyConfirmDialog.java Log Message: first part of migration to JFace dialogs --- NEW FILE: CopyConfirmDialog.java --- /** * */ package org.jcommander.ui.filepanel.dialogs; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; import org.jcommander.ui.filepanel.FilePanelPlugin; /** * @author MatthiasK * */ public class CopyConfirmDialog extends DetailsDialog { private static String moveMsg = "Move selected files"; private static String copyMsg = "Copy selected files"; private Composite listComposite; private Label labelConfirmQuestion; private List selectionList; private Button keepSelectedCheckBox; private Button deleteCheckBox; private boolean delete; private String target; private String[] names; public CopyConfirmDialog(Shell parentShell) { super(parentShell, "Copy"); // TODO Auto-generated constructor stub } /* (non-Javadoc) * @see org.jcommander.ui.filepanel.dialogs.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite) */ protected Composite createDropDownDialogArea(Composite parent) { Composite comp = new Composite(parent, SWT.BORDER); comp.setLayout(new GridLayout()); comp.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true)); keepSelectedCheckBox = new Button(comp, SWT.CHECK); keepSelectedCheckBox.setText("&Keep files selected after copying"); keepSelectedCheckBox.setToolTipText("Keeps files selected after they have been copied"); keepSelectedCheckBox.setSelection((FilePanelPlugin.getDefault().getPreferenceStore()). getBoolean(FilePanelPlugin.KEEP_SELECTED_AFTER_COPY_KEY)); keepSelectedCheckBox. addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { IPreferenceStore store = FilePanelPlugin.getDefault().getPreferenceStore(); store.setValue(FilePanelPlugin.KEEP_SELECTED_AFTER_COPY_KEY,((Button) e.getSource()).getSelection()); } catch(Exception ex) { //ignore } } }); deleteCheckBox = new Button(comp, SWT.CHECK); deleteCheckBox.setText("&Move files"); deleteCheckBox.setToolTipText("Removes each source file as the copy progresses"); deleteCheckBox.setSelection(delete); updateDeleteCheckbox(); deleteCheckBox .addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() { public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { updateDeleteCheckbox(); } }); return comp; } /* (non-Javadoc) * @see org.jcommander.ui.filepanel.dialogs.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite) */ protected void createMainDialogArea(Composite parent) { labelConfirmQuestion = new Label(parent, SWT.NONE); labelConfirmQuestion.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false)); labelConfirmQuestion.setText("Copy selected files?"); GridData listCompositeData = new GridData(); listCompositeData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; listCompositeData.grabExcessHorizontalSpace = true; listCompositeData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL; listCompositeData.grabExcessVerticalSpace = true; listCompositeData.minimumWidth=400; GridData selectionListData = new GridData(); //GridData removeButtonData = new GridData(); selectionListData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; selectionListData.grabExcessHorizontalSpace = true; selectionListData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL; selectionListData.grabExcessVerticalSpace = true; //removeButtonData.horizontalAlignment = org.eclipse.swt.layout.GridData.END; //removeButtonData.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING; GridLayout listCompositeLayout = new GridLayout(); listCompositeLayout.numColumns = 1; listCompositeLayout.marginWidth=0; listComposite = new Composite(parent, SWT.NONE); listComposite.setLayoutData(listCompositeData); listComposite.setLayout(listCompositeLayout); selectionList = new List(listComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); selectionList.setLayoutData(selectionListData); // removeFileButton = new Button(listComposite, SWT.NONE); // removeFileButton.setLayoutData(gridData2); // removeFileButton.setText("&Remove"); // // removeFileButton.addSelectionListener(new SelectionAdapter() { // public void widgetSelected(SelectionEvent e) { // int [] indices = selectionList.getSelectionIndices(); // selectionList.remove(indices); // // if(selectionList.getItemCount() == 0) { // /** Nothing to copy. Disabling the controls. */ // getYesButton().setEnabled(false); // keepSelectedCheckBox.setEnabled(false); // deleteCheckBox.setEnabled(false); // selectionList.setEnabled(false); // removeFileButton.setEnabled(false); // } // } // }); } /* (non-Javadoc) * @see org.jcommander.ui.filepanel.dialogs.DetailsDialog#getDefaultButtonID() */ int getDefaultButtonID() { return IDialogConstants.OK_ID; } /* (non-Javadoc) * @see org.jcommander.ui.filepanel.dialogs.DetailsDialog#updateEnablements() */ protected void updateEnablements() { } public void setCopyTarget(String target) { this.target=target; updateConfirmMsg(); } public List getSelectionList() { return selectionList; } public void selectDeleteCheckBox(boolean newValue) { delete=newValue; if (isDetailsVisible()){ deleteCheckBox.setSelection(newValue); updateDeleteCheckbox(); } } private void updateDeleteCheckbox() { if(deleteCheckBox.getSelection()){ deleteCheckBox.setForeground(getShell().getDisplay() .getSystemColor(SWT.COLOR_RED)); keepSelectedCheckBox.setSelection(false); keepSelectedCheckBox.setEnabled(false); /*deleteCheckBox.setBackground(getDisplay() .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));*/ } else { deleteCheckBox.setForeground(getShell().getDisplay() .getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); keepSelectedCheckBox.setSelection((FilePanelPlugin.getDefault().getPreferenceStore()). getBoolean(FilePanelPlugin.KEEP_SELECTED_AFTER_COPY_KEY)); keepSelectedCheckBox.setEnabled(true); /*deleteCheckBox.setBackground(getDisplay() .getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));*/ } delete=deleteCheckBox.getSelection(); updateConfirmMsg(); } public boolean close() { names = selectionList.getItems(); return super.close(); } private String getConfirmMsg(){ return (delete?moveMsg:copyMsg)+((target=="")?"?":" to "+target+"?"); } private void updateConfirmMsg(){ labelConfirmQuestion.setText(getConfirmMsg()); } public boolean isKeptSelected() { return keepSelectedCheckBox.getSelection(); } public Button getKeepSelectedCheckBox() { return keepSelectedCheckBox; } public Button getDeleteCheckBox() { return deleteCheckBox; } public String[] getNames() { return names; } } Index: CopyConfirmDialogComposite.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs/CopyConfirmDialogComposite.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** CopyConfirmDialogComposite.java 17 Apr 2006 17:58:31 -0000 1.14 --- CopyConfirmDialogComposite.java 26 Apr 2006 16:39:19 -0000 1.15 *************** *** 122,126 **** } ! public void setCopyTarget(String target) { this.target=target; updateConfirmMsg(); --- 122,126 ---- } ! public void setCopyTarget(String target) { this.target=target; updateConfirmMsg(); --- NEW FILE: DetailsDialog.java --- /******************************************************************************* * from org.eclipse.team.internal.ui.dialogs.DetailsDialog *******************************************************************************/ package org.jcommander.ui.filepanel.dialogs; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.TrayDialog; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; /** * A simple superclass for detail button dialogs. */ abstract public class DetailsDialog extends TrayDialog { /** * The Details button. */ private Button detailsButton; /** * The Ok button. */ private Button okButton; /** * The title of the dialog. */ private String title; /** * The error message */ private Label errorMessageLabel; /** * The SWT list control that displays the error details. */ private HideableComposite detailsComposite; //private Composite detailsFrame; /** * Indicates whether the error details viewer is currently created. */ private boolean detailsCreated = false; /** * The key for the image to be displayed (one of the image constants on Dialog) */ private String imageKey = null; /** * Creates a details pane dialog. * Note that the dialog will have no visual representation (no widgets) * until it is told to open. * * @param parentShell the shell under which to create this dialog * @param dialogTitle the title to use for this dialog * @param message the message to show in this dialog * @param status the error to show to the user * @param displayMask the mask to use to filter the displaying of child items, * as per <code>IStatus.matches</code> * @see org.eclipse.core.runtime.IStatus#matches */ public DetailsDialog(Shell parentShell, String dialogTitle) { super(parentShell); this.title = dialogTitle; setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL); } /* (non-Javadoc) * Method declared on Dialog. * Handles the pressing of the Ok or Details button in this dialog. * If the Ok button was pressed then close this dialog. If the Details * button was pressed then toggle the displaying of the error details area. * Note that the Details button will only be visible if the error being * displayed specifies child details. */ protected void buttonPressed(int id) { if (id == IDialogConstants.DETAILS_ID) { // was the details button pressed? toggleDetailsArea(); } else if (id == IDialogConstants.YES_ID) { setReturnCode(IDialogConstants.YES_ID); close(); } else if (id == IDialogConstants.NO_ID) { setReturnCode(IDialogConstants.NO_ID); close(); } else { super.buttonPressed(id); } } /* (non-Javadoc) * Method declared in Window. */ protected void configureShell(Shell shell) { super.configureShell(shell); shell.setText(title); } /* (non-Javadoc) * Method declared on Dialog. */ protected void createButtonsForButtonBar(Composite parent) { // create OK and Details buttons if(includeYesButton()) { createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, getDefaultButtonID()==IDialogConstants.YES_ID); } if(includeNoButton()) { createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, getDefaultButtonID()==IDialogConstants.NO_ID); } if(includeOkButton()) { okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, getDefaultButtonID()==IDialogConstants.OK_ID); } if (includeCancelButton()) { createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, getDefaultButtonID()==IDialogConstants.CANCEL_ID); } detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false); updateEnablements(); } /* (non-Javadoc) * Method declared on Dialog. * Creates and returns the contents of the upper part * of the dialog (above the button bar). */ final protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite)super.createDialogArea(parent); // create image Image image = JFaceResources.getImageRegistry().get(getImageKey()); if (image != null) { // create a composite to split the dialog area in two Composite top = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.numColumns = 2; top.setLayout(layout); top.setLayoutData(new GridData(GridData.FILL_BOTH)); // add the image to the left of the composite Label label = new Label(top, 0); image.setBackground(label.getBackground()); label.setImage(image); label.setLayoutData(new GridData( GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER)); // add a composite to the right to contain the custom components Composite right = new Composite(top, SWT.NONE); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); right.setLayout(layout); right.setLayoutData(new GridData(GridData.FILL_BOTH)); createMainDialogArea(right); } else { createMainDialogArea(composite); } if (includeErrorLabel()) { errorMessageLabel = new Label(composite, SWT.NONE); errorMessageLabel.setLayoutData(new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); errorMessageLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED)); } detailsComposite = new HideableComposite(composite,SWT.NONE) { protected Composite createContents(Composite parent) { // TODO Auto-generated method stub return createDropDownDialogArea(parent); } }; detailsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // detailsFrame = new Composite(composite,SWT.NONE); // GridLayout detailsLayout = new GridLayout(); // detailsLayout.marginWidth=0; // detailsLayout.marginHeight=1; // detailsFrame.setLayout(detailsLayout); // detailsFrame.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Dialog.applyDialogFont(parent); return composite; } /** * Creates the dialog's top composite * * @param parent the parent composite */ abstract protected void createMainDialogArea(Composite parent); /** * Create this dialog's drop-down list component. * * @param parent the parent composite * @return the drop-down list component */ abstract protected Composite createDropDownDialogArea(Composite parent); /** * Toggles the unfolding of the details area. This is triggered by * the user pressing the details button. */ private void toggleDetailsArea() { Point windowSize = getShell().getSize(); Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); if (detailsCreated) { //detailsComposite.dispose(); detailsComposite.disappear(); detailsCreated = false; detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL); } else { //detailsComposite = createDropDownDialogArea(detailsFrame); detailsComposite.appear(); detailsCreated = true; detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL); } Dialog.applyDialogFont(getContents()); Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT); getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y))); } final protected void setErrorMessage(String error) { if(errorMessageLabel != null) { if(error == null || error.length() == 0) { errorMessageLabel.setText(""); //$NON-NLS-1$ } else { errorMessageLabel.setText(error); } errorMessageLabel.update(); } } final protected void setPageComplete(boolean complete) { if(okButton != null ) { okButton.setEnabled(complete); } } abstract protected void updateEnablements(); protected boolean includeCancelButton() { return true; } protected boolean includeOkButton() { return true; } protected boolean includeYesButton() { return false; } protected boolean includeNoButton() { return false; } protected boolean includeErrorLabel() { return false; } abstract int getDefaultButtonID(); /** * Returns the imageKey. * @return String */ protected String getImageKey() { return imageKey; } /** * Sets the imageKey. * @param imageKey The imageKey to set */ protected void setImageKey(String imageKey) { this.imageKey = imageKey; } protected static final int LABEL_WIDTH_HINT = 400; protected Label createWrappingLabel(Composite parent, String text) { Label label = new Label(parent, SWT.LEFT | SWT.WRAP); label.setText(text); GridData data = new GridData(); data.horizontalSpan = 1; data.horizontalAlignment = GridData.FILL; data.horizontalIndent = 0; data.grabExcessHorizontalSpace = true; data.widthHint = LABEL_WIDTH_HINT; label.setLayoutData(data); return label; } protected Composite createComposite(Composite parent) { 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)); return composite; } protected boolean isDetailsVisible() { return detailsCreated; } } Index: HideableComposite.java =================================================================== RCS file: /cvsroot/jcommander/plugins/org.jcommander.ui.filepanel/src/org/jcommander/ui/filepanel/dialogs/HideableComposite.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HideableComposite.java 24 Apr 2006 20:40:58 -0000 1.1 --- HideableComposite.java 26 Apr 2006 16:39:19 -0000 1.2 *************** *** 4,10 **** package org.jcommander.ui.filepanel.dialogs; - import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Point; - import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; --- 4,8 ---- *************** *** 15,19 **** * */ ! public class HideableComposite{ protected Composite composite; --- 13,17 ---- * */ ! public abstract class HideableComposite{ protected Composite composite; *************** *** 39,50 **** if (!visible) { Point p = composite.getShell().getSize(); ! contents = new Composite(composite,SWT.NONE); ! GridData contentsData = new GridData(); ! contentsData.horizontalAlignment=SWT.FILL; ! contentsData.grabExcessHorizontalSpace=true; ! contents.setLayoutData(contentsData); ! GridLayout contentsLayout = new GridLayout(); ! contents.setLayout(contentsLayout); ! createContents(contents); composite.getShell().pack(); height=composite.getSize().y; --- 37,41 ---- if (!visible) { Point p = composite.getShell().getSize(); ! contents = createContents(composite); composite.getShell().pack(); height=composite.getSize().y; *************** *** 64,70 **** } ! protected void createContents(Composite parent){ ! ! } public void setLayoutData(Object layoutData){ --- 55,59 ---- } ! abstract protected Composite createContents(Composite parent); public void setLayoutData(Object layoutData){ --- NEW FILE: DeleteConfirmDialog.java --- /** * */ package org.jcommander.ui.filepanel.dialogs; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; import org.jcommander.ui.filepanel.FilePanelPlugin; /** * @author MatthiasK * */ public class DeleteConfirmDialog extends DetailsDialog { private List deleteFileList; private Button moveToRecycleButton = null; private Label trashLabel = null; private boolean moveToRecycle; private String[] names; public DeleteConfirmDialog(Shell parentShell) { super(parentShell, "Delete Files"); // TODO Auto-generated constructor stub } /* (non-Javadoc) * @see org.jcommander.ui.filepanel.dialogs.DetailsDialog#createDropDownDialogArea(org.eclipse.swt.widgets.Composite) */ protected Composite createDropDownDialogArea(Composite parent) { Composite trashComposite = new Composite(parent, SWT.BORDER); GridLayout trashLayout = new GridLayout(); trashLayout.numColumns=2; trashComposite.setLayout(trashLayout); trashComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData trashLabelData = new GridData(); GridData moveToRecycleButtonData = new GridData(); trashLabelData.verticalAlignment=SWT.CENTER; moveToRecycleButtonData.verticalAlignment=SWT.CENTER; trashLabel = new Label(trashComposite, SWT.NONE); trashLabel.setText(""); ImageDescriptor imgDesc = FilePanelPlugin.imageDescriptorFromPlugin(FilePanelPlugin.ID, "icons/trash.gif"); Image trashImg = imgDesc.createImage(getShell().getDisplay()); trashLabel.setImage(trashImg); trashLabel.setLayoutData(trashLabelData); moveToRecycleButton = new Button(trashComposite, SWT.CHECK); if(Platform.getOS().equals(Platform.OS_WIN32)) { moveToRecycleButton.setText("&Move to the recycle bin"); moveToRecycleButton.setToolTipText("Moved deleted files to the recycle bin"); } else { moveToRecycleButton.setText("&Move to the trash"); moveToRecycleButton.setToolTipText("Moved deleted files to the trash"); } moveToRecycleButton.setSelection(moveToRecycle); moveToRecycleButton. addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { IPreferenceStore store = FilePanelPlugin.getDefault().getPreferenceStore(); store.setValue(FilePanelPlugin.MOVE_TO_RECYCLE_KEY,((Button) e.getSource()).getSelection()); } catch(Exception ex) { //ignore } } }); moveToRecycleButton.setLayoutData(moveToRecycleButtonData); return trashComposite; } /* (non-Javadoc) * @see org.jcommander.ui.filepanel.dialogs.DetailsDialog#createMainDialogArea(org.eclipse.swt.widgets.Composite) */ protected void createMainDialogArea(Composite parent) { GridLayout infoCompositeLayout = new GridLayout(); infoCompositeLayout.numColumns = 1; GridData infoCompositeData = new GridData(); GridData labelData = new GridData(); Label label = new Label(parent, SWT.NONE); Composite infoComposite = new Composite(parent, SWT.NONE); //gridData1.horizontalAlignment = org.eclipse.swt.layout.GridData.CENTER; labelData.grabExcessHorizontalSpace = true; labelData.grabExcessVerticalSpace = true; label.setText("Delete selected files?"); label.setLayoutData(labelData); //createListComposite(parent); GridData listCompositeData = new GridData(); listCompositeData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; listCompositeData.grabExcessHorizontalSpace = true; listCompositeData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL; listCompositeData.grabExcessVerticalSpace = true; GridData deleteListData = new GridData(); GridData gridData2 = new GridData(); deleteListData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; deleteListData.grabExcessHorizontalSpace = true; deleteListData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL; deleteListData.grabExcessVerticalSpace = true; deleteListData.heightHint=60; deleteListData.minimumWidth=400; gridData2.horizontalAlignment = org.eclipse.swt.layout.GridData.END; gridData2.verticalAlignment = org.eclipse.swt.layout.GridData.BEGINNING; GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; gridLayout.marginWidth=0; Composite listComposite = new Composite(infoComposite, SWT.NONE); listComposite.setLayoutData(listCompositeData); listComposite.setLayout(gridLayout); deleteFileList = new List(listComposite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); deleteFileList.setLayoutData(deleteListData); moveToRecycle = ((FilePanelPlugin.getDefault().getPreferenceStore()). getBoolean(FilePanelPlugin.MOVE_TO_RECYCLE_KEY)); infoCompositeData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; infoCompositeData.verticalAlignment = org.eclipse.swt.layout.GridData.CENTER; infoCompositeData.grabExcessHorizontalSpace = true; infoCompositeData.grabExcessVerticalSpace = true; infoCompositeLayout.marginWidth=0; infoComposite.setLayoutData(infoCompositeData); infoComposite.setLayout(infoCompositeLayout); } /* (non-Javadoc) * @see org.jcommander.ui.filepanel.dialogs.DetailsDialog#updateEnablements() */ protected void updateEnablements() { // TODO Auto-generated method stub } public List getDeleteFileList() { return deleteFileList; } private void toggleEnableMoveToRecycle(boolean value) { if (moveToRecycleButton!=null) { moveToRecycleButton.setEnabled(value); } } private void setMoveToRecycle(boolean value) { IPreferenceStore store = FilePanelPlugin.getDefault().getPreferenceStore(); store.setValue(FilePanelPlugin.MOVE_TO_RECYCLE_KEY,value); if (moveToRecycleButton!=null) { moveToRecycleButton.setSelection(value); } } public void disableMoveToRecycle() { setMoveToRecycle(false); toggleEnableMoveToRecycle(false); } public boolean getMoveToRecycle() { return moveToRecycle; } protected boolean includeOkButton() { return false; } protected boolean includeCancelButton() { return false; } protected boolean includeNoButton() { return true; } protected boolean includeYesButton() { return true; } int getDefaultButtonID() { // TODO Auto-generated method stub return IDialogConstants.NO_ID; } public boolean close() { names = deleteFileList.getItems(); return super.close(); } public String[] getNames() { return names; } } |