blob: d0ab4aa0af36a8b4c2cf585a5e68910295ffe8a7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
/*******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jst.ws.internal.creation.ui.preferences;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jst.ws.internal.context.ScenarioContext;
import org.eclipse.jst.ws.internal.creation.ui.widgets.ServerWizardWidget;
import org.eclipse.jst.ws.internal.data.TypeRuntimeServer;
import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
import org.eclipse.jst.ws.internal.ui.common.UIUtils;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
/**
*
*/
public class ScenarioDefaultsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
{
private ServerWizardWidget serverWidget_ = null;
public void init(IWorkbench workbench) { }
/* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents(Composite parent)
{
UIUtils utils = new UIUtils(null, null);
Composite page = utils.createComposite( parent, 1 );
serverWidget_ = new ServerWizardWidget( false );
serverWidget_.addControls( page, new Listener()
{
public void handleEvent( Event evt ){}
} );
initializeValues();
return page;
}
private void initializeValues()
{
ScenarioContext context = WebServicePlugin.getInstance().getScenarioContext();
// Set values from context.
TypeRuntimeServer serverIds = new TypeRuntimeServer();
TypeRuntimeServer clientIds = new TypeRuntimeServer();
serverIds.setTypeId( context.getWebServiceType() );
clientIds.setTypeId( context.getClientWebServiceType() );
serverWidget_.setServiceTypeRuntimeServer( serverIds );
serverWidget_.setClientTypeRuntimeServer( clientIds );
serverWidget_.setGenerateProxy( new Boolean(context.getGenerateProxy()) );
serverWidget_.setPublishService( new Boolean(context.getLaunchWebServiceExplorer()) );
serverWidget_.setStartService( new Boolean(context.getStartWebService()) );
serverWidget_.setTestService( new Boolean(context.getTestWebService()) );
serverWidget_.setMonitorService(new Boolean(context.getMonitorWebService()));
serverWidget_.internalize();
}
/**
* Does anything necessary because the default button has been pressed.
*/
protected void performDefaults()
{
super.performDefaults();
setToDefaults();
}
private void setToDefaults()
{
ScenarioContext context = WebServicePlugin.getInstance().getScenarioContext();
// Set values from context.
TypeRuntimeServer serverIds = new TypeRuntimeServer();
TypeRuntimeServer clientIds = new TypeRuntimeServer();
serverIds.setTypeId( context.getWebServiceTypeDefault() );
clientIds.setTypeId( context.getClientWebServiceTypeDefault() );
serverWidget_.setServiceTypeRuntimeServer( serverIds );
serverWidget_.setClientTypeRuntimeServer( clientIds );
serverWidget_.setGenerateProxy( new Boolean(context.getGenerateProxyDefault()) );
serverWidget_.setPublishService( new Boolean(context.getLaunchWebServiceExplorerDefault()) );
serverWidget_.setStartService( new Boolean(context.getStartWebServiceDefault()) );
serverWidget_.setTestService( new Boolean(context.getTestWebServiceDefault()) );
serverWidget_.setMonitorService(new Boolean(context.getMonitorWebServiceDefault()));
serverWidget_.internalize();
}
/**
* Do anything necessary because the OK button has been pressed.
* @return whether it is okay to close the preference page
*/
public boolean performOk()
{
storeValues();
return true;
}
private void storeValues()
{
ScenarioContext context = WebServicePlugin.getInstance().getScenarioContext();
TypeRuntimeServer serverIds = serverWidget_.getServiceTypeRuntimeServer();
TypeRuntimeServer clientIds = serverWidget_.getClientTypeRuntimeServer();
context.setWebServiceType( serverIds.getTypeId() );
context.setClientWebServiceType( clientIds.getTypeId() );
context.setGenerateProxy( serverWidget_.getGenerateProxy().booleanValue() );
context.setLaunchWebServiceExplorer( serverWidget_.getPublishService().booleanValue() );
context.setStartWebService( serverWidget_.getStartService().booleanValue() );
context.setTestWebService( serverWidget_.getTestService().booleanValue() );
context.setMonitorWebService(serverWidget_.getMonitorService().booleanValue());
}
protected void performApply()
{
performOk();
}
}
|