1 11 package org.eclipse.team.internal.ui.dialogs; 12 13 import org.eclipse.core.resources.IProject; 14 import org.eclipse.jface.dialogs.IDialogConstants; 15 import org.eclipse.swt.SWT; 16 import org.eclipse.swt.layout.GridData; 17 import org.eclipse.swt.layout.GridLayout; 18 import org.eclipse.swt.widgets.*; 19 20 23 public class DetailsDialogWithProjects extends DetailsDialog { 24 25 private String message; 26 private String detailsTitle; 27 private IProject[] projects; 28 private org.eclipse.swt.widgets.List detailsList; 29 30 private boolean includeCancelButton; 31 32 37 public DetailsDialogWithProjects(Shell parentShell, String dialogTitle, String dialogMessage, String detailsTitle, IProject[] projects, boolean includeCancelButton, String imageKey) { 38 super(parentShell, dialogTitle); 39 setImageKey(imageKey); 40 this.message = dialogMessage; 41 this.detailsTitle = detailsTitle; 42 this.projects = projects; 43 this.includeCancelButton = includeCancelButton; 44 } 45 46 49 protected void createMainDialogArea(Composite composite) { 50 Label label = new Label(composite, SWT.WRAP); 51 label.setText(message); 52 GridData data = new GridData( 53 GridData.GRAB_HORIZONTAL | 54 GridData.GRAB_VERTICAL | 55 GridData.HORIZONTAL_ALIGN_FILL | 56 GridData.VERTICAL_ALIGN_CENTER); 57 data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); 58 label.setLayoutData(data); 59 updateEnablements(); 60 } 61 62 65 protected Composite createDropDownDialogArea(Composite parent) { 66 Composite composite = new Composite(parent, SWT.NONE); 68 GridLayout layout = new GridLayout(); 69 layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); 70 layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); 71 layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); 72 layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); 73 composite.setLayout(layout); 74 composite.setLayoutData(new GridData(GridData.FILL_BOTH)); 75 76 detailsList = new org.eclipse.swt.widgets.List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); 77 GridData data = new GridData (); 78 data.heightHint = 75; 79 data.horizontalAlignment = GridData.FILL; 80 data.grabExcessHorizontalSpace = true; 81 detailsList.setLayoutData(data); 82 83 if (detailsTitle != null) { 84 detailsList.add(detailsTitle); 85 } 86 87 for (int i = 0; i < projects.length; i++) { 88 detailsList.add(projects[i].getName()); 89 } 90 return composite; 91 } 92 93 96 protected void updateEnablements() { 97 setPageComplete(true); 98 } 99 100 103 protected boolean includeCancelButton() { 104 return includeCancelButton; 105 } 106 107 } 108 | Popular Tags |