|
Lines 17-22
Link Here
|
| 17 |
import org.eclipse.jface.layout.GridDataFactory; |
17 |
import org.eclipse.jface.layout.GridDataFactory; |
| 18 |
import org.eclipse.jface.util.IPropertyChangeListener; |
18 |
import org.eclipse.jface.util.IPropertyChangeListener; |
| 19 |
import org.eclipse.jface.util.PropertyChangeEvent; |
19 |
import org.eclipse.jface.util.PropertyChangeEvent; |
|
|
20 |
import org.eclipse.jface.viewers.ComboViewer; |
| 21 |
import org.eclipse.jface.viewers.IStructuredContentProvider; |
| 22 |
import org.eclipse.jface.viewers.IStructuredSelection; |
| 23 |
import org.eclipse.jface.viewers.StructuredSelection; |
| 24 |
import org.eclipse.jface.viewers.Viewer; |
| 20 |
import org.eclipse.mylar.internal.tasks.ui.wizards.AbstractRepositorySettingsPage; |
25 |
import org.eclipse.mylar.internal.tasks.ui.wizards.AbstractRepositorySettingsPage; |
| 21 |
import org.eclipse.mylar.tasks.core.RepositoryTemplate; |
26 |
import org.eclipse.mylar.tasks.core.RepositoryTemplate; |
| 22 |
import org.eclipse.mylar.tasks.core.TaskRepository; |
27 |
import org.eclipse.mylar.tasks.core.TaskRepository; |
|
Lines 26-31
Link Here
|
| 26 |
import org.eclipse.swt.events.SelectionListener; |
31 |
import org.eclipse.swt.events.SelectionListener; |
| 27 |
import org.eclipse.swt.layout.GridData; |
32 |
import org.eclipse.swt.layout.GridData; |
| 28 |
import org.eclipse.swt.layout.GridLayout; |
33 |
import org.eclipse.swt.layout.GridLayout; |
|
|
34 |
import org.eclipse.swt.widgets.Combo; |
| 29 |
import org.eclipse.swt.widgets.Composite; |
35 |
import org.eclipse.swt.widgets.Composite; |
| 30 |
import org.eclipse.swt.widgets.Display; |
36 |
import org.eclipse.swt.widgets.Display; |
| 31 |
import org.eclipse.swt.widgets.Label; |
37 |
import org.eclipse.swt.widgets.Label; |
|
Lines 36-44
Link Here
|
| 36 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
42 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
| 37 |
import org.eclipse.ui.forms.widgets.Section; |
43 |
import org.eclipse.ui.forms.widgets.Section; |
| 38 |
|
44 |
|
|
|
45 |
import static org.eclipse.mylar.internal.tasks.web.Util.*; |
| 46 |
|
| 47 |
|
| 39 |
/** |
48 |
/** |
| 40 |
* Settings page for generic web-based repository connector |
49 |
* Settings page for generic web-based repository connector |
| 41 |
* |
50 |
* |
| 42 |
* @author Eugene Kuleshov |
51 |
* @author Eugene Kuleshov |
| 43 |
*/ |
52 |
*/ |
| 44 |
public class WebRepositorySettingsPage extends AbstractRepositorySettingsPage implements IPropertyChangeListener { |
53 |
public class WebRepositorySettingsPage extends AbstractRepositorySettingsPage implements IPropertyChangeListener { |
|
Lines 48-67
Link Here
|
| 48 |
private static final String DESCRIPTION = "Select a server template example and modify the parameters to match the settings " |
57 |
private static final String DESCRIPTION = "Select a server template example and modify the parameters to match the settings " |
| 49 |
+ "for your project, usually found in the query URL."; |
58 |
+ "for your project, usually found in the query URL."; |
| 50 |
|
59 |
|
|
|
60 |
private ParametersEditor parametersEditor; |
| 61 |
|
| 51 |
private Text taskUrlText; |
62 |
private Text taskUrlText; |
| 52 |
|
63 |
|
| 53 |
private Text newTaskText; |
64 |
private Text newTaskText; |
| 54 |
|
65 |
|
| 55 |
private Text queryUrlText; |
66 |
private Text queryUrlText; |
| 56 |
|
67 |
|
|
|
68 |
private ComboViewer queryRequestMethod; |
| 69 |
|
| 57 |
private Text queryPatternText; |
70 |
private Text queryPatternText; |
| 58 |
|
71 |
|
| 59 |
private ParametersEditor parametersEditor; |
72 |
private Text loginFormUrlText; |
|
|
73 |
|
| 74 |
private Text loginTokenPatternText; |
| 75 |
|
| 76 |
private Text loginRequestUrlText; |
| 77 |
|
| 78 |
private ComboViewer loginRequestMethod; |
| 79 |
|
| 60 |
|
80 |
|
| 61 |
private FormToolkit toolkit = new FormToolkit(Display.getCurrent()); |
81 |
private FormToolkit toolkit = new FormToolkit(Display.getCurrent()); |
| 62 |
|
82 |
|
| 63 |
private Map<String, String> oldProperties; |
83 |
private Map<String, String> oldProperties; |
| 64 |
|
84 |
|
|
|
85 |
|
| 65 |
public WebRepositorySettingsPage(AbstractRepositoryConnectorUi repositoryUi) { |
86 |
public WebRepositorySettingsPage(AbstractRepositoryConnectorUi repositoryUi) { |
| 66 |
super(TITLE, DESCRIPTION, repositoryUi); |
87 |
super(TITLE, DESCRIPTION, repositoryUi); |
| 67 |
} |
88 |
} |
|
Lines 79-97
Link Here
|
| 79 |
RepositoryTemplate template = connector.getTemplate(text); |
100 |
RepositoryTemplate template = connector.getTemplate(text); |
| 80 |
if (template != null) { |
101 |
if (template != null) { |
| 81 |
repositoryLabelEditor.setStringValue(template.label); |
102 |
repositoryLabelEditor.setStringValue(template.label); |
| 82 |
setUrl(template.repositoryUrl); |
103 |
setUrl(nvl(template.repositoryUrl)); |
| 83 |
taskUrlText.setText(template.taskPrefixUrl); |
104 |
|
| 84 |
newTaskText.setText(template.newTaskUrl); |
105 |
taskUrlText.setText(nvl(template.taskPrefixUrl)); |
| 85 |
queryUrlText.setText(template.taskQueryUrl); |
106 |
newTaskText.setText(nvl(template.newTaskUrl)); |
| 86 |
queryPatternText.setText(template.getAttribute(WebRepositoryConnector.PROPERTY_QUERY_REGEXP)); |
107 |
|
|
|
108 |
queryUrlText.setText(nvl(template.taskQueryUrl)); |
| 109 |
selectMethod(queryRequestMethod, // |
| 110 |
template.getAttribute(WebRepositoryConnector.PROPERTY_QUERY_METHOD)); |
| 111 |
queryPatternText.setText(nvl(template.getAttribute(WebRepositoryConnector.PROPERTY_QUERY_REGEXP))); |
| 112 |
|
| 113 |
loginRequestUrlText.setText(nvl(template.getAttribute(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_URL))); |
| 114 |
selectMethod(loginRequestMethod, // |
| 115 |
template.getAttribute(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_METHOD)); |
| 116 |
loginFormUrlText |
| 117 |
.setText(nvl(template.getAttribute(WebRepositoryConnector.PROPERTY_LOGIN_FORM_URL))); |
| 118 |
loginTokenPatternText.setText(nvl(template |
| 119 |
.getAttribute(WebRepositoryConnector.PROPERTY_LOGIN_TOKEN_REGEXP))); |
| 87 |
|
120 |
|
| 88 |
parametersEditor.removeAll(); |
121 |
parametersEditor.removeAll(); |
| 89 |
|
122 |
|
| 90 |
for (Map.Entry<String, String> entry : template.getAttributes().entrySet()) { |
123 |
for (Map.Entry<String, String> entry : template.getAttributes().entrySet()) { |
| 91 |
String key = entry.getKey(); |
124 |
String key = entry.getKey(); |
| 92 |
if (key.startsWith(WebRepositoryConnector.PARAM_PREFIX)) { |
125 |
if (key.startsWith(WebRepositoryConnector.PARAM_PREFIX)) { |
| 93 |
parametersEditor.add(key.substring(WebRepositoryConnector.PARAM_PREFIX.length()), entry |
126 |
parametersEditor.add(key.substring(WebRepositoryConnector.PARAM_PREFIX.length()), // |
| 94 |
.getValue()); |
127 |
entry.getValue()); |
| 95 |
} |
128 |
} |
| 96 |
} |
129 |
} |
| 97 |
|
130 |
|
|
Lines 107-131
Link Here
|
| 107 |
}); |
140 |
}); |
| 108 |
|
141 |
|
| 109 |
Composite editor = getParameterEditor(parent); |
142 |
Composite editor = getParameterEditor(parent); |
| 110 |
GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 240).grab(true, true).span(2, 1).applyTo(editor); |
143 |
// GridDataFactory.fillDefaults().hint(SWT.DEFAULT, 240).grab(true, true).span(2, 1).applyTo(editor); |
| 111 |
|
144 |
GridDataFactory.fillDefaults().hint(200, SWT.DEFAULT).span(2, SWT.DEFAULT).applyTo(editor); |
|
|
145 |
|
| 112 |
if (repository != null) { |
146 |
if (repository != null) { |
| 113 |
taskUrlText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_TASK_URL)); |
147 |
taskUrlText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_TASK_URL)); |
| 114 |
newTaskText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_TASK_CREATION_URL)); |
148 |
newTaskText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_TASK_CREATION_URL)); |
|
|
149 |
|
| 150 |
selectMethod(queryRequestMethod, getTextProperty(WebRepositoryConnector.PROPERTY_QUERY_METHOD)); |
| 115 |
queryUrlText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_QUERY_URL)); |
151 |
queryUrlText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_QUERY_URL)); |
| 116 |
queryPatternText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_QUERY_REGEXP)); |
152 |
queryPatternText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_QUERY_REGEXP)); |
| 117 |
|
153 |
|
|
|
154 |
loginFormUrlText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_LOGIN_FORM_URL)); |
| 155 |
loginTokenPatternText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_LOGIN_TOKEN_REGEXP)); |
| 156 |
|
| 157 |
selectMethod(loginRequestMethod, getTextProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_METHOD)); |
| 158 |
loginRequestUrlText.setText(getTextProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_URL)); |
| 159 |
|
| 118 |
oldProperties = repository.getProperties(); |
160 |
oldProperties = repository.getProperties(); |
| 119 |
parametersEditor.addParams(oldProperties, new LinkedHashMap<String, String>()); |
161 |
parametersEditor.addParams(oldProperties, new LinkedHashMap<String, String>()); |
| 120 |
} |
162 |
} |
| 121 |
} |
163 |
} |
| 122 |
|
164 |
|
| 123 |
private String getTextProperty(String name) { |
165 |
private void selectMethod(ComboViewer viewer, String method) { |
| 124 |
String value = repository.getProperty(name); |
166 |
if(!isPresent(method)) { |
| 125 |
if (value == null) { |
167 |
method = WebRepositoryConnector.REQUEST_GET; |
| 126 |
return ""; |
|
|
| 127 |
} |
168 |
} |
| 128 |
return value; |
169 |
viewer.setSelection(new StructuredSelection(new Object[] {method}), true); |
|
|
170 |
} |
| 171 |
|
| 172 |
private String getTextProperty(String name) { |
| 173 |
return nvl(repository.getProperty(name)); |
| 129 |
} |
174 |
} |
| 130 |
|
175 |
|
| 131 |
protected boolean isValidUrl(String name) { |
176 |
protected boolean isValidUrl(String name) { |
|
Lines 153-162
Link Here
|
| 153 |
gridData_1.minimumHeight = 80; |
198 |
gridData_1.minimumHeight = 80; |
| 154 |
parametersEditor.setLayoutData(gridData_1); |
199 |
parametersEditor.setLayoutData(gridData_1); |
| 155 |
|
200 |
|
|
|
201 |
createAdvancedComposite(parent, composite); |
| 202 |
|
| 203 |
return composite; |
| 204 |
} |
| 205 |
|
| 206 |
private void createAdvancedComposite(Composite parent, final Composite composite) { |
| 156 |
ExpandableComposite expComposite = toolkit.createExpandableComposite(composite, Section.COMPACT |
207 |
ExpandableComposite expComposite = toolkit.createExpandableComposite(composite, Section.COMPACT |
| 157 |
| Section.TWISTIE | Section.TITLE_BAR); |
208 |
| Section.TWISTIE | Section.TITLE_BAR); |
| 158 |
expComposite.clientVerticalSpacing = 0; |
209 |
expComposite.clientVerticalSpacing = 0; |
| 159 |
GridData gridData_2 = new GridData(SWT.FILL, SWT.FILL, true, false); |
210 |
GridData gridData_2 = new GridData(SWT.FILL, SWT.TOP, true, false); |
| 160 |
gridData_2.horizontalIndent = -5; |
211 |
gridData_2.horizontalIndent = -5; |
| 161 |
expComposite.setLayoutData(gridData_2); |
212 |
expComposite.setLayoutData(gridData_2); |
| 162 |
expComposite.setFont(parent.getFont()); |
213 |
expComposite.setFont(parent.getFont()); |
|
Lines 164-177
Link Here
|
| 164 |
expComposite.setText("Advanced &Configuration"); |
215 |
expComposite.setText("Advanced &Configuration"); |
| 165 |
expComposite.addExpansionListener(new ExpansionAdapter() { |
216 |
expComposite.addExpansionListener(new ExpansionAdapter() { |
| 166 |
public void expansionStateChanged(ExpansionEvent e) { |
217 |
public void expansionStateChanged(ExpansionEvent e) { |
| 167 |
composite.layout(); |
218 |
getControl().getShell().pack(); |
| 168 |
} |
219 |
} |
| 169 |
}); |
220 |
}); |
| 170 |
toolkit.paintBordersFor(expComposite); |
221 |
toolkit.paintBordersFor(expComposite); |
| 171 |
|
222 |
|
| 172 |
Composite composite2 = toolkit.createComposite(expComposite, SWT.BORDER); |
223 |
Composite composite2 = toolkit.createComposite(expComposite, SWT.BORDER); |
| 173 |
GridLayout gridLayout2 = new GridLayout(); |
224 |
GridLayout gridLayout2 = new GridLayout(); |
| 174 |
gridLayout2.numColumns = 2; |
225 |
gridLayout2.numColumns = 3; |
| 175 |
gridLayout2.verticalSpacing = 0; |
226 |
gridLayout2.verticalSpacing = 0; |
| 176 |
composite2.setLayout(gridLayout2); |
227 |
composite2.setLayout(gridLayout2); |
| 177 |
expComposite.setClient(composite2); |
228 |
expComposite.setClient(composite2); |
|
Lines 180-208
Link Here
|
| 180 |
taskUrlLabel.setLayoutData(new GridData()); |
231 |
taskUrlLabel.setLayoutData(new GridData()); |
| 181 |
|
232 |
|
| 182 |
taskUrlText = new Text(composite2, SWT.BORDER); |
233 |
taskUrlText = new Text(composite2, SWT.BORDER); |
| 183 |
taskUrlText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
234 |
taskUrlText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); |
| 184 |
|
235 |
|
| 185 |
Label newTaskLabel = toolkit.createLabel(composite2, "&New Task URL:", SWT.NONE); |
236 |
Label newTaskLabel = toolkit.createLabel(composite2, "&New Task URL:", SWT.NONE); |
| 186 |
newTaskLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); |
237 |
newTaskLabel.setLayoutData(new GridData()); |
| 187 |
|
238 |
|
| 188 |
newTaskText = new Text(composite2, SWT.BORDER); |
239 |
newTaskText = new Text(composite2, SWT.BORDER); |
| 189 |
newTaskText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
240 |
newTaskText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); |
|
|
241 |
|
| 242 |
final Label separatorLabel2 = new Label(composite2, SWT.HORIZONTAL | SWT.SEPARATOR); |
| 243 |
final GridData gridData_4 = new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1); |
| 244 |
gridData_4.verticalIndent = 5; |
| 245 |
gridData_4.heightHint = 5; |
| 246 |
separatorLabel2.setLayoutData(gridData_4); |
| 247 |
toolkit.adapt(separatorLabel2, true, true); |
| 190 |
|
248 |
|
| 191 |
Label queryUrlLabel = toolkit.createLabel(composite2, "&Query URL:", SWT.NONE); |
249 |
Label queryUrlLabel = toolkit.createLabel(composite2, "&Query Request URL:", SWT.NONE); |
| 192 |
queryUrlLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); |
250 |
queryUrlLabel.setLayoutData(new GridData()); |
| 193 |
|
251 |
|
| 194 |
queryUrlText = new Text(composite2, SWT.BORDER); |
252 |
queryUrlText = new Text(composite2, SWT.BORDER); |
| 195 |
queryUrlText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); |
253 |
queryUrlText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
|
|
254 |
|
| 255 |
queryRequestMethod = new ComboViewer(composite2, SWT.BORDER | SWT.READ_ONLY); |
| 256 |
queryRequestMethod.setContentProvider(new MethodTypeContentProvider()); |
| 257 |
queryRequestMethod.setInput(""); |
| 258 |
{ |
| 259 |
Combo combo = queryRequestMethod.getCombo(); |
| 260 |
toolkit.adapt(combo, true, true); |
| 261 |
combo.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); |
| 262 |
} |
| 196 |
|
263 |
|
| 197 |
Label queryPatternLabel = toolkit.createLabel(composite2, "Query &Pattern:", SWT.NONE); |
264 |
Label queryPatternLabel = toolkit.createLabel(composite2, "Query &Pattern:", SWT.NONE); |
| 198 |
queryPatternLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, true)); |
265 |
queryPatternLabel.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true)); |
| 199 |
|
266 |
|
| 200 |
queryPatternText = new Text(composite2, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.WRAP); |
267 |
queryPatternText = new Text(composite2, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.WRAP); |
| 201 |
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); |
268 |
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); |
|
|
269 |
gridData.widthHint = 200; |
| 202 |
gridData.heightHint = 40; |
270 |
gridData.heightHint = 40; |
| 203 |
queryPatternText.setLayoutData(gridData); |
271 |
queryPatternText.setLayoutData(gridData); |
| 204 |
|
272 |
|
| 205 |
return composite; |
273 |
final Label separatorLabel1 = new Label(composite2, SWT.HORIZONTAL | SWT.SEPARATOR); |
|
|
274 |
final GridData gridData_3 = new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1); |
| 275 |
gridData_3.heightHint = 5; |
| 276 |
gridData_3.verticalIndent = 5; |
| 277 |
separatorLabel1.setLayoutData(gridData_3); |
| 278 |
toolkit.adapt(separatorLabel1, true, true); |
| 279 |
|
| 280 |
final Label loginrequestUrlLabel = new Label(composite2, SWT.NONE); |
| 281 |
loginrequestUrlLabel.setLayoutData(new GridData()); |
| 282 |
toolkit.adapt(loginrequestUrlLabel, true, true); |
| 283 |
loginrequestUrlLabel.setText("Login &Request URL:"); |
| 284 |
|
| 285 |
loginRequestUrlText = new Text(composite2, SWT.BORDER); |
| 286 |
toolkit.adapt(loginRequestUrlText, true, true); |
| 287 |
loginRequestUrlText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); |
| 288 |
|
| 289 |
loginRequestMethod = new ComboViewer(composite2, SWT.BORDER | SWT.READ_ONLY); |
| 290 |
loginRequestMethod.setContentProvider(new MethodTypeContentProvider()); |
| 291 |
loginRequestMethod.setInput(""); |
| 292 |
{ |
| 293 |
Combo combo = loginRequestMethod.getCombo(); |
| 294 |
toolkit.adapt(combo, true, true); |
| 295 |
combo.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); |
| 296 |
} |
| 297 |
|
| 298 |
Label loginPageLabel = toolkit.createLabel(composite2, "Login &Form URL:", SWT.NONE); |
| 299 |
loginPageLabel.setLayoutData(new GridData()); |
| 300 |
|
| 301 |
loginFormUrlText = new Text(composite2, SWT.BORDER); |
| 302 |
loginFormUrlText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); |
| 303 |
|
| 304 |
Label loginTokenLabel = toolkit.createLabel(composite2, "Login &Token Pattern:", SWT.NONE); |
| 305 |
loginTokenLabel.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true)); |
| 306 |
|
| 307 |
loginTokenPatternText = new Text(composite2, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.WRAP); |
| 308 |
final GridData gridData_1 = new GridData(SWT.FILL, SWT.FILL, false, true, 2, 1); |
| 309 |
gridData_1.widthHint = 200; |
| 310 |
gridData_1.heightHint = 30; |
| 311 |
loginTokenPatternText.setLayoutData(gridData_1); |
| 312 |
|
| 206 |
} |
313 |
} |
| 207 |
|
314 |
|
| 208 |
public void propertyChange(PropertyChangeEvent event) { |
315 |
public void propertyChange(PropertyChangeEvent event) { |
|
Lines 216-223
Link Here
|
| 216 |
public void updateProperties(TaskRepository repository) { |
323 |
public void updateProperties(TaskRepository repository) { |
| 217 |
repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_URL, taskUrlText.getText()); |
324 |
repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_URL, taskUrlText.getText()); |
| 218 |
repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_CREATION_URL, newTaskText.getText()); |
325 |
repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_CREATION_URL, newTaskText.getText()); |
|
|
326 |
|
| 219 |
repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_URL, queryUrlText.getText()); |
327 |
repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_URL, queryUrlText.getText()); |
| 220 |
repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_REGEXP, queryPatternText.getText()); |
328 |
repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_REGEXP, queryPatternText.getText()); |
|
|
329 |
repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_METHOD, getSelection(queryRequestMethod)); |
| 330 |
|
| 331 |
String loginRequestUrl = loginRequestUrlText.getText(); |
| 332 |
repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_URL, loginRequestUrl); |
| 333 |
if(loginRequestUrl.length()>0) { |
| 334 |
repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_METHOD, getSelection(loginRequestMethod)); |
| 335 |
} else { |
| 336 |
repository.removeProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_METHOD); |
| 337 |
} |
| 338 |
repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_FORM_URL, loginFormUrlText.getText()); |
| 339 |
repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_TOKEN_REGEXP, loginTokenPatternText.getText()); |
| 221 |
|
340 |
|
| 222 |
if (oldProperties != null) { |
341 |
if (oldProperties != null) { |
| 223 |
for (Map.Entry<String, String> e : oldProperties.entrySet()) { |
342 |
for (Map.Entry<String, String> e : oldProperties.entrySet()) { |
|
Lines 233-236
Link Here
|
| 233 |
} |
352 |
} |
| 234 |
} |
353 |
} |
| 235 |
|
354 |
|
|
|
355 |
private String getSelection(ComboViewer viewer) { |
| 356 |
return (String) ((IStructuredSelection) viewer.getSelection()).getFirstElement(); |
| 357 |
} |
| 358 |
|
| 359 |
|
| 360 |
private static class MethodTypeContentProvider implements IStructuredContentProvider { |
| 361 |
|
| 362 |
private static final Object[] ELEMENTS = new Object[] { WebRepositoryConnector.REQUEST_GET, |
| 363 |
WebRepositoryConnector.REQUEST_POST }; |
| 364 |
|
| 365 |
public Object[] getElements(Object inputElement) { |
| 366 |
return ELEMENTS; |
| 367 |
} |
| 368 |
|
| 369 |
public void dispose() { |
| 370 |
} |
| 371 |
|
| 372 |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
| 373 |
} |
| 374 |
|
| 375 |
} |
| 376 |
|
| 236 |
} |
377 |
} |