KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ui > dialogs > AdditionalMappingsDialog


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

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 JavaDoc previewMessage;
31     protected boolean forcePreview = true;
32
33     public AdditionalMappingsDialog(Shell parentShell, String JavaDoc 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     /*
47      * Create a list that allows the selection of mappings via checkbox
48      */

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 /* no context */);
56         selectedMappingsArea.setDescription(TeamUIMessages.AdditionalMappingsDialog_1);
57         selectedMappingsArea.createArea(composite);
58         // Create a separator between the two sets of buttons
59
Label seperator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
60         seperator.setLayoutData(new GridData (GridData.FILL_HORIZONTAL));
61     }
62     
63     /*
64      * Create a list that allows the selection of mappings via checkbox
65      */

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.addPropertyChangeListener(this);
75
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                     // Ignore
85
}
86                 public void widgetSelected(SelectionEvent e) {
87                     forcePreview = forcePreviewButton.getSelection();
88                 }
89             });
90         }
91     }
92     
93     protected Composite createDropDownDialogArea(Composite parent) {
94         // TODO Auto-generated method stub
95
return null;
96     }
97
98     protected void updateEnablements() {
99         // TODO Auto-generated method stub
100

101     }
102     
103     protected boolean includeDetailsButton() {
104         return false;
105     }
106
107     public String JavaDoc getPreviewMessage() {
108         return previewMessage;
109     }
110
111     public void setPreviewMessage(String JavaDoc previewMessage) {
112         this.previewMessage = previewMessage;
113     }
114
115     public boolean isForcePreview() {
116         return forcePreview;
117     }
118
119 }
120
Popular Tags