1 11 package org.eclipse.team.internal.ui.dialogs; 12 13 import org.eclipse.swt.SWT; 14 import org.eclipse.swt.events.SelectionEvent; 15 import org.eclipse.swt.events.SelectionListener; 16 import org.eclipse.swt.layout.GridData; 17 import org.eclipse.swt.layout.GridLayout; 18 import org.eclipse.swt.widgets.*; 19 import org.eclipse.team.core.mapping.ISynchronizationScope; 20 import org.eclipse.team.core.mapping.ISynchronizationContext; 21 import org.eclipse.team.internal.ui.SWTUtils; 22 import org.eclipse.team.internal.ui.TeamUIMessages; 23 24 public class AdditionalMappingsDialog extends DetailsDialog { 25 26 private ResourceMappingHierarchyArea selectedMappingsArea; 27 private ResourceMappingHierarchyArea allMappingsArea; 28 private final ISynchronizationScope scope; 29 private final ISynchronizationContext context; 30 private String previewMessage; 31 protected boolean forcePreview = true; 32 33 public AdditionalMappingsDialog(Shell parentShell, String dialogTitle, ISynchronizationScope scope, ISynchronizationContext context) { 34 super(parentShell, dialogTitle); 35 this.scope = scope; 36 this.context = context; 37 } 38 39 protected void createMainDialogArea(Composite parent) { 40 createWrappingLabel(parent, TeamUIMessages.AdditionalMappingsDialog_0); 41 createSelectedMappingsArea(parent); 42 createAllMappingsArea(parent); 43 createPreviewOptionArea(parent); 44 } 45 46 49 private void createSelectedMappingsArea(Composite parent) { 50 Composite composite = createComposite(parent); 51 GridLayout layout = new GridLayout(1, false); 52 layout.marginHeight = 0; 53 layout.marginWidth = 0; 54 composite.setLayout(layout); 55 selectedMappingsArea = ResourceMappingHierarchyArea.create(scope.asInputScope(), null ); 56 selectedMappingsArea.setDescription(TeamUIMessages.AdditionalMappingsDialog_1); 57 selectedMappingsArea.createArea(composite); 58 Label seperator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); 60 seperator.setLayoutData(new GridData (GridData.FILL_HORIZONTAL)); 61 } 62 63 66 private void createAllMappingsArea(Composite parent) { 67 Composite composite = createComposite(parent); 68 GridLayout layout = new GridLayout(1, false); 69 layout.marginHeight = 0; 70 layout.marginWidth = 0; 71 composite.setLayout(layout); 72 allMappingsArea = ResourceMappingHierarchyArea.create(scope, context); 73 allMappingsArea.setDescription(TeamUIMessages.AdditionalMappingsDialog_2); 74 allMappingsArea.createArea(composite); 76 } 77 78 private void createPreviewOptionArea(Composite parent) { 79 if (previewMessage != null) { 80 final Button forcePreviewButton = SWTUtils.createCheckBox(parent, previewMessage); 81 forcePreviewButton.setSelection(forcePreview); 82 forcePreviewButton.addSelectionListener(new SelectionListener() { 83 public void widgetDefaultSelected(SelectionEvent e) { 84 } 86 public void widgetSelected(SelectionEvent e) { 87 forcePreview = forcePreviewButton.getSelection(); 88 } 89 }); 90 } 91 } 92 93 protected Composite createDropDownDialogArea(Composite parent) { 94 return null; 96 } 97 98 protected void updateEnablements() { 99 101 } 102 103 protected boolean includeDetailsButton() { 104 return false; 105 } 106 107 public String getPreviewMessage() { 108 return previewMessage; 109 } 110 111 public void setPreviewMessage(String previewMessage) { 112 this.previewMessage = previewMessage; 113 } 114 115 public boolean isForcePreview() { 116 return forcePreview; 117 } 118 119 } 120 | Popular Tags |