Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 124392 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ProjectSelectionWidget.java (-30 / +11 lines)
Lines 12-17 Link Here
12
 * 20060204 124143   rsinha@ca.ibm.com - Rupam Kuehner          
12
 * 20060204 124143   rsinha@ca.ibm.com - Rupam Kuehner          
13
 * 20060221   122661 rsinha@ca.ibm.com - Rupam Kuehner
13
 * 20060221   122661 rsinha@ca.ibm.com - Rupam Kuehner
14
 * 20060223   129020 rsinha@ca.ibm.com - Rupam Kuehner
14
 * 20060223   129020 rsinha@ca.ibm.com - Rupam Kuehner
15
 * 20060227   124392 rsinha@ca.ibm.com - Rupam Kuehner
15
 *******************************************************************************/
16
 *******************************************************************************/
16
package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
17
package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
17
18
Lines 361-372 Link Here
361
      }
362
      }
362
      else
363
      else
363
      {
364
      {
364
365
        if (isClient_)
366
        {
367
          // Select the preferred client project type.
365
          // Select the preferred client project type.
368
          ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
366
          ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
369
          String[] preferredTemplateIds = ptc.getClientTypes();
367
          String[] preferredTemplateIds = null;
368
          if (isClient_)
369
          {
370
            preferredTemplateIds = ptc.getClientTypes();
371
          }
372
          else
373
          {
374
            preferredTemplateIds = ptc.getServiceTypes();
375
          }
376
          
370
          boolean selected = false;
377
          boolean selected = false;
371
          outer: for (int j = 0; j < preferredTemplateIds.length; j++)
378
          outer: for (int j = 0; j < preferredTemplateIds.length; j++)
372
          {
379
          {
Lines 386-404 Link Here
386
          {
393
          {
387
            projectType_.select(0);
394
            projectType_.select(0);
388
          }
395
          }
389
390
        } else
391
        {
392
          // If a "..web.." template is there, pick that as the default.
393
          int webTemplateIndex = getWebTemplateIndex(templates);
394
          if (webTemplateIndex > -1)
395
          {
396
            projectType_.select(webTemplateIndex);
397
          } else
398
          {
399
            projectType_.select(0);
400
          }
401
        }
402
      }
396
      }
403
    }
397
    }
404
  }
398
  }
Lines 417-435 Link Here
417
    return -1;    
411
    return -1;    
418
  }
412
  }
419
  
413
  
420
  private int getWebTemplateIndex(String[] templateIds)
421
  {
422
    for (int i=0; i<templateIds.length; i++)
423
    {
424
      if (templateIds[i].indexOf("web") > -1)
425
      {
426
        return i;
427
      }
428
    }
429
    
430
    return -1;
431
  }
432
  
433
  private void updateEARState()
414
  private void updateEARState()
434
  {
415
  {
435
      if(!projectNeedsEAR(moduleProject_.getText()))
416
      if(!projectNeedsEAR(moduleProject_.getText()))
(-)src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java (-11 / +24 lines)
Lines 13-18 Link Here
13
 * 20060206 126408   rsinha@ca.ibm.com - Rupam Kuehner
13
 * 20060206 126408   rsinha@ca.ibm.com - Rupam Kuehner
14
 * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
14
 * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
15
 * 20060222   115834 rsinha@ca.ibm.com - Rupam Kuehner
15
 * 20060222   115834 rsinha@ca.ibm.com - Rupam Kuehner
16
 * 20060227   124392 rsinha@ca.ibm.com - Rupam Kuehner
16
 *******************************************************************************/
17
 *******************************************************************************/
17
package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
18
package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
18
19
Lines 655-661 Link Here
655
  {
656
  {
656
    String[] templates = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(clientIds_.getTypeId(), clientIds_.getRuntimeId());
657
    String[] templates = WebServiceRuntimeExtensionUtils2.getClientProjectTemplates(clientIds_.getTypeId(), clientIds_.getRuntimeId());
657
    
658
    
658
    //Pick the Web one if it's there, otherwise pick the first one.
659
    //Walk the list of client project types in the project topology preference
659
    //Walk the list of client project types in the project topology preference
660
    ProjectTopologyContext ptc= WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
660
    ProjectTopologyContext ptc= WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
661
    String[] preferredTemplateIds = ptc.getClientTypes();
661
    String[] preferredTemplateIds = ptc.getClientTypes();
Lines 955-977 Link Here
955
    //Haven't returned yet so this means that the intitially selected project cannot be used
955
    //Haven't returned yet so this means that the intitially selected project cannot be used
956
    //to influence the selection of the service/client runtime. 
956
    //to influence the selection of the service/client runtime. 
957
    
957
    
958
    //If this is client defaulting, use the preferred client project types to
958
      //Use the preferred project types to influence the selection of a runtime.
959
    //influence the selection of a runtime.
960
    if (isClient)
961
    {
962
      ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
959
      ProjectTopologyContext ptc = WebServiceConsumptionUIPlugin.getInstance().getProjectTopologyContext();
963
      String[] preferredTemplateIds = ptc.getClientTypes();
960
      String[] preferredTemplateIds = null;
961
      if (isClient)
962
      {
963
        preferredTemplateIds = ptc.getClientTypes();  
964
      }
965
      else
966
      {
967
        preferredTemplateIds = ptc.getServiceTypes();
968
      }
969
      
964
    
970
    
965
      for (int n=0; n<preferredTemplateIds.length; n++)
971
      for (int n=0; n<preferredTemplateIds.length; n++)
966
      {
972
      {
967
        String preferredTemplateId = preferredTemplateIds[n];
973
        String preferredTemplateId = preferredTemplateIds[n];
968
        //Set templateFacetVersions = FacetUtils.getInitialFacetVersionsFromTemplate(preferredTemplateId);
969
974
970
        for (int m=0; m<preferredRuntimeIds.length; m++)
975
        for (int m=0; m<preferredRuntimeIds.length; m++)
971
        {
976
        {
972
          //If this clientRuntime supports this template, choose it and exit.        
977
          //If this client or service runtime supports this template, choose it and exit.        
973
          //ClientRuntimeDescriptor desc = WebServiceRuntimeExtensionUtils2.getClientRuntimeDescriptorById(preferredRuntimeIds[m]);
978
          boolean matches = false;
974
          boolean matches = WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportTemplate(preferredRuntimeIds[m], preferredTemplateId);
979
          if (isClient)
980
          {
981
            matches = WebServiceRuntimeExtensionUtils2.doesClientRuntimeSupportTemplate(preferredRuntimeIds[m], preferredTemplateId);            
982
          }
983
          else
984
          {
985
            matches = WebServiceRuntimeExtensionUtils2.doesServiceRuntimeSupportTemplate(preferredRuntimeIds[m], preferredTemplateId);
986
          }
987
          
975
          if (matches)
988
          if (matches)
976
          {
989
          {
977
            DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
990
            DefaultRuntimeTriplet drt = new DefaultRuntimeTriplet();
Lines 982-988 Link Here
982
          }        
995
          }        
983
        }
996
        }
984
      }
997
      }
985
    }
998
    
986
    
999
    
987
    //Still haven't returned. Return the first preferred service/client runtime id.
1000
    //Still haven't returned. Return the first preferred service/client runtime id.
988
    if (preferredRuntimeIds.length > 0)
1001
    if (preferredRuntimeIds.length > 0)
(-)src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyContext.java (-3 / +12 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 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 17-30 Link Here
17
    * This constant String is used to lookup the preferred order of the different client types
20
    * This constant String is used to lookup the preferred order of the different client types
18
  **/
21
  **/
19
  public static final String PREFERENCE_CLIENT_TYPES = "clientTypes";
22
  public static final String PREFERENCE_CLIENT_TYPES = "clientTypes";
23
  public static final String PREFERENCE_SERVICE_TYPES = "serviceTypes";
20
  
24
  
21
  /**
25
  /**
22
    * This constant String is used to lookup the two EAR option
26
    * This constant String is used to lookup the two EAR option
23
  **/
27
  **/
24
  public static final String PREFERENCE_USE_TWO_EARS = "useTwoEARs";
28
  public static final String PREFERENCE_USE_TWO_EARS = "useTwoEARs";
25
  
29
  
30
  public void setServiceTypes(String[] ids);
31
  public String[] getServiceTypes();
32
  public String[] getDefaultServiceTypes();
33
  
26
  public void setClientTypes(String[] ids);
34
  public void setClientTypes(String[] ids);
27
  public String[] getClientTypes();
35
  public String[] getClientTypes();
36
  public String[] getDefaultClientTypes();
28
37
29
  public void setUseTwoEARs(boolean use);
38
  public void setUseTwoEARs(boolean use);
30
  public boolean isUseTwoEARs();
39
  public boolean isUseTwoEARs();
(-)src/org/eclipse/jst/ws/internal/consumption/ui/preferences/TransientProjectTopologyContext.java (-3 / +47 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 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 14-24 Link Here
14
17
15
public class TransientProjectTopologyContext implements ProjectTopologyContext
18
public class TransientProjectTopologyContext implements ProjectTopologyContext
16
{
19
{
20
 private String[] serviceTypes;
21
 private String[] defaultServiceTypes;
22
 
17
 private String[] clientTypes;
23
 private String[] clientTypes;
24
 private String[] defaultClientTypes;
25
 
18
 private boolean twoEARs;
26
 private boolean twoEARs;
19
 
27
 
20
 public TransientProjectTopologyContext () {}
28
 public TransientProjectTopologyContext () {}
21
29
30
 public void setServiceTypes(String[] serviceTypes)
31
 {
32
   this.serviceTypes = serviceTypes;
33
 }
34
 public String[] getServiceTypes()
35
 {
36
   return serviceTypes;
37
 }
38
 
22
 public void setClientTypes(String[] clientTypes)
39
 public void setClientTypes(String[] clientTypes)
23
 {
40
 {
24
   this.clientTypes = clientTypes;
41
   this.clientTypes = clientTypes;
Lines 39-46 Link Here
39
56
40
 public ProjectTopologyContext copy() {
57
 public ProjectTopologyContext copy() {
41
 	TransientProjectTopologyContext context = new TransientProjectTopologyContext();
58
 	TransientProjectTopologyContext context = new TransientProjectTopologyContext();
59
    context.setServiceTypes(getServiceTypes());
60
    context.setDefaultServiceTypes(getDefaultServiceTypes());
42
	context.setClientTypes(getClientTypes());
61
	context.setClientTypes(getClientTypes());
62
    context.setDefaultClientTypes(getDefaultClientTypes());
43
	context.setUseTwoEARs(isUseTwoEARs());
63
	context.setUseTwoEARs(isUseTwoEARs());
44
	return context;
64
	return context;
45
 }
65
 }
66
67
 
68
public void setDefaultServiceTypes(String[] defaultServiceTypes)
69
{
70
  this.defaultServiceTypes = defaultServiceTypes;
71
}
72
73
public String[] getDefaultServiceTypes()
74
{
75
  return defaultServiceTypes;
76
77
}
78
79
80
public void setDefaultClientTypes(String[] defaultClientTypes)
81
{
82
  this.defaultClientTypes = defaultClientTypes;
83
}
84
85
public String[] getDefaultClientTypes()
86
{
87
  return defaultClientTypes;
88
89
}
46
}
90
}
(-)src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyPreferencePage.java (-40 / +152 lines)
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
  }
(-)src/org/eclipse/jst/ws/internal/consumption/ui/preferences/ProjectTopologyDefaults.java (-3 / +12 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2004 IBM Corporation and others.
2
 * Copyright (c) 2000, 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 15-20 Link Here
15
18
16
public class ProjectTopologyDefaults
19
public class ProjectTopologyDefaults
17
{
20
{
21
  
22
  public static final String[] getServiceTypes()
23
  {
24
    return WebServiceRuntimeExtensionUtils2.getAllServiceProjectTypes();
25
  }
26
  
18
  public static final String[] getClientTypes()
27
  public static final String[] getClientTypes()
19
  {
28
  {
20
    return WebServiceRuntimeExtensionUtils2.getAllClientProjectTypes();
29
    return WebServiceRuntimeExtensionUtils2.getAllClientProjectTypes();
(-)src/org/eclipse/jst/ws/internal/consumption/ui/preferences/PersistentProjectTopologyContext.java (+56 lines)
Lines 11-16 Link Here
11
 * -------- -------- -----------------------------------------------------------
11
 * -------- -------- -----------------------------------------------------------
12
 * 20060202   119780 pmoogk@ca.ibm.com - Peter Moogk
12
 * 20060202   119780 pmoogk@ca.ibm.com - Peter Moogk
13
 * 20060216   127138 pmoogk@ca.ibm.com - Peter Moogk
13
 * 20060216   127138 pmoogk@ca.ibm.com - Peter Moogk
14
 * 20060227   124392 rsinha@ca.ibm.com - Rupam Kuehner
14
 *******************************************************************************/
15
 *******************************************************************************/
15
16
16
package org.eclipse.jst.ws.internal.consumption.ui.preferences;
17
package org.eclipse.jst.ws.internal.consumption.ui.preferences;
Lines 30-35 Link Here
30
  
31
  
31
  public void load() 
32
  public void load() 
32
  {
33
  {
34
    //Load the service project types
35
    String[] serviceIds = ProjectTopologyDefaults.getServiceTypes();
36
    StringBuffer serviceSb = new StringBuffer();
37
    for (int i = 0; i < serviceIds.length; i++)
38
    {
39
      if (i != 0)
40
        serviceSb.append(" ");
41
      serviceSb.append(serviceIds[i]);
42
    }
43
    setDefaultStringIfNoDefault(PREFERENCE_SERVICE_TYPES, serviceSb.toString());
44
    
45
    //Load the client project types
33
    String[] ids = ProjectTopologyDefaults.getClientTypes();
46
    String[] ids = ProjectTopologyDefaults.getClientTypes();
34
    StringBuffer sb = new StringBuffer();
47
    StringBuffer sb = new StringBuffer();
35
    for (int i = 0; i < ids.length; i++)
48
    for (int i = 0; i < ids.length; i++)
Lines 42-47 Link Here
42
    setDefault(PREFERENCE_USE_TWO_EARS, ProjectTopologyDefaults.isUseTwoEARs());
55
    setDefault(PREFERENCE_USE_TWO_EARS, ProjectTopologyDefaults.isUseTwoEARs());
43
 }
56
 }
44
57
58
  public void setServiceTypes(String[] ids)
59
  {
60
    StringBuffer sb = new StringBuffer();
61
    for (int i = 0; i < ids.length; i++)
62
    {
63
      if (i != 0)
64
        sb.append(" ");
65
      sb.append(ids[i]);
66
    }
67
    setValue(PREFERENCE_SERVICE_TYPES, sb.toString());
68
  }
69
70
  public String[] getServiceTypes()
71
  {
72
    StringTokenizer st = new StringTokenizer(getValueAsString(PREFERENCE_SERVICE_TYPES));
73
    String[] s = new String[st.countTokens()];
74
    for (int i = 0; i < s.length; i++)
75
      s[i] = st.nextToken();
76
    return s;
77
  }
78
  
79
  public String[] getDefaultServiceTypes()
80
  {
81
    StringTokenizer st = new StringTokenizer(getDefaultString(PREFERENCE_SERVICE_TYPES));
82
    String[] s = new String[st.countTokens()];
83
    for (int i = 0; i < s.length; i++)
84
      s[i] = st.nextToken();
85
    return s;        
86
  }
87
    
45
 public void setClientTypes(String[] ids)
88
 public void setClientTypes(String[] ids)
46
 {
89
 {
47
   StringBuffer sb = new StringBuffer();
90
   StringBuffer sb = new StringBuffer();
Lines 62-67 Link Here
62
     s[i] = st.nextToken();
105
     s[i] = st.nextToken();
63
   return s;
106
   return s;
64
 }
107
 }
108
 
109
 public String[] getDefaultClientTypes()
110
 {
111
   StringTokenizer st = new StringTokenizer(getDefaultString(PREFERENCE_CLIENT_TYPES));
112
   String[] s = new String[st.countTokens()];
113
   for (int i = 0; i < s.length; i++)
114
     s[i] = st.nextToken();
115
   return s;        
116
 } 
65
117
66
 public void setUseTwoEARs(boolean use)
118
 public void setUseTwoEARs(boolean use)
67
 {
119
 {
Lines 74-81 Link Here
74
126
75
 public ProjectTopologyContext copy() {
127
 public ProjectTopologyContext copy() {
76
 	TransientProjectTopologyContext context = new TransientProjectTopologyContext();
128
 	TransientProjectTopologyContext context = new TransientProjectTopologyContext();
129
    context.setServiceTypes(getServiceTypes());
130
    context.setDefaultServiceTypes(getDefaultServiceTypes());
77
	context.setClientTypes(getClientTypes());
131
	context.setClientTypes(getClientTypes());
132
    context.setDefaultClientTypes(getDefaultClientTypes());
78
	context.setUseTwoEARs(isUseTwoEARs());
133
	context.setUseTwoEARs(isUseTwoEARs());
79
	return context;
134
	return context;
80
}
135
}
136
81
}
137
}
(-)src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java (+30 lines)
Lines 11-16 Link Here
11
 * -------- -------- -----------------------------------------------------------
11
 * -------- -------- -----------------------------------------------------------
12
 * 20060131 121071   rsinha@ca.ibm.com - Rupam Kuehner     
12
 * 20060131 121071   rsinha@ca.ibm.com - Rupam Kuehner     
13
 * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
13
 * 20060221   119111 rsinha@ca.ibm.com - Rupam Kuehner
14
 * 20060227   124392 rsinha@ca.ibm.com - Rupam Kuehner
14
 *******************************************************************************/
15
 *******************************************************************************/
15
16
16
package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
17
package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
Lines 58-63 Link Here
58
    return null;        
59
    return null;        
59
  }
60
  }
60
  
61
  
62
  
63
  public static String[] getAllServiceProjectTypes()
64
  {
65
    ArrayList finalTemplateIdList = new ArrayList();
66
    Iterator iter = registry.serviceRuntimes_.values().iterator();
67
68
    //Loop through all the serviceRuntimes
69
    while (iter.hasNext())   
70
    {
71
      ServiceRuntimeDescriptor desc = (ServiceRuntimeDescriptor)iter.next();
72
      
73
      //Get the templates for this service runtime
74
      Set templates = FacetMatchCache.getInstance().getTemplatesForServiceRuntime(desc.getId());
75
      
76
      //Add the template ids to the list if they have not already been added
77
      Iterator itr = templates.iterator();
78
      while (itr.hasNext())
79
      {
80
        IFacetedProjectTemplate template = (IFacetedProjectTemplate)itr.next();
81
        if (!finalTemplateIdList.contains(template.getId()))
82
        {
83
          finalTemplateIdList.add(template.getId());
84
        }
85
      }            
86
    }
87
    
88
    return (String[])finalTemplateIdList.toArray(new String[]{});
89
  }
90
  
61
  public static String[] getAllClientProjectTypes()
91
  public static String[] getAllClientProjectTypes()
62
  {
92
  {
63
    ArrayList finalTemplateIdList = new ArrayList();
93
    ArrayList finalTemplateIdList = new ArrayList();

Return to bug 124392