|
Lines 1-12
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2003, 2004 IBM Corporation and others. |
2 |
* Copyright (c) 2003, 2006 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* yyyymmdd bug Email and other contact information |
| 11 |
* -------- -------- ----------------------------------------------------------- |
| 12 |
* 20060227 124392 rsinha@ca.ibm.com - Rupam Kuehner |
| 10 |
*******************************************************************************/ |
13 |
*******************************************************************************/ |
| 11 |
|
14 |
|
| 12 |
package org.eclipse.jst.ws.internal.consumption.ui.preferences; |
15 |
package org.eclipse.jst.ws.internal.consumption.ui.preferences; |
|
Lines 31-36
Link Here
|
| 31 |
import org.eclipse.swt.widgets.Button; |
34 |
import org.eclipse.swt.widgets.Button; |
| 32 |
import org.eclipse.swt.widgets.Composite; |
35 |
import org.eclipse.swt.widgets.Composite; |
| 33 |
import org.eclipse.swt.widgets.Control; |
36 |
import org.eclipse.swt.widgets.Control; |
|
|
37 |
import org.eclipse.swt.widgets.Group; |
| 34 |
import org.eclipse.swt.widgets.Table; |
38 |
import org.eclipse.swt.widgets.Table; |
| 35 |
import org.eclipse.swt.widgets.TableColumn; |
39 |
import org.eclipse.swt.widgets.TableColumn; |
| 36 |
import org.eclipse.swt.widgets.Text; |
40 |
import org.eclipse.swt.widgets.Text; |
|
Lines 47-52
Link Here
|
| 47 |
/*CONTEXT_ID PTPP0001 for the Project Topology Preference Page*/ |
51 |
/*CONTEXT_ID PTPP0001 for the Project Topology Preference Page*/ |
| 48 |
private String INFOPOP_PTPP_PAGE = WebServiceUIPlugin.ID + ".PPTP0001"; |
52 |
private String INFOPOP_PTPP_PAGE = WebServiceUIPlugin.ID + ".PPTP0001"; |
| 49 |
|
53 |
|
|
|
54 |
private TableViewer serviceTypeViewer_; |
| 55 |
private Button serviceMoveUp_; |
| 56 |
private Button serviceMoveDown_; |
| 57 |
private Vector serviceTypes_; |
| 58 |
|
| 50 |
private TableViewer clientTypeViewer_; |
59 |
private TableViewer clientTypeViewer_; |
| 51 |
private Button moveUp_; |
60 |
private Button moveUp_; |
| 52 |
private Button moveDown_; |
61 |
private Button moveDown_; |
|
Lines 68-84
Link Here
|
| 68 |
parent.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); |
77 |
parent.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) ); |
| 69 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,INFOPOP_PTPP_PAGE); |
78 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,INFOPOP_PTPP_PAGE); |
| 70 |
|
79 |
|
| 71 |
Text clientTypeLabel = new Text(parent, SWT.READ_ONLY | SWT.WRAP); |
80 |
Group serviceTypeComposite = new Group( parent, SWT.NONE ); |
| 72 |
clientTypeLabel.setText(WSUIPluginMessages.LABEL_CLIENT_TYPE_NAME); |
81 |
GridLayout servicegl = new GridLayout(); |
| 73 |
clientTypeLabel.setLayoutData( new GridData( GridData.FILL_HORIZONTAL)); |
82 |
servicegl.numColumns = 2; |
|
|
83 |
servicegl.marginHeight = 0; |
| 84 |
servicegl.marginWidth = 0; |
| 85 |
serviceTypeComposite.setLayout(servicegl); |
| 86 |
serviceTypeComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL )); |
| 87 |
serviceTypeComposite.setText(WSUIPluginMessages.LABEL_SERVICE_TYPE_NAME); |
| 88 |
|
| 89 |
Table serviceTable= new Table(serviceTypeComposite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); |
| 90 |
GridData servicegd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); |
| 91 |
servicegd.widthHint = 256; |
| 92 |
serviceTable.setLayoutData(servicegd); |
| 93 |
serviceTable.setToolTipText(WSUIPluginMessages.TOOLTIP_SERVICE_TYPE_TABLE_VIEWER); |
| 94 |
|
| 95 |
serviceTypes_ = new Vector(); |
| 96 |
serviceTypeViewer_ = new TableViewer(serviceTable); |
| 97 |
serviceTypeViewer_.setContentProvider(new ClientTypeContentProvider()); |
| 98 |
serviceTypeViewer_.setLabelProvider(new ClientTypeLabelProvider()); |
| 99 |
serviceTypeViewer_.setInput(serviceTypes_); |
| 100 |
|
| 101 |
TableLayout serviceTableLayout = new TableLayout(); |
| 102 |
TableColumn serviceTableColumn = new TableColumn(serviceTable, SWT.NONE); |
| 103 |
serviceTableColumn.setText(WSUIPluginMessages.LABEL_SERVICE_TYPE_NAME); |
| 104 |
ColumnWeightData serviceColumnData = new ColumnWeightData(256, 256, false); |
| 105 |
serviceTableLayout.addColumnData(serviceColumnData); |
| 106 |
serviceTable.setLayout(serviceTableLayout); |
| 107 |
|
| 108 |
Composite servicec = new Composite(serviceTypeComposite, SWT.NONE); |
| 109 |
servicegl = new GridLayout(); |
| 110 |
servicegl.numColumns = 1; |
| 111 |
servicegl.marginHeight = 10; |
| 112 |
servicegl.marginWidth = 0; |
| 113 |
servicec.setLayout(servicegl); |
| 114 |
|
| 115 |
serviceMoveUp_ = new Button(servicec, SWT.PUSH); |
| 116 |
serviceMoveUp_.setText(WSUIPluginMessages.LABEL_MOVE_UP); |
| 117 |
serviceMoveUp_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); |
| 118 |
serviceMoveUp_.addSelectionListener(this); |
| 119 |
serviceMoveUp_.setToolTipText(WSUIPluginMessages.TOOLTIP_MOVE_UP); |
| 120 |
|
| 121 |
serviceMoveDown_ = new Button(servicec, SWT.PUSH); |
| 122 |
serviceMoveDown_.setText(WSUIPluginMessages.LABEL_MOVE_DOWN); |
| 123 |
serviceMoveDown_.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); |
| 124 |
serviceMoveDown_.addSelectionListener(this); |
| 125 |
serviceMoveDown_.setToolTipText(WSUIPluginMessages.TOOLTIP_MOVE_DOWN); |
| 126 |
|
| 74 |
|
127 |
|
| 75 |
Composite clientTypeComposite = new Composite(parent, SWT.NONE); |
128 |
Group clientTypeComposite = new Group( parent, SWT.NONE ); |
| 76 |
GridLayout gl = new GridLayout(); |
129 |
GridLayout gl = new GridLayout(); |
| 77 |
gl.numColumns = 2; |
130 |
gl.numColumns = 2; |
| 78 |
gl.marginHeight = 0; |
131 |
gl.marginHeight = 0; |
| 79 |
gl.marginWidth = 0; |
132 |
gl.marginWidth = 0; |
| 80 |
clientTypeComposite.setLayout(gl); |
133 |
clientTypeComposite.setLayout(gl); |
| 81 |
clientTypeComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL )); |
134 |
clientTypeComposite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL )); |
|
|
135 |
clientTypeComposite.setText(WSUIPluginMessages.LABEL_CLIENT_TYPE_NAME); |
| 82 |
|
136 |
|
| 83 |
Table table= new Table(clientTypeComposite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); |
137 |
Table table= new Table(clientTypeComposite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); |
| 84 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); |
138 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); |
|
Lines 157-176
Link Here
|
| 157 |
*/ |
211 |
*/ |
| 158 |
public void init(IWorkbench workbench) { } |
212 |
public void init(IWorkbench workbench) { } |
| 159 |
|
213 |
|
|
|
214 |
|
| 160 |
/** |
215 |
/** |
| 161 |
* Initializes states of the controls to their burned-in defaults. |
216 |
* Adds the String elements of array a into Vector v. If String array b contains any elements |
|
|
217 |
* that are not already in array a, appends these elements from array b to the end of Vector v. |
| 218 |
* @param a a String array |
| 219 |
* @param b a String array |
| 220 |
* @param v a non-null Vector |
| 162 |
*/ |
221 |
*/ |
| 163 |
private void initializeDefaults() |
222 |
private void setVectorContentsFromTwoArrays(String[] a, String[] b, Vector v) |
| 164 |
{ |
223 |
{ |
| 165 |
clientTypes_.clear(); |
224 |
for (int i = 0; i < a.length; i++) |
| 166 |
String[] types = ProjectTopologyDefaults.getClientTypes(); |
|
|
| 167 |
|
| 168 |
for (int i = 0; i < types.length; i++) |
| 169 |
{ |
225 |
{ |
| 170 |
clientTypes_.add(types[i]); |
226 |
v.add(a[i]); |
| 171 |
} |
227 |
} |
| 172 |
|
228 |
|
|
|
229 |
for (int i = 0; i < b.length; i++) |
| 230 |
{ |
| 231 |
if (v.indexOf(b[i]) == -1) |
| 232 |
{ |
| 233 |
v.add(b[i]); |
| 234 |
} |
| 235 |
} |
| 236 |
} |
| 237 |
|
| 238 |
/** |
| 239 |
* Initializes states of the controls to their burned-in defaults. |
| 240 |
*/ |
| 241 |
private void initializeDefaults() |
| 242 |
{ |
| 243 |
ProjectTopologyContext context = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); |
| 244 |
serviceTypes_.clear(); |
| 245 |
String[] defaultServiceTypes = context.getDefaultServiceTypes(); |
| 246 |
String[] allServiceTypes = ProjectTopologyDefaults.getServiceTypes(); |
| 247 |
setVectorContentsFromTwoArrays(defaultServiceTypes, allServiceTypes, serviceTypes_); |
| 248 |
serviceTypeViewer_.refresh(); |
| 249 |
|
| 250 |
clientTypes_.clear(); |
| 251 |
String[] defaultClientTypes = context.getDefaultClientTypes(); |
| 252 |
String[] allClientTypes = ProjectTopologyDefaults.getClientTypes(); |
| 253 |
setVectorContentsFromTwoArrays(defaultClientTypes, allClientTypes, clientTypes_); |
| 173 |
clientTypeViewer_.refresh(); |
254 |
clientTypeViewer_.refresh(); |
|
|
255 |
|
| 174 |
twoEAR_.setSelection(true); |
256 |
twoEAR_.setSelection(true); |
| 175 |
} |
257 |
} |
| 176 |
|
258 |
|
|
Lines 179-207
Link Here
|
| 179 |
*/ |
261 |
*/ |
| 180 |
private void initializeValues() |
262 |
private void initializeValues() |
| 181 |
{ |
263 |
{ |
|
|
264 |
//Initial service project types. |
| 182 |
ProjectTopologyContext context = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); |
265 |
ProjectTopologyContext context = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); |
| 183 |
String[] types = context.getClientTypes(); |
266 |
String[] serviceTypesFromContext = context.getServiceTypes(); |
| 184 |
for (int i = 0; i < types.length; i++) |
267 |
String[] allServiceTypes = ProjectTopologyDefaults.getServiceTypes(); |
| 185 |
clientTypes_.add(types[i]); |
268 |
setVectorContentsFromTwoArrays(serviceTypesFromContext, allServiceTypes, serviceTypes_); |
| 186 |
// check whether we missed any types from the default list |
269 |
if (allServiceTypes.length > serviceTypesFromContext.length) |
| 187 |
boolean missed = false; |
|
|
| 188 |
types = ProjectTopologyDefaults.getClientTypes(); |
| 189 |
for (int i = 0; i < types.length; i++) |
| 190 |
{ |
270 |
{ |
| 191 |
if (clientTypes_.indexOf(types[i]) == -1) |
271 |
String[] serviceTypesArray = new String[serviceTypes_.size()]; |
| 192 |
{ |
272 |
serviceTypes_.copyInto(serviceTypesArray); |
| 193 |
clientTypes_.add(types[i]); |
273 |
context.setServiceTypes(serviceTypesArray); |
| 194 |
missed = true; |
|
|
| 195 |
} |
| 196 |
} |
274 |
} |
| 197 |
if (missed) |
275 |
// refresh viewer |
|
|
276 |
serviceTypeViewer_.refresh(); |
| 277 |
|
| 278 |
|
| 279 |
//Initialize client project types. |
| 280 |
String[] clientTypesFromContext = context.getClientTypes(); |
| 281 |
String[] allClientTypes = ProjectTopologyDefaults.getClientTypes(); |
| 282 |
setVectorContentsFromTwoArrays(clientTypesFromContext, allClientTypes, clientTypes_); |
| 283 |
if (allClientTypes.length > clientTypesFromContext.length) |
| 198 |
{ |
284 |
{ |
| 199 |
types = new String[clientTypes_.size()]; |
285 |
String[] clientTypesArray = new String[clientTypes_.size()]; |
| 200 |
clientTypes_.copyInto(types); |
286 |
clientTypes_.copyInto(clientTypesArray); |
| 201 |
context.setClientTypes(types); |
287 |
context.setClientTypes(clientTypesArray); |
| 202 |
} |
288 |
} |
|
|
289 |
|
| 203 |
// refresh viewer |
290 |
// refresh viewer |
| 204 |
clientTypeViewer_.refresh(); |
291 |
clientTypeViewer_.refresh(); |
|
|
292 |
|
| 205 |
twoEAR_.setSelection(context.isUseTwoEARs()); |
293 |
twoEAR_.setSelection(context.isUseTwoEARs()); |
| 206 |
} |
294 |
} |
| 207 |
|
295 |
|
|
Lines 211-216
Link Here
|
| 211 |
private void storeValues() |
299 |
private void storeValues() |
| 212 |
{ |
300 |
{ |
| 213 |
ProjectTopologyContext context = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); |
301 |
ProjectTopologyContext context = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext(); |
|
|
302 |
String[] serviceTypesArray = new String[serviceTypes_.size()]; |
| 303 |
serviceTypes_.copyInto(serviceTypesArray); |
| 304 |
context.setServiceTypes(serviceTypesArray); |
| 214 |
String[] types = new String[clientTypes_.size()]; |
305 |
String[] types = new String[clientTypes_.size()]; |
| 215 |
clientTypes_.copyInto(types); |
306 |
clientTypes_.copyInto(types); |
| 216 |
context.setClientTypes(types); |
307 |
context.setClientTypes(types); |
|
Lines 223-242
Link Here
|
| 223 |
|
314 |
|
| 224 |
public void widgetSelected(SelectionEvent e) |
315 |
public void widgetSelected(SelectionEvent e) |
| 225 |
{ |
316 |
{ |
| 226 |
int index = clientTypeViewer_.getTable().getSelectionIndex(); |
317 |
if (e.widget == serviceMoveUp_ || e.widget == serviceMoveDown_) |
| 227 |
if (index != -1) |
|
|
| 228 |
{ |
318 |
{ |
| 229 |
if (e.widget == moveUp_ && index > 0) |
319 |
int index = serviceTypeViewer_.getTable().getSelectionIndex(); |
|
|
320 |
if (index != -1) |
| 230 |
{ |
321 |
{ |
| 231 |
Object object = clientTypes_.remove(index); |
322 |
if (e.widget == serviceMoveUp_ && index > 0) |
| 232 |
clientTypes_.insertElementAt(object, index-1); |
323 |
{ |
| 233 |
clientTypeViewer_.refresh(); |
324 |
Object object = serviceTypes_.remove(index); |
|
|
325 |
serviceTypes_.insertElementAt(object, index-1); |
| 326 |
serviceTypeViewer_.refresh(); |
| 327 |
} |
| 328 |
else if (e.widget == serviceMoveDown_ && index < serviceTypes_.size()-1) |
| 329 |
{ |
| 330 |
Object object = serviceTypes_.remove(index); |
| 331 |
serviceTypes_.insertElementAt(object, index+1); |
| 332 |
serviceTypeViewer_.refresh(); |
| 333 |
} |
| 234 |
} |
334 |
} |
| 235 |
else if (e.widget == moveDown_ && index < clientTypes_.size()-1) |
335 |
} |
|
|
336 |
else if (e.widget == moveUp_ || e.widget == moveDown_) |
| 337 |
{ |
| 338 |
int index = clientTypeViewer_.getTable().getSelectionIndex(); |
| 339 |
if (index != -1) |
| 236 |
{ |
340 |
{ |
| 237 |
Object object = clientTypes_.remove(index); |
341 |
if (e.widget == moveUp_ && index > 0) |
| 238 |
clientTypes_.insertElementAt(object, index+1); |
342 |
{ |
| 239 |
clientTypeViewer_.refresh(); |
343 |
Object object = clientTypes_.remove(index); |
|
|
344 |
clientTypes_.insertElementAt(object, index - 1); |
| 345 |
clientTypeViewer_.refresh(); |
| 346 |
} else if (e.widget == moveDown_ && index < clientTypes_.size() - 1) |
| 347 |
{ |
| 348 |
Object object = clientTypes_.remove(index); |
| 349 |
clientTypes_.insertElementAt(object, index + 1); |
| 350 |
clientTypeViewer_.refresh(); |
| 351 |
} |
| 240 |
} |
352 |
} |
| 241 |
} |
353 |
} |
| 242 |
} |
354 |
} |