Lines 13-31
Link Here
|
13 |
* 20060815 104870 makandre@ca.ibm.com - Andrew Mak, enable/disable test page controls base on settings in test facility extension |
13 |
* 20060815 104870 makandre@ca.ibm.com - Andrew Mak, enable/disable test page controls base on settings in test facility extension |
14 |
* 20060815 153903 makandre@ca.ibm.com - Andrew Mak, Browse does not work in generate client test page |
14 |
* 20060815 153903 makandre@ca.ibm.com - Andrew Mak, Browse does not work in generate client test page |
15 |
* 20080325 184761 gilberta@ca.ibm.com - Gilbert Andrews |
15 |
* 20080325 184761 gilberta@ca.ibm.com - Gilbert Andrews |
|
|
16 |
* 20080425 221232 gilberta@ca.ibm.com - Gilbert Andrews |
16 |
*******************************************************************************/ |
17 |
*******************************************************************************/ |
17 |
package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; |
18 |
package org.eclipse.jst.ws.internal.consumption.ui.widgets.test; |
18 |
|
19 |
|
|
|
20 |
import java.util.Set; |
21 |
|
22 |
import org.eclipse.core.resources.IProject; |
19 |
import org.eclipse.core.resources.IResource; |
23 |
import org.eclipse.core.resources.IResource; |
20 |
import org.eclipse.core.runtime.CoreException; |
24 |
import org.eclipse.core.runtime.CoreException; |
21 |
import org.eclipse.core.runtime.IPath; |
25 |
import org.eclipse.core.runtime.IPath; |
22 |
import org.eclipse.core.runtime.IStatus; |
26 |
import org.eclipse.core.runtime.IStatus; |
23 |
import org.eclipse.core.runtime.Path; |
27 |
import org.eclipse.core.runtime.Path; |
24 |
import org.eclipse.core.runtime.Status; |
28 |
import org.eclipse.core.runtime.Status; |
|
|
29 |
import org.eclipse.jem.util.emf.workbench.ProjectUtilities; |
25 |
import org.eclipse.jface.viewers.IStructuredSelection; |
30 |
import org.eclipse.jface.viewers.IStructuredSelection; |
26 |
import org.eclipse.jst.ws.internal.common.ResourceUtils; |
31 |
import org.eclipse.jst.ws.internal.common.ResourceUtils; |
|
|
32 |
import org.eclipse.jst.ws.internal.common.ServerUtils; |
33 |
import org.eclipse.jst.ws.internal.consumption.common.FacetUtils; |
27 |
import org.eclipse.jst.ws.internal.consumption.common.FolderResourceFilter; |
34 |
import org.eclipse.jst.ws.internal.consumption.common.FolderResourceFilter; |
28 |
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; |
35 |
import org.eclipse.jst.ws.internal.consumption.ui.ConsumptionUIMessages; |
|
|
36 |
import org.eclipse.jst.ws.internal.consumption.ui.common.LabelsAndIds; |
37 |
import org.eclipse.jst.ws.internal.consumption.ui.common.ValidationUtils; |
29 |
import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; |
38 |
import org.eclipse.jst.ws.internal.ext.test.WebServiceTestExtension; |
30 |
import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; |
39 |
import org.eclipse.jst.ws.internal.ext.test.WebServiceTestRegistry; |
31 |
import org.eclipse.jst.ws.internal.ui.common.UIUtils; |
40 |
import org.eclipse.jst.ws.internal.ui.common.UIUtils; |
Lines 52-57
Link Here
|
52 |
import org.eclipse.wst.command.internal.env.core.selection.SelectionList; |
61 |
import org.eclipse.wst.command.internal.env.core.selection.SelectionList; |
53 |
import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; |
62 |
import org.eclipse.wst.command.internal.env.ui.widgets.SimpleWidgetDataContributor; |
54 |
import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; |
63 |
import org.eclipse.wst.command.internal.env.ui.widgets.WidgetDataEvents; |
|
|
64 |
import org.eclipse.wst.server.core.IServer; |
65 |
import org.eclipse.wst.server.core.IServerType; |
66 |
import org.eclipse.wst.server.core.ServerCore; |
55 |
|
67 |
|
56 |
|
68 |
|
57 |
public class ClientTestWidget extends SimpleWidgetDataContributor |
69 |
public class ClientTestWidget extends SimpleWidgetDataContributor |
Lines 68-73
Link Here
|
68 |
private Combo testTypeCombo_; |
80 |
private Combo testTypeCombo_; |
69 |
/*CONTEXT_ID PWSM0003 for the Test Type Combo box of the Sample Page*/ |
81 |
/*CONTEXT_ID PWSM0003 for the Test Type Combo box of the Sample Page*/ |
70 |
private String INFOPOP_PWSM_COMBOBOX_TEST = "PWSM0003"; |
82 |
private String INFOPOP_PWSM_COMBOBOX_TEST = "PWSM0003"; |
|
|
83 |
|
84 |
private Combo serverTypeCombo_; |
85 |
/*CONTEXT_ID PWSM0003 for the Test Type Combo box of the Sample Page*/ |
86 |
private String INFOPOP_PWSM_COMBOBOX_SERVER = "PWSM0003"; |
87 |
|
88 |
private Combo serverInstanceTypeCombo_; |
89 |
/*CONTEXT_ID PWSM0003 for the Test Type Combo box of the Sample Page*/ |
90 |
private String INFOPOP_PWSM_COMBOBOX_SERVER_INSTANCE = "PWSM0003"; |
71 |
|
91 |
|
72 |
private Text jspFolderText_; |
92 |
private Text jspFolderText_; |
73 |
/*CONTEXT_ID PWSM0008 for the JSP Folder field of the Sample Page*/ |
93 |
/*CONTEXT_ID PWSM0008 for the JSP Folder field of the Sample Page*/ |
Lines 108-120
Link Here
|
108 |
private FolderResourceFilter folderFilter_ = new FolderResourceFilter(); |
128 |
private FolderResourceFilter folderFilter_ = new FolderResourceFilter(); |
109 |
private IStructuredSelection initialSelection_; |
129 |
private IStructuredSelection initialSelection_; |
110 |
private boolean isTestWidget = false; |
130 |
private boolean isTestWidget = false; |
|
|
131 |
private boolean isPopup = false; |
132 |
|
133 |
private LabelsAndIds serverTypes_; |
134 |
private LabelsAndIds serverInstances_; |
111 |
|
135 |
|
112 |
private IPath webContentPath_; |
136 |
private IPath webContentPath_; |
113 |
private IResource webContent_; |
137 |
private IResource webContent_; |
114 |
|
138 |
|
115 |
public WidgetDataEvents addControls( Composite parent, Listener statusListener ) |
139 |
public WidgetDataEvents addControls( Composite parent, Listener statusListener ) |
116 |
{ |
140 |
{ |
117 |
isTestWidget = true; |
141 |
|
|
|
142 |
|
143 |
isTestWidget = true; |
118 |
UIUtils uiUtils = new UIUtils( pluginId_ ); |
144 |
UIUtils uiUtils = new UIUtils( pluginId_ ); |
119 |
|
145 |
|
120 |
parent.setToolTipText( ConsumptionUIMessages.TOOLTIP_PWSM_PAGE ); |
146 |
parent.setToolTipText( ConsumptionUIMessages.TOOLTIP_PWSM_PAGE ); |
Lines 131-137
Link Here
|
131 |
} |
157 |
} |
132 |
}); |
158 |
}); |
133 |
|
159 |
|
134 |
comboGroup_ = uiUtils.createComposite( parent, 3, 5, 0 ); |
160 |
comboGroup_ = uiUtils.createComposite( parent, 3, 8, 0 ); |
135 |
|
161 |
|
136 |
testTypeCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_TEST_TYPES, |
162 |
testTypeCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_TEST_TYPES, |
137 |
ConsumptionUIMessages.TOOLTIP_PWSM_COMBOBOX_TEST, |
163 |
ConsumptionUIMessages.TOOLTIP_PWSM_COMBOBOX_TEST, |
Lines 145-150
Link Here
|
145 |
} |
171 |
} |
146 |
); |
172 |
); |
147 |
|
173 |
|
|
|
174 |
|
175 |
|
148 |
new Label( comboGroup_, SWT.NONE ); |
176 |
new Label( comboGroup_, SWT.NONE ); |
149 |
|
177 |
|
150 |
projectCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_JSP_PROJECT_NAME, |
178 |
projectCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_JSP_PROJECT_NAME, |
Lines 169-174
Link Here
|
169 |
INFOPOP_PWSM_TEXT_SAMPLE_FOLDER, |
197 |
INFOPOP_PWSM_TEXT_SAMPLE_FOLDER, |
170 |
SWT.SINGLE | SWT.BORDER ); |
198 |
SWT.SINGLE | SWT.BORDER ); |
171 |
|
199 |
|
|
|
200 |
|
201 |
|
172 |
sampleFolderText_.addModifyListener( new ModifyListener() |
202 |
sampleFolderText_.addModifyListener( new ModifyListener() |
173 |
{ |
203 |
{ |
174 |
public void modifyText( ModifyEvent evt ) |
204 |
public void modifyText( ModifyEvent evt ) |
Lines 195-200
Link Here
|
195 |
SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); |
225 |
SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); |
196 |
jspFolderText_.setEnabled( false ); |
226 |
jspFolderText_.setEnabled( false ); |
197 |
|
227 |
|
|
|
228 |
new Label( comboGroup_, SWT.NONE ); |
229 |
|
198 |
Group methodsGroup = uiUtils.createGroup( parent, ConsumptionUIMessages.LABEL_METHODS, |
230 |
Group methodsGroup = uiUtils.createGroup( parent, ConsumptionUIMessages.LABEL_METHODS, |
199 |
ConsumptionUIMessages.TOOLTIP_PWSM_TREE_METHODS, null ); |
231 |
ConsumptionUIMessages.TOOLTIP_PWSM_TREE_METHODS, null ); |
200 |
|
232 |
|
Lines 350-355
Link Here
|
350 |
} |
382 |
} |
351 |
} |
383 |
} |
352 |
|
384 |
|
|
|
385 |
private void handleServerChange() |
386 |
{ |
387 |
int selection = serverTypeCombo_.getSelectionIndex(); |
388 |
serverInstances_.clear(); |
389 |
serverInstanceTypeCombo_.removeAll(); |
390 |
IServer[] servers = org.eclipse.wst.server.core.ServerCore.getServers(); |
391 |
for(int j =0; j<servers.length;j++){ |
392 |
String id = serverTypes_.getId(selection); |
393 |
if(id.equals(servers[j].getServerType().getId())){ |
394 |
serverInstances_.add(servers[j].getId(), servers[j].getName()); |
395 |
serverInstanceTypeCombo_.add(servers[j].getName()); |
396 |
} |
397 |
} |
398 |
serverInstanceTypeCombo_.select(0); |
399 |
|
400 |
} |
401 |
|
402 |
private void handleServerInstance() |
403 |
{ |
404 |
|
405 |
} |
406 |
|
353 |
// Here are the getters and setters for this widget. |
407 |
// Here are the getters and setters for this widget. |
354 |
public void setTestService( Boolean testService ) |
408 |
public void setTestService( Boolean testService ) |
355 |
{ |
409 |
{ |
Lines 399-404
Link Here
|
399 |
return project; |
453 |
return project; |
400 |
} |
454 |
} |
401 |
|
455 |
|
|
|
456 |
public void initServersTypes() |
457 |
{ |
458 |
if(serverTypes_ == null) |
459 |
serverTypes_ = new LabelsAndIds(); |
460 |
IServer[] servers = org.eclipse.wst.server.core.ServerCore.getServers(); |
461 |
IServerType[] serverTypes = ServerCore.getServerTypes(); |
462 |
ValidationUtils vu = new ValidationUtils(); |
463 |
String projectName = projectCombo_.getText(); |
464 |
Set projectFacets = FacetUtils.getFacetsForProject(projectName); |
465 |
for(int i = 0;i<serverTypes.length;i++){ |
466 |
if(vu.doesServerSupportFacets(serverTypes[i].getId(), projectFacets)){ |
467 |
serverTypes_.add(serverTypes[i].getId(), serverTypes[i].getName()); |
468 |
serverTypeCombo_.add( serverTypes[i].getName() ); |
469 |
} |
470 |
serverTypeCombo_.select(0); |
471 |
} |
472 |
if(serverInstances_ == null) |
473 |
serverInstances_ = new LabelsAndIds(); |
474 |
for(int j =0; j<servers.length;j++){ |
475 |
String id = serverTypes_.getId(0); |
476 |
if(id.equals(servers[j].getServerType().getId())){ |
477 |
serverInstances_.add(servers[j].getId(), servers[j].getName()); |
478 |
serverInstanceTypeCombo_.add(servers[j].getName()); |
479 |
} |
480 |
} |
481 |
serverInstanceTypeCombo_.select(0); |
482 |
serverInstanceTypeCombo_.setEnabled(canRunTestClient_); |
483 |
serverTypeCombo_.setEnabled(canRunTestClient_); |
484 |
} |
485 |
|
486 |
|
402 |
public void setSampleProject(String clientProject) |
487 |
public void setSampleProject(String clientProject) |
403 |
{ |
488 |
{ |
404 |
projectCombo_.setItems( new String[]{ extractProjectName(clientProject) } ); |
489 |
projectCombo_.setItems( new String[]{ extractProjectName(clientProject) } ); |
Lines 462-472
Link Here
|
462 |
runTestCheckbox_.setEnabled(false); |
547 |
runTestCheckbox_.setEnabled(false); |
463 |
} |
548 |
} |
464 |
|
549 |
|
|
|
550 |
public void setPopup(boolean popup){ |
551 |
isPopup = popup; |
552 |
if(isPopup){ |
553 |
UIUtils uiUtils = new UIUtils( pluginId_ ); |
554 |
serverTypeCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_SERVERS_LIST, |
555 |
ConsumptionUIMessages.TOOLTIP_PWSM_COMBOBOX_TEST, |
556 |
INFOPOP_PWSM_COMBOBOX_TEST, |
557 |
SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); |
558 |
serverTypeCombo_.addSelectionListener( |
559 |
new SelectionAdapter() { |
560 |
public void widgetSelected(SelectionEvent e) { |
561 |
handleServerChange(); |
562 |
} |
563 |
} |
564 |
); |
565 |
|
566 |
new Label( comboGroup_, SWT.NONE ); |
567 |
|
568 |
|
569 |
serverInstanceTypeCombo_ = uiUtils.createCombo( comboGroup_, ConsumptionUIMessages.LABEL_SERVERS_INSTANCES, |
570 |
ConsumptionUIMessages.TOOLTIP_PWSM_COMBOBOX_TEST, |
571 |
INFOPOP_PWSM_COMBOBOX_TEST, |
572 |
SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY ); |
573 |
serverInstanceTypeCombo_.addSelectionListener( |
574 |
new SelectionAdapter() { |
575 |
public void widgetSelected(SelectionEvent e) { |
576 |
handleServerInstance(); |
577 |
} |
578 |
} |
579 |
); |
580 |
|
581 |
new Label( comboGroup_, SWT.NONE ); |
582 |
initServersTypes(); |
583 |
|
584 |
} |
585 |
} |
586 |
|
465 |
public boolean getCanRunTestClient() |
587 |
public boolean getCanRunTestClient() |
466 |
{ |
588 |
{ |
467 |
return canRunTestClient_; |
589 |
return canRunTestClient_; |
468 |
} |
590 |
} |
469 |
|
591 |
|
|
|
592 |
public String getServerInstanceId(){ |
593 |
int instanceLabel = serverInstanceTypeCombo_.getSelectionIndex(); |
594 |
if(instanceLabel == -1) return null; |
595 |
return serverInstances_.getId(instanceLabel); |
596 |
} |
597 |
|
598 |
public String getExistingServerId(){ |
599 |
int instanceLabel = serverTypeCombo_.getSelectionIndex(); |
600 |
return serverTypes_.getId(instanceLabel); |
601 |
} |
602 |
|
470 |
public BooleanSelection[] getMethods() |
603 |
public BooleanSelection[] getMethods() |
471 |
{ |
604 |
{ |
472 |
TreeItem[] items = methodsTree_.getItems(); |
605 |
TreeItem[] items = methodsTree_.getItems(); |