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 200634 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/jira/ui/wizards/JiraRepositorySettingsPage.java (-29 / +36 lines)
Lines 78-84 Link Here
78
		if (repository != null) {
78
		if (repository != null) {
79
			this.characterEncodingValidated = JiraUtils.getCharacterEncodingValidated(repository);
79
			this.characterEncodingValidated = JiraUtils.getCharacterEncodingValidated(repository);
80
		}
80
		}
81
		
81
82
		serverUrlCombo.addSelectionListener(new SelectionAdapter() {
82
		serverUrlCombo.addSelectionListener(new SelectionAdapter() {
83
			@Override
83
			@Override
84
			public void widgetSelected(SelectionEvent e) {
84
			public void widgetSelected(SelectionEvent e) {
Lines 124-132 Link Here
124
124
125
	@Override
125
	@Override
126
	public void updateProperties(TaskRepository repository) {
126
	public void updateProperties(TaskRepository repository) {
127
		JiraUtils.setCompression(repository, compressionButton.getSelection());
127
		if (needsAdvanced()) {
128
		if (characterEncodingValidated) {
128
			JiraUtils.setCompression(repository, compressionButton.getSelection());
129
			JiraUtils.setCharacterEncodingValidated(repository, true);
129
			if (characterEncodingValidated) {
130
				JiraUtils.setCharacterEncodingValidated(repository, true);
131
			}
130
		}
132
		}
131
	}
133
	}
132
134
Lines 143-149 Link Here
143
				if (serverInfo.getWebBaseUrl() != null) {
145
				if (serverInfo.getWebBaseUrl() != null) {
144
					urls.add(serverInfo.getWebBaseUrl());
146
					urls.add(serverInfo.getWebBaseUrl());
145
				}
147
				}
146
				
148
147
				UrlSelectionDialog dialog = new UrlSelectionDialog(getShell(), urls.toArray(new String[0]));
149
				UrlSelectionDialog dialog = new UrlSelectionDialog(getShell(), urls.toArray(new String[0]));
148
				dialog.setSelectedUrl(serverInfo.getBaseUrl());
150
				dialog.setSelectedUrl(serverInfo.getBaseUrl());
149
				int result = dialog.open();
151
				int result = dialog.open();
Lines 151-174 Link Here
151
					setUrl(dialog.getSelectedUrl());
153
					setUrl(dialog.getSelectedUrl());
152
				}
154
				}
153
			}
155
			}
154
			
156
155
			if (serverInfo.getCharacterEncoding() != null) {
157
			if (serverInfo.getCharacterEncoding() != null) {
156
				setEncoding(serverInfo.getCharacterEncoding());
158
				setEncoding(serverInfo.getCharacterEncoding());
157
			} else {
159
			} else {
158
				setEncoding(TaskRepository.DEFAULT_CHARACTER_ENCODING);
160
				setEncoding(TaskRepository.DEFAULT_CHARACTER_ENCODING);
159
				
161
160
				jiraValidator.setStatus(new Status(IStatus.WARNING, JiraUiPlugin.PLUGIN_ID, IStatus.OK,
162
				jiraValidator.setStatus(new Status(
161
						"Authentication credentials are valid. Note: The character encoding could not be determined, verify 'Additional Settings'.", null));
163
						IStatus.WARNING,
164
						JiraUiPlugin.PLUGIN_ID,
165
						IStatus.OK,
166
						"Authentication credentials are valid. Note: The character encoding could not be determined, verify 'Additional Settings'.",
167
						null));
162
			}
168
			}
163
			
169
164
			if (serverInfo.isInsecureRedirect()) {
170
			if (serverInfo.isInsecureRedirect()) {
165
				jiraValidator.setStatus(new Status(IStatus.WARNING, JiraUiPlugin.PLUGIN_ID, IStatus.OK,
171
				jiraValidator.setStatus(new Status(IStatus.WARNING, JiraUiPlugin.PLUGIN_ID, IStatus.OK,
166
						"Authentication credentials are valid. Note: The server redirected to an insecure location.", null));				
172
						"Authentication credentials are valid. Note: The server redirected to an insecure location.",
173
						null));
167
			}
174
			}
168
			
175
169
			characterEncodingValidated = true;			
176
			characterEncodingValidated = true;
170
		}
177
		}
171
		
178
172
		super.applyValidatorResult(validator);
179
		super.applyValidatorResult(validator);
173
180
174
	}
181
	}
Lines 176-182 Link Here
176
	private class JiraValidator extends Validator {
183
	private class JiraValidator extends Validator {
177
184
178
		final TaskRepository repository;
185
		final TaskRepository repository;
179
		
186
180
		private ServerInfo serverInfo;
187
		private ServerInfo serverInfo;
181
188
182
		public JiraValidator(TaskRepository repository) {
189
		public JiraValidator(TaskRepository repository) {
Lines 186-196 Link Here
186
		public ServerInfo getServerInfo() {
193
		public ServerInfo getServerInfo() {
187
			return serverInfo;
194
			return serverInfo;
188
		}
195
		}
189
		
196
190
		public String getRepositoryUrl() {
197
		public String getRepositoryUrl() {
191
			return repository.getUrl();
198
			return repository.getUrl();
192
		}
199
		}
193
		
200
194
		@Override
201
		@Override
195
		public void run(IProgressMonitor monitor) throws CoreException {
202
		public void run(IProgressMonitor monitor) throws CoreException {
196
			try {
203
			try {
Lines 222-239 Link Here
222
229
223
		protected UrlSelectionDialog(Shell parentShell, String[] locations) {
230
		protected UrlSelectionDialog(Shell parentShell, String[] locations) {
224
			super(parentShell);
231
			super(parentShell);
225
			
232
226
			if (locations == null || locations.length < 2) {
233
			if (locations == null || locations.length < 2) {
227
				throw new IllegalArgumentException();
234
				throw new IllegalArgumentException();
228
			}
235
			}
229
			
236
230
			this.locations = locations;
237
			this.locations = locations;
231
		}
238
		}
232
		
239
233
		@Override
240
		@Override
234
		protected Control createDialogArea(Composite parent) {
241
		protected Control createDialogArea(Composite parent) {
235
			getShell().setText("Select repository location");
242
			getShell().setText("Select repository location");
236
			
243
237
			Composite composite = new Composite(parent, SWT.NONE);
244
			Composite composite = new Composite(parent, SWT.NONE);
238
			GridLayout layout = new GridLayout();
245
			GridLayout layout = new GridLayout();
239
			layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
246
			layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
Lines 246-252 Link Here
246
253
247
			Label label = new Label(composite, SWT.NONE);
254
			Label label = new Label(composite, SWT.NONE);
248
			label.setText("The repository location reported by the server does not match the provided location.");
255
			label.setText("The repository location reported by the server does not match the provided location.");
249
			
256
250
			final List<Button> buttons = new ArrayList<Button>(locations.length);
257
			final List<Button> buttons = new ArrayList<Button>(locations.length);
251
258
252
			if (getSelectedUrl() == null) {
259
			if (getSelectedUrl() == null) {
Lines 266-272 Link Here
266
			keepLocationButton.setData(locations[0]);
273
			keepLocationButton.setData(locations[0]);
267
			keepLocationButton.setSelection(getSelectedUrl().equals(locations[0]));
274
			keepLocationButton.setSelection(getSelectedUrl().equals(locations[0]));
268
			buttons.add(keepLocationButton);
275
			buttons.add(keepLocationButton);
269
			
276
270
			SelectionListener listener = new SelectionListener() {
277
			SelectionListener listener = new SelectionListener() {
271
				public void widgetDefaultSelected(SelectionEvent e) {
278
				public void widgetDefaultSelected(SelectionEvent e) {
272
					widgetSelected(e);
279
					widgetSelected(e);
Lines 279-297 Link Here
279
								button.setSelection(false);
286
								button.setSelection(false);
280
							}
287
							}
281
						}
288
						}
282
						setSelectedUrl((String)e.item.getData());
289
						setSelectedUrl((String) e.item.getData());
283
					}
290
					}
284
				}
291
				}
285
292
286
			};
293
			};
287
			
294
288
			for (Button button : buttons) {
295
			for (Button button : buttons) {
289
				button.addSelectionListener(listener);
296
				button.addSelectionListener(listener);
290
			}
297
			}
291
			
298
292
			return composite;
299
			return composite;
293
		}
300
		}
294
		
301
295
		public void setSelectedUrl(String selectedUrl) {
302
		public void setSelectedUrl(String selectedUrl) {
296
			this.selectedUrl = selectedUrl;
303
			this.selectedUrl = selectedUrl;
297
		}
304
		}
Lines 299-305 Link Here
299
		public String getSelectedUrl() {
306
		public String getSelectedUrl() {
300
			return selectedUrl;
307
			return selectedUrl;
301
		}
308
		}
302
		
309
303
	}
310
	}
304
	
311
305
}
312
}
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java (-14 / +15 lines)
Lines 84-90 Link Here
84
	private String platform = null;
84
	private String platform = null;
85
85
86
	private String os = null;
86
	private String os = null;
87
	
87
88
	private Combo languageSettingCombo;
88
	private Combo languageSettingCombo;
89
89
90
	public BugzillaRepositorySettingsPage(AbstractRepositoryConnectorUi repositoryUi) {
90
	public BugzillaRepositorySettingsPage(AbstractRepositoryConnectorUi repositoryUi) {
Lines 358-382 Link Here
358
358
359
	@Override
359
	@Override
360
	public void updateProperties(TaskRepository repository) {
360
	public void updateProperties(TaskRepository repository) {
361
		repository.setProperty(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN,
361
		if (needsAdvanced()) {
362
				String.valueOf(cleanQAContact.getSelection()));
362
			repository.setProperty(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN,
363
		repository.setProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING,
363
					String.valueOf(cleanQAContact.getSelection()));
364
				languageSettingCombo.getText());
364
			repository.setProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING, languageSettingCombo.getText());
365
		
365
366
//		if (cachedConfigButton.getSelection()) {
366
//		if (cachedConfigButton.getSelection()) {
367
//			repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP, "");
367
//			repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP, "");
368
//		} else {
368
//		} else {
369
//			repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP,
369
//			repository.setProperty(IBugzillaConstants.PROPERTY_CONFIGTIMESTAMP,
370
//					IBugzillaConstants.TIMESTAMP_NOT_AVAILABLE);
370
//					IBugzillaConstants.TIMESTAMP_NOT_AVAILABLE);
371
//		}
371
//		}
372
		if (!autodetectPlatformOS.getSelection()) {
372
			if (!autodetectPlatformOS.getSelection()) {
373
			repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM,
373
				repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM,
374
					String.valueOf(defaultPlatformCombo.getItem(defaultPlatformCombo.getSelectionIndex())));
374
						String.valueOf(defaultPlatformCombo.getItem(defaultPlatformCombo.getSelectionIndex())));
375
			repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_OS,
375
				repository.setProperty(IBugzillaConstants.BUGZILLA_DEF_OS,
376
					String.valueOf(defaultOSCombo.getItem(defaultOSCombo.getSelectionIndex())));
376
						String.valueOf(defaultOSCombo.getItem(defaultOSCombo.getSelectionIndex())));
377
		} else {
377
			} else {
378
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM);
378
				repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM);
379
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS);
379
				repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS);
380
			}
380
		}
381
		}
381
	}
382
	}
382
383
(-)src/org/eclipse/mylyn/internal/web/tasks/WebRepositorySettingsPage.java (-26 / +29 lines)
Lines 203-209 Link Here
203
	}
203
	}
204
204
205
	private void createAdvancedComposite(final Composite composite) {
205
	private void createAdvancedComposite(final Composite composite) {
206
		ExpandableComposite expComposite = toolkit.createExpandableComposite(composite, Section.TITLE_BAR | Section.COMPACT | Section.TWISTIE);
206
		ExpandableComposite expComposite = toolkit.createExpandableComposite(composite, Section.TITLE_BAR
207
				| Section.COMPACT | Section.TWISTIE);
207
		expComposite.clientVerticalSpacing = 0;
208
		expComposite.clientVerticalSpacing = 0;
208
		GridData gridData_2 = new GridData(SWT.FILL, SWT.TOP, true, false);
209
		GridData gridData_2 = new GridData(SWT.FILL, SWT.TOP, true, false);
209
		gridData_2.horizontalIndent = -5;
210
		gridData_2.horizontalIndent = -5;
Lines 326-360 Link Here
326
327
327
	@Override
328
	@Override
328
	public void updateProperties(TaskRepository repository) {
329
	public void updateProperties(TaskRepository repository) {
329
		repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_URL, taskUrlText.getText());
330
		if (needsAdvanced()) {
330
		repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_CREATION_URL, newTaskText.getText());
331
			repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_URL, taskUrlText.getText());
332
			repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_CREATION_URL, newTaskText.getText());
333
334
			repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_URL, queryUrlText.getText());
335
			repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_REGEXP, queryPatternText.getText());
336
			repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_METHOD, getSelection(queryRequestMethod));
337
338
			String loginRequestUrl = loginRequestUrlText.getText();
339
			repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_URL, loginRequestUrl);
340
			if (loginRequestUrl.length() > 0) {
341
				repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_METHOD,
342
						getSelection(loginRequestMethod));
343
			} else {
344
				repository.removeProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_METHOD);
345
			}
346
			repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_FORM_URL, loginFormUrlText.getText());
347
			repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_TOKEN_REGEXP, loginTokenPatternText.getText());
331
348
332
		repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_URL, queryUrlText.getText());
349
			if (oldProperties != null) {
333
		repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_REGEXP, queryPatternText.getText());
350
				for (Map.Entry<String, String> e : oldProperties.entrySet()) {
334
		repository.setProperty(WebRepositoryConnector.PROPERTY_QUERY_METHOD, getSelection(queryRequestMethod));
351
					String key = e.getKey();
335
352
					if (key.startsWith(WebRepositoryConnector.PARAM_PREFIX)) {
336
		String loginRequestUrl = loginRequestUrlText.getText();
353
						repository.removeProperty(key);
337
		repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_URL, loginRequestUrl);
354
					}
338
		if (loginRequestUrl.length() > 0) {
339
			repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_METHOD,
340
					getSelection(loginRequestMethod));
341
		} else {
342
			repository.removeProperty(WebRepositoryConnector.PROPERTY_LOGIN_REQUEST_METHOD);
343
		}
344
		repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_FORM_URL, loginFormUrlText.getText());
345
		repository.setProperty(WebRepositoryConnector.PROPERTY_LOGIN_TOKEN_REGEXP, loginTokenPatternText.getText());
346
347
		if (oldProperties != null) {
348
			for (Map.Entry<String, String> e : oldProperties.entrySet()) {
349
				String key = e.getKey();
350
				if (key.startsWith(WebRepositoryConnector.PARAM_PREFIX)) {
351
					repository.removeProperty(key);
352
				}
355
				}
353
			}
356
			}
354
		}
355
357
356
		for (Map.Entry<String, String> e : parametersEditor.getParameters().entrySet()) {
358
			for (Map.Entry<String, String> e : parametersEditor.getParameters().entrySet()) {
357
			repository.setProperty(e.getKey(), e.getValue());
359
				repository.setProperty(e.getKey(), e.getValue());
360
			}
358
		}
361
		}
359
	}
362
	}
360
363
(-)src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java (+39 lines)
Lines 37-42 Link Here
37
import org.eclipse.jface.wizard.WizardDialog;
37
import org.eclipse.jface.wizard.WizardDialog;
38
import org.eclipse.mylyn.context.core.ContextCorePlugin;
38
import org.eclipse.mylyn.context.core.ContextCorePlugin;
39
import org.eclipse.mylyn.internal.context.core.ContextPreferenceContstants;
39
import org.eclipse.mylyn.internal.context.core.ContextPreferenceContstants;
40
import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
40
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
41
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
41
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
42
import org.eclipse.mylyn.internal.tasks.core.ScheduledTaskContainer;
42
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
43
import org.eclipse.mylyn.internal.tasks.core.TaskActivityManager;
Lines 62-67 Link Here
62
import org.eclipse.mylyn.internal.tasks.ui.util.TaskListWriter;
63
import org.eclipse.mylyn.internal.tasks.ui.util.TaskListWriter;
63
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiExtensionReader;
64
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiExtensionReader;
64
import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesView;
65
import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesView;
66
import org.eclipse.mylyn.internal.tasks.ui.wizards.EditCredentialsWizard;
65
import org.eclipse.mylyn.internal.tasks.ui.wizards.EditRepositoryWizard;
67
import org.eclipse.mylyn.internal.tasks.ui.wizards.EditRepositoryWizard;
66
import org.eclipse.mylyn.monitor.core.StatusHandler;
68
import org.eclipse.mylyn.monitor.core.StatusHandler;
67
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
69
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
Lines 79-84 Link Here
79
import org.eclipse.mylyn.tasks.core.AbstractTask.PriorityLevel;
81
import org.eclipse.mylyn.tasks.core.AbstractTask.PriorityLevel;
80
import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
82
import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
81
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorFactory;
83
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorFactory;
84
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
82
import org.eclipse.mylyn.web.core.WebClientUtil;
85
import org.eclipse.mylyn.web.core.WebClientUtil;
83
import org.eclipse.swt.graphics.Image;
86
import org.eclipse.swt.graphics.Image;
84
import org.eclipse.swt.widgets.Shell;
87
import org.eclipse.swt.widgets.Shell;
Lines 1076-1079 Link Here
1076
		}
1079
		}
1077
	}
1080
	}
1078
1081
1082
	public static void testAndSetMemoryOnlyPassword(TaskRepository repository) throws Exception {
1083
		AbstractRepositoryConnector connector = getRepositoryManager().getRepositoryConnector(
1084
				repository.getConnectorKind());
1085
		boolean userManaged = true;
1086
		if (connector != null) {
1087
			userManaged = connector.isUserManaged();
1088
		}
1089
		if (!repository.isAnonymous() && userManaged && !repository.isOffline()
1090
				&& (!repository.isSavePassword() && repository.getCachedPassword() == null)) {
1091
			credentialsWizards(repository, "Please enter memoronly credentials.");
1092
		}
1093
	}
1094
1095
	private static void credentialsWizards(TaskRepository repository, String message) throws Exception {
1096
		if (AbstractRepositorySettingsPage.getSingle() != null) {
1097
			throw new Exception("AbstractRepositorySettingsPage alredy used");
1098
		}
1099
		try {
1100
			EditCredentialsWizard wizard = new EditCredentialsWizard(repository);
1101
			Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
1102
			if (shell != null && !shell.isDisposed()) {
1103
				WizardDialog dialog = new WizardDialog(shell, wizard);
1104
				dialog.create();
1105
				dialog.setErrorMessage(message);
1106
				dialog.setBlockOnOpen(true);
1107
				if (dialog.open() == Dialog.CANCEL) {
1108
					dialog.close();
1109
					StatusHandler.log("credentialsWizards canceled -> repository set offline "
1110
							+ repository.getProperty(IRepositoryConstants.PROPERTY_LABEL), repository);
1111
					repository.setOffline(true);
1112
				}
1113
			}
1114
		} catch (Exception e) {
1115
			StatusHandler.fail(e, e.getMessage(), true);
1116
		}
1117
	}
1079
}
1118
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java (-3 / +16 lines)
Lines 57-74 Link Here
57
			repository.setVersion(abstractRepositorySettingsPage.getVersion());
57
			repository.setVersion(abstractRepositorySettingsPage.getVersion());
58
			repository.setCharacterEncoding(abstractRepositorySettingsPage.getCharacterEncoding());
58
			repository.setCharacterEncoding(abstractRepositorySettingsPage.getCharacterEncoding());
59
			repository.setAuthenticationCredentials(abstractRepositorySettingsPage.getUserName(),
59
			repository.setAuthenticationCredentials(abstractRepositorySettingsPage.getUserName(),
60
					abstractRepositorySettingsPage.getPassword());
60
					abstractRepositorySettingsPage.getPassword(), abstractRepositorySettingsPage.getSavePassword());
61
			repository.setSavePassword(abstractRepositorySettingsPage.getSavePassword());
62
61
			repository.setRepositoryLabel(abstractRepositorySettingsPage.getRepositoryLabel());
63
			repository.setRepositoryLabel(abstractRepositorySettingsPage.getRepositoryLabel());
62
			repository.setAnonymous(abstractRepositorySettingsPage.isAnonymousAccess());
64
			repository.setAnonymous(abstractRepositorySettingsPage.isAnonymousAccess());
63
			repository.setHttpAuthenticationCredentials(abstractRepositorySettingsPage.getHttpAuthUserId(),
65
			repository.setHttpAuthenticationCredentials(abstractRepositorySettingsPage.getHttpAuthUserId(),
64
					abstractRepositorySettingsPage.getHttpAuthPassword());
66
					abstractRepositorySettingsPage.getHttpAuthPassword(),
67
					abstractRepositorySettingsPage.getSaveHttpPassword());
68
			repository.setSaveHttpPassword(abstractRepositorySettingsPage.getSaveHttpPassword());
65
69
66
			repository.setProperty(TaskRepository.PROXY_USEDEFAULT,
70
			repository.setProperty(TaskRepository.PROXY_USEDEFAULT,
67
					String.valueOf(abstractRepositorySettingsPage.getUseDefaultProxy()));
71
					String.valueOf(abstractRepositorySettingsPage.getUseDefaultProxy()));
68
			repository.setProperty(TaskRepository.PROXY_HOSTNAME, abstractRepositorySettingsPage.getProxyHostname());
72
			repository.setProperty(TaskRepository.PROXY_HOSTNAME, abstractRepositorySettingsPage.getProxyHostname());
69
			repository.setProperty(TaskRepository.PROXY_PORT, abstractRepositorySettingsPage.getProxyPort());
73
			repository.setProperty(TaskRepository.PROXY_PORT, abstractRepositorySettingsPage.getProxyPort());
70
			repository.setProxyAuthenticationCredentials(abstractRepositorySettingsPage.getProxyUserName(),
74
			repository.setProxyAuthenticationCredentials(abstractRepositorySettingsPage.getProxyUserName(),
71
					abstractRepositorySettingsPage.getProxyPassword());
75
					abstractRepositorySettingsPage.getProxyPassword(),
76
					abstractRepositorySettingsPage.getSaveProxyPassword());
77
			repository.setSaveProxyPassword(abstractRepositorySettingsPage.getSaveProxyPassword());
72
78
73
			abstractRepositorySettingsPage.updateProperties(repository);
79
			abstractRepositorySettingsPage.updateProperties(repository);
74
			TasksUiPlugin.getRepositoryManager().notifyRepositorySettingsChanged(repository);
80
			TasksUiPlugin.getRepositoryManager().notifyRepositorySettingsChanged(repository);
Lines 99-102 Link Here
99
	public TaskRepository getRepository() {
105
	public TaskRepository getRepository() {
100
		return repository;
106
		return repository;
101
	}
107
	}
108
109
	@Override
110
	public void dispose() {
111
		// ignore
112
		super.dispose();
113
		abstractRepositorySettingsPage.dispose();
114
	}
102
}
115
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/ScheduledTaskListSynchJob.java (+30 lines)
Lines 18-23 Link Here
18
import org.eclipse.core.runtime.Status;
18
import org.eclipse.core.runtime.Status;
19
import org.eclipse.core.runtime.SubProgressMonitor;
19
import org.eclipse.core.runtime.SubProgressMonitor;
20
import org.eclipse.core.runtime.jobs.Job;
20
import org.eclipse.core.runtime.jobs.Job;
21
import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
22
import org.eclipse.mylyn.monitor.core.StatusHandler;
21
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
23
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
22
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
24
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
23
import org.eclipse.mylyn.tasks.core.TaskList;
25
import org.eclipse.mylyn.tasks.core.TaskList;
Lines 55-60 Link Here
55
		this.taskListManager = taskListManager;
57
		this.taskListManager = taskListManager;
56
		this.setSystem(true);
58
		this.setSystem(true);
57
		this.setPriority(Job.BUILD);
59
		this.setPriority(Job.BUILD);
60
61
		if (repositories == null) {
62
			repositories = TasksUiPlugin.getRepositoryManager().getAllRepositories();
63
		}
64
65
		for (final TaskRepository repository : repositories) {
66
			try {
67
				TasksUiPlugin.testAndSetMemoryOnlyPassword(repository);
68
			} catch (Exception e) {
69
				StatusHandler.fail(e, "credentials for repository "
70
						+ repository.getProperty(IRepositoryConstants.PROPERTY_LABEL)
71
						+ " could not set because Dialog allready in use", true, Status.WARNING);
72
			}
73
		}
58
	}
74
	}
59
75
60
	public ScheduledTaskListSynchJob(TaskListManager taskListManager) {
76
	public ScheduledTaskListSynchJob(TaskListManager taskListManager) {
Lines 62-67 Link Here
62
		this.taskListManager = taskListManager;
78
		this.taskListManager = taskListManager;
63
		this.setPriority(Job.BUILD);
79
		this.setPriority(Job.BUILD);
64
		this.scheduleDelay = -1;
80
		this.scheduleDelay = -1;
81
82
		if (repositories == null) {
83
			repositories = TasksUiPlugin.getRepositoryManager().getAllRepositories();
84
		}
85
86
		for (final TaskRepository repository : repositories) {
87
			try {
88
				TasksUiPlugin.testAndSetMemoryOnlyPassword(repository);
89
			} catch (Exception e) {
90
				StatusHandler.fail(e, "credentials for repository "
91
						+ repository.getProperty(IRepositoryConstants.PROPERTY_LABEL)
92
						+ " could not set because Dialog allready in use", true, Status.WARNING);
93
			}
94
		}
65
	}
95
	}
66
96
67
	@Override
97
	@Override
(-)src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java (-45 / +213 lines)
Lines 24-29 Link Here
24
import org.eclipse.jface.preference.StringFieldEditor;
24
import org.eclipse.jface.preference.StringFieldEditor;
25
import org.eclipse.jface.wizard.WizardPage;
25
import org.eclipse.jface.wizard.WizardPage;
26
import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
26
import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
27
import org.eclipse.mylyn.internal.tasks.ui.TasksUiImages;
27
import org.eclipse.mylyn.monitor.core.StatusHandler;
28
import org.eclipse.mylyn.monitor.core.StatusHandler;
28
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
29
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
29
import org.eclipse.mylyn.tasks.core.TaskRepository;
30
import org.eclipse.mylyn.tasks.core.TaskRepository;
Lines 141-147 Link Here
141
	private boolean needsHttpAuth;
142
	private boolean needsHttpAuth;
142
143
143
	private boolean needsValidation;
144
	private boolean needsValidation;
144
	
145
145
	private boolean needsAdvanced;
146
	private boolean needsAdvanced;
146
147
147
	protected Composite compositeContainer;
148
	protected Composite compositeContainer;
Lines 188-193 Link Here
188
189
189
	private Hyperlink manageAccountHyperlink;
190
	private Hyperlink manageAccountHyperlink;
190
191
192
	private boolean onlyAuthenticationCredentials;
193
194
	protected Button savePasswordButton;
195
196
	protected Button saveHttpPasswordButton;
197
198
	protected Button saveProxyPasswordButton;
199
200
	private static AbstractRepositorySettingsPage single;
201
191
	public AbstractRepositorySettingsPage(String title, String description, AbstractRepositoryConnectorUi repositoryUi) {
202
	public AbstractRepositorySettingsPage(String title, String description, AbstractRepositoryConnectorUi repositoryUi) {
192
		super(title);
203
		super(title);
193
		super.setTitle(title);
204
		super.setTitle(title);
Lines 202-207 Link Here
202
		setNeedsProxy(true);
213
		setNeedsProxy(true);
203
		setNeedsValidation(true);
214
		setNeedsValidation(true);
204
		setNeedsAdvanced(true);
215
		setNeedsAdvanced(true);
216
		setOnlyAuthenticationCredentials(false);
217
		single = this;
205
	}
218
	}
206
219
207
	@Override
220
	@Override
Lines 212-217 Link Here
212
				toolkit.dispose();
225
				toolkit.dispose();
213
			}
226
			}
214
		}
227
		}
228
		single = null;
215
	}
229
	}
216
230
217
	public void createControl(Composite parent) {
231
	public void createControl(Composite parent) {
Lines 254-259 Link Here
254
		FillLayout layout = new FillLayout();
268
		FillLayout layout = new FillLayout();
255
		compositeContainer.setLayout(layout);
269
		compositeContainer.setLayout(layout);
256
270
271
		if (onlyAuthenticationCredentials()) {
272
			Label infoLabel = new Label(compositeContainer, SWT.NONE);
273
			infoLabel.setImage(TasksUiImages.getImage(TasksUiImages.WARNING));
274
			infoLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER));
275
			infoLabel = new Label(compositeContainer, SWT.NONE);
276
			infoLabel.setText("\nIf you Cancel this Dialog this will disable the Repository!\n\n");
277
		}
278
257
		new Label(compositeContainer, SWT.NONE).setText(LABEL_SERVER);
279
		new Label(compositeContainer, SWT.NONE).setText(LABEL_SERVER);
258
		serverUrlCombo = new Combo(compositeContainer, SWT.DROP_DOWN);
280
		serverUrlCombo = new Combo(compositeContainer, SWT.DROP_DOWN);
259
		serverUrlCombo.addModifyListener(new ModifyListener() {
281
		serverUrlCombo.addModifyListener(new ModifyListener() {
Lines 304-309 Link Here
304
		};
326
		};
305
		// repositoryLabelEditor.setErrorMessage("error");
327
		// repositoryLabelEditor.setErrorMessage("error");
306
328
329
		if (onlyAuthenticationCredentials()) {
330
			serverUrlCombo.setEnabled(false);
331
			repositoryLabelEditor.setEnabled(false, compositeContainer);
332
		}
333
307
		if (needsAnonymousLogin()) {
334
		if (needsAnonymousLogin()) {
308
			anonymousButton = new Button(compositeContainer, SWT.CHECK);
335
			anonymousButton = new Button(compositeContainer, SWT.CHECK);
309
			GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(anonymousButton);
336
			GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(anonymousButton);
Lines 354-359 Link Here
354
			}
381
			}
355
		};
382
		};
356
383
384
		savePasswordButton = new Button(compositeContainer, SWT.CHECK);
385
		GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(savePasswordButton);
386
387
		savePasswordButton.setText("Save Password");
388
		savePasswordButton.addSelectionListener(new SelectionAdapter() {
389
			@Override
390
			public void widgetSelected(SelectionEvent e) {
391
				setSavePassword(savePasswordButton.getSelection());
392
				isPageComplete();
393
			}
394
		});
395
357
		if (repository != null) {
396
		if (repository != null) {
358
			try {
397
			try {
359
				String repositoryLabel = repository.getProperty(IRepositoryConstants.PROPERTY_LABEL);
398
				String repositoryLabel = repository.getProperty(IRepositoryConstants.PROPERTY_LABEL);
Lines 378-383 Link Here
378
			}
417
			}
379
		}
418
		}
380
419
420
		if (repository != null) {
421
			savePasswordButton.setSelection(repository.isSavePassword());
422
		} else {
423
			savePasswordButton.setSelection(false);
424
		}
425
381
		// TODO: put this back if we can't get the info from all connectors
426
		// TODO: put this back if we can't get the info from all connectors
382
		// if (needsTimeZone()) {
427
		// if (needsTimeZone()) {
383
		// Label timeZoneLabel = new Label(container, SWT.NONE);
428
		// Label timeZoneLabel = new Label(container, SWT.NONE);
Lines 400-409 Link Here
400
		// }
445
		// }
401
		// }
446
		// }
402
447
403
		if(needsAdvanced() || needsEncoding()){
448
		if (needsAdvanced() || needsEncoding()) {
404
		
449
405
			advancedExpComposite = toolkit.createExpandableComposite(compositeContainer, Section.COMPACT | Section.TWISTIE
450
			advancedExpComposite = toolkit.createExpandableComposite(compositeContainer, Section.COMPACT
406
					| Section.TITLE_BAR);
451
					| Section.TWISTIE | Section.TITLE_BAR);
407
			advancedExpComposite.clientVerticalSpacing = 0;
452
			advancedExpComposite.clientVerticalSpacing = 0;
408
			GridData gridData_2 = new GridData(SWT.FILL, SWT.FILL, true, false);
453
			GridData gridData_2 = new GridData(SWT.FILL, SWT.FILL, true, false);
409
			gridData_2.horizontalIndent = -5;
454
			gridData_2.horizontalIndent = -5;
Lines 417-425 Link Here
417
					getControl().getShell().pack();
462
					getControl().getShell().pack();
418
				}
463
				}
419
			});
464
			});
420
	
465
421
			GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(advancedExpComposite);
466
			GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(advancedExpComposite);
422
	
467
423
			advancedComp = toolkit.createComposite(advancedExpComposite, SWT.NONE);
468
			advancedComp = toolkit.createComposite(advancedExpComposite, SWT.NONE);
424
			GridLayout gridLayout2 = new GridLayout();
469
			GridLayout gridLayout2 = new GridLayout();
425
			gridLayout2.numColumns = 2;
470
			gridLayout2.numColumns = 2;
Lines 427-451 Link Here
427
			advancedComp.setLayout(gridLayout2);
472
			advancedComp.setLayout(gridLayout2);
428
			advancedComp.setBackground(compositeContainer.getBackground());
473
			advancedComp.setBackground(compositeContainer.getBackground());
429
			advancedExpComposite.setClient(advancedComp);
474
			advancedExpComposite.setClient(advancedComp);
430
	
475
431
			createAdditionalControls(advancedComp);
476
			createAdditionalControls(advancedComp);
432
	
477
433
			if (needsEncoding()) {
478
			if (needsEncoding()) {
434
				Label encodingLabel = new Label(advancedComp, SWT.HORIZONTAL);
479
				Label encodingLabel = new Label(advancedComp, SWT.HORIZONTAL);
435
				encodingLabel.setText("Character encoding:");
480
				encodingLabel.setText("Character encoding:");
436
				GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.TOP).applyTo(encodingLabel);
481
				GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.TOP).applyTo(encodingLabel);
437
	
482
438
				Composite encodingContainer = new Composite(advancedComp, SWT.NONE);
483
				Composite encodingContainer = new Composite(advancedComp, SWT.NONE);
439
				GridLayout gridLayout = new GridLayout(2, false);
484
				GridLayout gridLayout = new GridLayout(2, false);
440
				gridLayout.marginWidth = 0;
485
				gridLayout.marginWidth = 0;
441
				gridLayout.marginHeight = 0;
486
				gridLayout.marginHeight = 0;
442
				encodingContainer.setLayout(gridLayout);
487
				encodingContainer.setLayout(gridLayout);
443
	
488
444
				defaultEncoding = new Button(encodingContainer, SWT.RADIO);
489
				defaultEncoding = new Button(encodingContainer, SWT.RADIO);
445
				defaultEncoding.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
490
				defaultEncoding.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
446
				defaultEncoding.setText("Default (" + TaskRepository.DEFAULT_CHARACTER_ENCODING + ")");
491
				defaultEncoding.setText("Default (" + TaskRepository.DEFAULT_CHARACTER_ENCODING + ")");
447
				defaultEncoding.setSelection(true);
492
				defaultEncoding.setSelection(true);
448
	
493
449
				otherEncoding = new Button(encodingContainer, SWT.RADIO);
494
				otherEncoding = new Button(encodingContainer, SWT.RADIO);
450
				otherEncoding.setText("Other:");
495
				otherEncoding.setText("Other:");
451
				otherEncodingCombo = new Combo(encodingContainer, SWT.READ_ONLY);
496
				otherEncodingCombo = new Combo(encodingContainer, SWT.READ_ONLY);
Lines 454-464 Link Here
454
						otherEncodingCombo.add(encoding);
499
						otherEncodingCombo.add(encoding);
455
					}
500
					}
456
				}
501
				}
457
	
502
458
				setDefaultEncoding();
503
				setDefaultEncoding();
459
	
504
460
				otherEncoding.addSelectionListener(new SelectionAdapter() {
505
				otherEncoding.addSelectionListener(new SelectionAdapter() {
461
	
506
462
					@Override
507
					@Override
463
					public void widgetSelected(SelectionEvent e) {
508
					public void widgetSelected(SelectionEvent e) {
464
						if (otherEncoding.getSelection()) {
509
						if (otherEncoding.getSelection()) {
Lines 470-476 Link Here
470
						}
515
						}
471
					}
516
					}
472
				});
517
				});
473
	
518
474
				if (repository != null) {
519
				if (repository != null) {
475
					try {
520
					try {
476
						String repositoryEncoding = repository.getCharacterEncoding();
521
						String repositoryEncoding = repository.getCharacterEncoding();
Lines 555-565 Link Here
555
					httpAuthComp);
600
					httpAuthComp);
556
			((RepositoryStringFieldEditor) httpAuthPasswordEditor).getTextControl().setEchoChar('*');
601
			((RepositoryStringFieldEditor) httpAuthPasswordEditor).getTextControl().setEchoChar('*');
557
602
603
			saveHttpPasswordButton = new Button(httpAuthComp, SWT.CHECK);
604
			GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(saveHttpPasswordButton);
605
606
			saveHttpPasswordButton.setText("Save Http Password");
607
			saveHttpPasswordButton.addSelectionListener(new SelectionAdapter() {
608
				@Override
609
				public void widgetSelected(SelectionEvent e) {
610
					setSaveHttpPassword(saveHttpPasswordButton.getSelection());
611
					isPageComplete();
612
				}
613
			});
614
558
			httpAuthUserNameEditor.setEnabled(httpAuthButton.getSelection(), httpAuthComp);
615
			httpAuthUserNameEditor.setEnabled(httpAuthButton.getSelection(), httpAuthComp);
559
			httpAuthPasswordEditor.setEnabled(httpAuthButton.getSelection(), httpAuthComp);
616
			httpAuthPasswordEditor.setEnabled(httpAuthButton.getSelection(), httpAuthComp);
617
			saveHttpPasswordButton.setEnabled(httpAuthButton.getSelection());
560
618
561
			setHttpAuth(oldHttpAuthPassword != null && oldHttpAuthUserId != null && !oldHttpAuthPassword.equals("")
619
			if (repository != null) {
562
					&& !oldHttpAuthUserId.equals(""));
620
				saveHttpPasswordButton.setSelection(repository.isSaveHttpPassword());
621
			} else {
622
				saveHttpPasswordButton.setSelection(false);
623
			}
624
			setHttpAuth(oldHttpAuthPassword != null && oldHttpAuthUserId != null && !oldHttpAuthUserId.equals(""));
563
625
564
			httpAuthExpComposite.setExpanded(httpAuthButton.getSelection());
626
			httpAuthExpComposite.setExpanded(httpAuthButton.getSelection());
565
		}
627
		}
Lines 640-645 Link Here
640
702
641
		updateHyperlinks();
703
		updateHyperlinks();
642
704
705
		if (onlyAuthenticationCredentials()) {
706
			httpAuthExpComposite.setExpanded(true);
707
			proxyExpComposite.setExpanded(true);
708
		}
709
643
		setControl(compositeContainer);
710
		setControl(compositeContainer);
644
	}
711
	}
645
712
Lines 777-784 Link Here
777
		// httpAuthPasswordEditor).setEnabled(httpAuthButton.getSelection(),
844
		// httpAuthPasswordEditor).setEnabled(httpAuthButton.getSelection(),
778
		// advancedComp);
845
		// advancedComp);
779
846
780
		setProxyAuth(oldProxyUsername != null && oldProxyPassword != null && !oldProxyUsername.equals("")
847
		saveProxyPasswordButton = new Button(proxyAuthComp, SWT.CHECK);
781
				&& !oldProxyPassword.equals(""));
848
		GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(saveProxyPasswordButton);
849
850
		saveProxyPasswordButton.setText("Save Proxy Password");
851
		saveProxyPasswordButton.addSelectionListener(new SelectionAdapter() {
852
			@Override
853
			public void widgetSelected(SelectionEvent e) {
854
				setSaveProxyPassword(saveProxyPasswordButton.getSelection());
855
				isPageComplete();
856
			}
857
		});
858
859
		saveProxyPasswordButton.setEnabled(proxyAuthButton.getSelection());
860
861
		if (repository != null) {
862
			saveProxyPasswordButton.setSelection(repository.isSaveProxyPassword());
863
		} else {
864
			saveProxyPasswordButton.setSelection(false);
865
		}
866
867
		setProxyAuth(oldProxyUsername != null && oldProxyPassword != null && !oldProxyUsername.equals(""));
782
868
783
		setUseDefaultProxy(repository != null ? repository.isDefaultProxyEnabled() : true);
869
		setUseDefaultProxy(repository != null ? repository.isDefaultProxyEnabled() : true);
784
		proxyExpComposite.setExpanded(!systemProxyButton.getSelection());
870
		proxyExpComposite.setExpanded(!systemProxyButton.getSelection());
Lines 819-828 Link Here
819
			oldUsername = repositoryUserNameEditor.getStringValue();
905
			oldUsername = repositoryUserNameEditor.getStringValue();
820
			oldPassword = (repositoryPasswordEditor).getStringValue();
906
			oldPassword = (repositoryPasswordEditor).getStringValue();
821
			repositoryUserNameEditor.setStringValue("");
907
			repositoryUserNameEditor.setStringValue("");
822
			(repositoryPasswordEditor).setStringValue("");
908
			repositoryPasswordEditor.setStringValue("");
823
		} else {
909
		} else {
824
			repositoryUserNameEditor.setStringValue(oldUsername);
910
			repositoryUserNameEditor.setStringValue(oldUsername);
825
			(repositoryPasswordEditor).setStringValue(oldPassword);
911
			repositoryPasswordEditor.setStringValue(oldPassword);
826
		}
912
		}
827
913
828
		repositoryUserNameEditor.setEnabled(!selected, compositeContainer);
914
		repositoryUserNameEditor.setEnabled(!selected, compositeContainer);
Lines 839-853 Link Here
839
		httpAuthButton.setSelection(selected);
925
		httpAuthButton.setSelection(selected);
840
		if (!selected) {
926
		if (!selected) {
841
			oldHttpAuthUserId = httpAuthUserNameEditor.getStringValue();
927
			oldHttpAuthUserId = httpAuthUserNameEditor.getStringValue();
842
			oldHttpAuthPassword = (httpAuthPasswordEditor).getStringValue();
928
			oldHttpAuthPassword = httpAuthPasswordEditor.getStringValue();
843
			httpAuthUserNameEditor.setStringValue(null);
929
			httpAuthUserNameEditor.setStringValue(null);
844
			(httpAuthPasswordEditor).setStringValue(null);
930
			httpAuthPasswordEditor.setStringValue(null);
845
		} else {
931
		} else {
846
			httpAuthUserNameEditor.setStringValue(oldHttpAuthUserId);
932
			httpAuthUserNameEditor.setStringValue(oldHttpAuthUserId);
847
			(httpAuthPasswordEditor).setStringValue(oldHttpAuthPassword);
933
			httpAuthPasswordEditor.setStringValue(oldHttpAuthPassword);
848
		}
934
		}
849
		httpAuthUserNameEditor.setEnabled(selected, httpAuthComp);
935
		httpAuthUserNameEditor.setEnabled(selected, httpAuthComp);
850
		(httpAuthPasswordEditor).setEnabled(selected, httpAuthComp);
936
		httpAuthPasswordEditor.setEnabled(selected, httpAuthComp);
937
		saveHttpPasswordButton.setEnabled(selected);
851
	}
938
	}
852
939
853
	public void setUseDefaultProxy(boolean selected) {
940
	public void setUseDefaultProxy(boolean selected) {
Lines 878-886 Link Here
878
		proxyAuthButton.setEnabled(!systemProxyButton.getSelection());
965
		proxyAuthButton.setEnabled(!systemProxyButton.getSelection());
879
		if (!selected) {
966
		if (!selected) {
880
			oldProxyUsername = proxyUserNameEditor.getStringValue();
967
			oldProxyUsername = proxyUserNameEditor.getStringValue();
881
			oldProxyPassword = (proxyPasswordEditor).getStringValue();
968
			oldProxyPassword = proxyPasswordEditor.getStringValue();
882
			proxyUserNameEditor.setStringValue(null);
969
			proxyUserNameEditor.setStringValue(null);
883
			(proxyPasswordEditor).setStringValue(null);
970
			proxyPasswordEditor.setStringValue(null);
884
		} else {
971
		} else {
885
			proxyUserNameEditor.setStringValue(oldProxyUsername);
972
			proxyUserNameEditor.setStringValue(oldProxyUsername);
886
			proxyPasswordEditor.setStringValue(oldProxyPassword);
973
			proxyPasswordEditor.setStringValue(oldProxyPassword);
Lines 888-893 Link Here
888
975
889
		proxyUserNameEditor.setEnabled(selected && !systemProxyButton.getSelection(), proxyAuthComp);
976
		proxyUserNameEditor.setEnabled(selected && !systemProxyButton.getSelection(), proxyAuthComp);
890
		proxyPasswordEditor.setEnabled(selected && !systemProxyButton.getSelection(), proxyAuthComp);
977
		proxyPasswordEditor.setEnabled(selected && !systemProxyButton.getSelection(), proxyAuthComp);
978
		saveProxyPasswordButton.setEnabled(selected && !systemProxyButton.getSelection());
891
	}
979
	}
892
980
893
	protected abstract void createAdditionalControls(Composite parent);
981
	protected abstract void createAdditionalControls(Composite parent);
Lines 895-901 Link Here
895
	protected abstract boolean isValidUrl(String name);
983
	protected abstract boolean isValidUrl(String name);
896
984
897
	void updateHyperlinks() {
985
	void updateHyperlinks() {
898
		if (getServerUrl() != null && getServerUrl().length() > 0) {
986
		if (!onlyAuthenticationCredentials() && getServerUrl() != null && getServerUrl().length() > 0) {
899
			TaskRepository repository = createTaskRepository();
987
			TaskRepository repository = createTaskRepository();
900
			String accountCreationUrl = TasksUiPlugin.getConnectorUi(connector.getConnectorKind())
988
			String accountCreationUrl = TasksUiPlugin.getConnectorUi(connector.getConnectorKind())
901
					.getAccountCreationUrl(repository);
989
					.getAccountCreationUrl(repository);
Lines 1027-1036 Link Here
1027
	@Override
1115
	@Override
1028
	public boolean isPageComplete() {
1116
	public boolean isPageComplete() {
1029
		String errorMessage = null;
1117
		String errorMessage = null;
1030
		String url = getServerUrl();
1118
		if (!onlyAuthenticationCredentials()) {
1031
		errorMessage = isUniqueUrl(url);
1119
			String url = getServerUrl();
1032
		if (errorMessage == null && !isValidUrl(url)) {
1120
			errorMessage = isUniqueUrl(url);
1033
			errorMessage = "Enter a valid server url";
1121
			if (errorMessage == null && !isValidUrl(url)) {
1122
				errorMessage = "Enter a valid server url";
1123
			}
1034
		}
1124
		}
1035
		if (errorMessage == null) {
1125
		if (errorMessage == null) {
1036
			errorMessage = credentialsComplete();
1126
			errorMessage = credentialsComplete();
Lines 1042-1050 Link Here
1042
1132
1043
	private String credentialsComplete() {
1133
	private String credentialsComplete() {
1044
		if ((needsAnonymousLogin() && !anonymousButton.getSelection())
1134
		if ((needsAnonymousLogin() && !anonymousButton.getSelection())
1045
				&& (repositoryUserNameEditor.getStringValue().trim().equals("") || repositoryPasswordEditor.getStringValue()
1135
				&& (repositoryUserNameEditor.getStringValue().trim().equals("") || (repositoryPasswordEditor.getStringValue()
1046
						.trim()
1136
						.trim().equals(""))) && savePasswordButton.getSelection()) {
1047
						.equals(""))) {
1048
			return "Repository user name and password must not be blank";
1137
			return "Repository user name and password must not be blank";
1049
		}
1138
		}
1050
		return null;
1139
		return null;
Lines 1122-1142 Link Here
1122
		if (needsAnonymousLogin()) {
1211
		if (needsAnonymousLogin()) {
1123
			repository.setAnonymous(anonymousButton.getSelection());
1212
			repository.setAnonymous(anonymousButton.getSelection());
1124
		}
1213
		}
1214
		repository.setSavePassword(savePasswordButton.getSelection());
1125
		// repository.setProperty(TaskRepository.AUTH_HTTP_USERNAME,
1215
		// repository.setProperty(TaskRepository.AUTH_HTTP_USERNAME,
1126
		// getHttpAuthUserId());
1216
		// getHttpAuthUserId());
1127
		// repository.setProperty(TaskRepository.AUTH_HTTP_PASSWORD,
1217
		// repository.setProperty(TaskRepository.AUTH_HTTP_PASSWORD,
1128
		// getHttpAuthPassword());
1218
		// getHttpAuthPassword());
1129
		if (getHttpAuthUserId().length() > 0 && getHttpAuthPassword().length() > 0) {
1219
		if (getHttpAuthUserId().length() > 0) {
1130
			repository.setHttpAuthenticationCredentials(getHttpAuthUserId(), getHttpAuthPassword());
1220
			repository.setHttpAuthenticationCredentials(getHttpAuthUserId(), getHttpAuthPassword(),
1221
					saveHttpPasswordButton.getSelection());
1222
			repository.setSavePassword(saveHttpPasswordButton.getSelection());
1131
		}
1223
		}
1132
1224
1133
		repository.setProperty(TaskRepository.PROXY_USEDEFAULT, String.valueOf(getUseDefaultProxy()));
1225
		repository.setProperty(TaskRepository.PROXY_USEDEFAULT, String.valueOf(getUseDefaultProxy()));
1134
		repository.setProperty(TaskRepository.PROXY_HOSTNAME, getProxyHostname());
1226
		repository.setProperty(TaskRepository.PROXY_HOSTNAME, getProxyHostname());
1135
		repository.setProperty(TaskRepository.PROXY_PORT, getProxyPort());
1227
		repository.setProperty(TaskRepository.PROXY_PORT, getProxyPort());
1136
1228
1137
		if (getProxyUserName().length() > 0 && getProxyPassword().length() > 0) {
1229
		if (getProxyUserName().length() > 0) {
1138
			repository.setProxyAuthenticationCredentials(getProxyUserName(), getProxyPassword());
1230
			repository.setProxyAuthenticationCredentials(getProxyUserName(), getProxyPassword(),
1231
					saveProxyPasswordButton.getSelection());
1139
		}
1232
		}
1233
		repository.setSavePassword(saveProxyPasswordButton.getSelection());
1140
		// repository.setProperty(TaskRepository.PROXY_USERNAME,
1234
		// repository.setProperty(TaskRepository.PROXY_USERNAME,
1141
		// getProxyUsername());
1235
		// getProxyUsername());
1142
1236
Lines 1166-1180 Link Here
1166
		return needsAnonymousLogin;
1260
		return needsAnonymousLogin;
1167
	}
1261
	}
1168
1262
1169
1263
	public boolean needsAdvanced() {
1170
	public boolean needsAdvanced(){
1171
		return needsAdvanced;
1264
		return needsAdvanced;
1172
	}
1265
	}
1173
	
1266
1174
	public void setNeedsEncoding(boolean needsEncoding) {
1267
	public void setNeedsEncoding(boolean needsEncoding) {
1175
		this.needsEncoding = needsEncoding;
1268
		this.needsEncoding = needsEncoding;
1176
	}
1269
	}
1177
	
1270
1178
	public void setNeedsTimeZone(boolean needsTimeZone) {
1271
	public void setNeedsTimeZone(boolean needsTimeZone) {
1179
		this.needsTimeZone = needsTimeZone;
1272
		this.needsTimeZone = needsTimeZone;
1180
	}
1273
	}
Lines 1182-1188 Link Here
1182
	public void setNeedsAdvanced(boolean needsAdvanced) {
1275
	public void setNeedsAdvanced(boolean needsAdvanced) {
1183
		this.needsAdvanced = needsAdvanced;
1276
		this.needsAdvanced = needsAdvanced;
1184
	}
1277
	}
1185
	
1278
1186
	public boolean needsHttpAuth() {
1279
	public boolean needsHttpAuth() {
1187
		return this.needsHttpAuth;
1280
		return this.needsHttpAuth;
1188
	}
1281
	}
Lines 1314-1317 Link Here
1314
1407
1315
	}
1408
	}
1316
1409
1410
	public void setSavePassword(boolean selected) {
1411
1412
		savePasswordButton.setSelection(selected);
1413
1414
		if (selected) {
1415
			repositoryPasswordEditor.setStringValue(oldPassword);
1416
		} else {
1417
			oldPassword = repositoryPasswordEditor.getStringValue();
1418
			repositoryPasswordEditor.setStringValue("");
1419
		}
1420
1421
		repositoryPasswordEditor.setEnabled(selected, compositeContainer);
1422
		if (getWizard() != null) {
1423
			getWizard().getContainer().updateButtons();
1424
		}
1425
	}
1426
1427
	public void setSaveHttpPassword(boolean selected) {
1428
1429
		saveHttpPasswordButton.setSelection(selected);
1430
1431
		if (selected) {
1432
			httpAuthPasswordEditor.setStringValue(oldHttpAuthPassword);
1433
		} else {
1434
			oldHttpAuthPassword = httpAuthPasswordEditor.getStringValue();
1435
			httpAuthPasswordEditor.setStringValue("");
1436
		}
1437
1438
		httpAuthPasswordEditor.setEnabled(selected, compositeContainer);
1439
		if (getWizard() != null) {
1440
			getWizard().getContainer().updateButtons();
1441
		}
1442
	}
1443
1444
	public void setSaveProxyPassword(boolean selected) {
1445
1446
		saveProxyPasswordButton.setSelection(selected);
1447
1448
		if (selected) {
1449
			proxyPasswordEditor.setStringValue(oldHttpAuthPassword);
1450
		} else {
1451
			oldHttpAuthPassword = proxyPasswordEditor.getStringValue();
1452
			proxyPasswordEditor.setStringValue("");
1453
		}
1454
1455
		proxyPasswordEditor.setEnabled(selected, compositeContainer);
1456
		if (getWizard() != null) {
1457
			getWizard().getContainer().updateButtons();
1458
		}
1459
	}
1460
1461
	public boolean onlyAuthenticationCredentials() {
1462
		return onlyAuthenticationCredentials;
1463
	}
1464
1465
	public void setOnlyAuthenticationCredentials(boolean onlyAuthenticationCredentials) {
1466
		this.onlyAuthenticationCredentials = onlyAuthenticationCredentials;
1467
	}
1468
1469
	public Boolean getSavePassword() {
1470
		return savePasswordButton.getSelection();
1471
	}
1472
1473
	public Boolean getSaveProxyPassword() {
1474
		return saveProxyPasswordButton.getSelection();
1475
	}
1476
1477
	public Boolean getSaveHttpPassword() {
1478
		return saveHttpPasswordButton.getSelection();
1479
	}
1480
1481
	public static AbstractRepositorySettingsPage getSingle() {
1482
		return single;
1483
	}
1484
1317
}
1485
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditCredentialsWizard.java (+28 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.tasks.ui.wizards;
10
11
import org.eclipse.mylyn.tasks.core.TaskRepository;
12
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
13
14
public class EditCredentialsWizard extends EditRepositoryWizard {
15
16
	public EditCredentialsWizard(TaskRepository repository) {
17
		super(repository);
18
		AbstractRepositorySettingsPage theSettingsPage = getSettingsPage();
19
		theSettingsPage.setNeedsAnonymousLogin(false);
20
		theSettingsPage.setNeedsEncoding(false);
21
		theSettingsPage.setNeedsTimeZone(false);
22
		theSettingsPage.setNeedsProxy(true);
23
		theSettingsPage.setNeedsHttpAuth(true);
24
		theSettingsPage.setNeedsValidation(false);
25
		theSettingsPage.setNeedsAdvanced(false);
26
		theSettingsPage.setOnlyAuthenticationCredentials(true);
27
	}
28
}
(-)src/org/eclipse/mylyn/tasks/core/TaskRepository.java (-10 / +147 lines)
Lines 85-90 Link Here
85
85
86
	private String cachedUserName;
86
	private String cachedUserName;
87
87
88
	public static final String SAVE_PASSWORD = "org.eclipse.mylyn.tasklist.repositories.save.password";
89
90
	public static final String SAVE_HTTP_PASSWORD = "org.eclipse.mylyn.tasklist.repositories.save.http.password";
91
92
	public static final String SAVE_PROXY_PASSWORD = "org.eclipse.mylyn.tasklist.repositories.save.proxy.password";
93
94
	private boolean isCachedUserPassword;
95
96
	private String cachedUserPassword;
97
98
	private boolean isCachedProxyUserName;
99
100
	private String cachedProxyUserName;
101
102
	private boolean isCachedProxyUserPassword;
103
104
	private String cachedProxyUserPassword;
105
106
	private boolean isCachedHttpUserName;
107
108
	private String cachedHttpUserName;
109
110
	private boolean isCachedHttpUserPassword;
111
112
	private String cachedHttpUserPassword;
113
88
	static {
114
	static {
89
		URL url = null;
115
		URL url = null;
90
		try {
116
		try {
Lines 159-192 Link Here
159
	public String getUserName() {
185
	public String getUserName() {
160
		// NOTE: if anonymous, user name is "" string so we won't go to keyring
186
		// NOTE: if anonymous, user name is "" string so we won't go to keyring
161
		if (!isCachedUserName) {
187
		if (!isCachedUserName) {
162
			cachedUserName = getUserNameFromKeyRing();
188
			cachedUserName = getAuthInfo(AUTH_USERNAME);
163
			isCachedUserName = true;
189
			isCachedUserName = true;
164
		}
190
		}
165
		return cachedUserName;
191
		return cachedUserName;
166
	}
192
	}
167
193
168
	private String getUserNameFromKeyRing() {
169
		return getAuthInfo(AUTH_USERNAME);
170
	}
171
172
	public String getPassword() {
194
	public String getPassword() {
173
		return getAuthInfo(AUTH_PASSWORD);
195
		if (!isCachedUserPassword) {
196
			if (!isSavePassword()) {
197
				cachedUserPassword = "";
198
			} else {
199
				cachedUserPassword = getAuthInfo(AUTH_PASSWORD);
200
				isCachedUserPassword = true;
201
			}
202
		}
203
		return cachedUserPassword;
174
	}
204
	}
175
205
176
	public String getProxyUsername() {
206
	public String getProxyUsername() {
177
		return getAuthInfo(PROXY_USERNAME);
207
		if (!isCachedProxyUserName) {
208
			cachedProxyUserName = getAuthInfo(PROXY_USERNAME);
209
			isCachedProxyUserName = true;
210
		}
211
		return cachedProxyUserName;
178
	}
212
	}
179
213
180
	public String getProxyPassword() {
214
	public String getProxyPassword() {
181
		return getAuthInfo(PROXY_PASSWORD);
215
		if (!isCachedProxyUserPassword) {
216
			if (!isSaveProxyPassword()) {
217
				cachedProxyUserPassword = "";
218
			} else {
219
				cachedProxyUserPassword = getAuthInfo(PROXY_PASSWORD);
220
				isCachedProxyUserPassword = true;
221
			}
222
		}
223
		return cachedProxyUserPassword;
182
	}
224
	}
183
225
184
	public String getHttpUser() {
226
	public String getHttpUser() {
185
		return getAuthInfo(AUTH_HTTP_USERNAME);
227
		if (!isCachedHttpUserName) {
228
			cachedHttpUserName = getAuthInfo(AUTH_HTTP_USERNAME);
229
			isCachedHttpUserName = true;
230
		}
231
		return cachedHttpUserName;
186
	}
232
	}
187
233
188
	public String getHttpPassword() {
234
	public String getHttpPassword() {
189
		return getAuthInfo(AUTH_HTTP_PASSWORD);
235
		if (!isCachedHttpUserPassword) {
236
			if (!isSaveHttpPassword()) {
237
				cachedHttpUserPassword = "";
238
			} else {
239
				cachedHttpUserPassword = getAuthInfo(AUTH_HTTP_PASSWORD);
240
				isCachedHttpUserPassword = true;
241
			}
242
		}
243
		return cachedHttpUserPassword;
190
	}
244
	}
191
245
192
	public void setAuthenticationCredentials(String username, String password) {
246
	public void setAuthenticationCredentials(String username, String password) {
Lines 203-208 Link Here
203
		setCredentials(username, password, AUTH_HTTP_USERNAME, AUTH_HTTP_PASSWORD);
257
		setCredentials(username, password, AUTH_HTTP_USERNAME, AUTH_HTTP_PASSWORD);
204
	}
258
	}
205
259
260
	public void setAuthenticationCredentials(String username, String password, boolean savePassword) {
261
		if (savePassword)
262
			setCredentials(username, password, AUTH_USERNAME, AUTH_PASSWORD);
263
		else
264
			setCredentials(username, "", AUTH_USERNAME, AUTH_PASSWORD);
265
		cachedUserName = username;
266
		isCachedUserName = true;
267
		cachedUserPassword = password;
268
		isCachedUserPassword = true;
269
	}
270
271
	public void setProxyAuthenticationCredentials(String username, String password, boolean savePassword) {
272
		if (savePassword)
273
			setCredentials(username, password, PROXY_USERNAME, PROXY_PASSWORD);
274
		else
275
			setCredentials(username, "", PROXY_USERNAME, PROXY_PASSWORD);
276
		cachedProxyUserName = username;
277
		isCachedProxyUserName = true;
278
		cachedProxyUserPassword = password;
279
		isCachedProxyUserPassword = true;
280
	}
281
282
	public void setHttpAuthenticationCredentials(String username, String password, boolean savePassword) {
283
		if (savePassword)
284
			setCredentials(username, password, AUTH_HTTP_USERNAME, AUTH_HTTP_PASSWORD);
285
		else
286
			setCredentials(username, "", AUTH_HTTP_USERNAME, AUTH_HTTP_PASSWORD);
287
		cachedHttpUserName = username;
288
		isCachedHttpUserName = true;
289
		cachedHttpUserPassword = password;
290
		isCachedHttpUserPassword = true;
291
	}
292
206
	private void setCredentials(String username, String password, String userProperty, String passwordProperty) {
293
	private void setCredentials(String username, String password, String userProperty, String passwordProperty) {
207
		Map<String, String> map = getAuthInfo();
294
		Map<String, String> map = getAuthInfo();
208
		if (map == null) {
295
		if (map == null) {
Lines 232-237 Link Here
232
					headlessCreds.clear();
319
					headlessCreds.clear();
233
				}
320
				}
234
				isCachedUserName = false;
321
				isCachedUserName = false;
322
				isCachedProxyUserName = false;
323
				isCachedHttpUserName = false;
324
				isCachedUserPassword = false;
325
				isCachedProxyUserPassword = false;
326
				isCachedHttpUserPassword = false;
235
			} catch (CoreException e) {
327
			} catch (CoreException e) {
236
				StatusHandler.fail(e, "could not flush authorization credentials", true);
328
				StatusHandler.fail(e, "could not flush authorization credentials", true);
237
			}
329
			}
Lines 468-471 Link Here
468
		return getProperty(OFFLINE) != null && "true".equals(getProperty(OFFLINE));
560
		return getProperty(OFFLINE) != null && "true".equals(getProperty(OFFLINE));
469
	}
561
	}
470
562
563
	public void setSavePassword(boolean b) {
564
		properties.put(SAVE_PASSWORD, String.valueOf(b));
565
	}
566
567
	public boolean isSavePassword() {
568
		return getProperty(SAVE_PASSWORD) != null && "true".equals(getProperty(SAVE_PASSWORD));
569
	}
570
571
	public void setSaveHttpPassword(boolean b) {
572
		properties.put(SAVE_HTTP_PASSWORD, String.valueOf(b));
573
	}
574
575
	public boolean isSaveHttpPassword() {
576
		return getProperty(SAVE_HTTP_PASSWORD) != null && "true".equals(getProperty(SAVE_HTTP_PASSWORD));
577
	}
578
579
	public void setSaveProxyPassword(boolean b) {
580
		properties.put(SAVE_PROXY_PASSWORD, String.valueOf(b));
581
	}
582
583
	public boolean isSaveProxyPassword() {
584
		return getProperty(SAVE_PROXY_PASSWORD) != null && "true".equals(getProperty(SAVE_PROXY_PASSWORD));
585
	}
586
587
	public String getCachedPassword() {
588
		if (isCachedUserPassword)
589
			return cachedUserPassword;
590
		else
591
			return null;
592
	}
593
594
	public String getCachedHttpPassword() {
595
		if (isCachedHttpUserPassword)
596
			return cachedHttpUserPassword;
597
		else
598
			return null;
599
	}
600
601
	public String getCachedProxyPassword() {
602
		if (isCachedProxyUserPassword)
603
			return cachedProxyUserPassword;
604
		else
605
			return null;
606
	}
607
471
}
608
}
(-)src/org/eclipse/mylyn/bugzilla/tests/EncodingTest.java (-2 / +2 lines)
Lines 41-47 Link Here
41
	 * different encoding (though it may not be legible)
41
	 * different encoding (though it may not be legible)
42
	 */
42
	 */
43
	public void testDifferentReportEncoding() throws CoreException {
43
	public void testDifferentReportEncoding() throws CoreException {
44
		init222();
44
		init222(true);
45
		repository.setCharacterEncoding("UTF-8");
45
		repository.setCharacterEncoding("UTF-8");
46
		BugzillaTask task = (BugzillaTask) connector.createTaskFromExistingId(repository, "57",
46
		BugzillaTask task = (BugzillaTask) connector.createTaskFromExistingId(repository, "57",
47
				new NullProgressMonitor());
47
				new NullProgressMonitor());
Lines 59-65 Link Here
59
	}
59
	}
60
60
61
	public void testProperEncodingUponPost() throws CoreException {
61
	public void testProperEncodingUponPost() throws CoreException {
62
		init222();
62
		init222(true);
63
		repository.setCharacterEncoding("UTF-8");
63
		repository.setCharacterEncoding("UTF-8");
64
		BugzillaTask task = (BugzillaTask) connector.createTaskFromExistingId(repository, "57",
64
		BugzillaTask task = (BugzillaTask) connector.createTaskFromExistingId(repository, "57",
65
				new NullProgressMonitor());
65
				new NullProgressMonitor());
(-)src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java (-18 / +24 lines)
Lines 51-69 Link Here
51
//	3.1		 1		rob.elves@eclipse.org	tests@mylar.eclipse.org
51
//	3.1		 1		rob.elves@eclipse.org	tests@mylar.eclipse.org
52
52
53
	public void testReassign222() throws CoreException {
53
	public void testReassign222() throws CoreException {
54
		init222();
54
		init222(true);
55
		String taskNumber = "92";
55
		String taskNumber = "92";
56
		doReassignOld(taskNumber, "user@mylar.eclipse.org");
56
		doReassignOld(taskNumber, "user@mylar.eclipse.org");
57
	}
57
	}
58
58
59
	public void testReassign30() throws CoreException {
59
	public void testReassign30() throws CoreException {
60
		init30();
60
		init30(true);
61
		String taskNumber = "5";
62
		doReassignOld(taskNumber, "tests@mylyn.eclipse.org");
63
	}
64
65
	public void testReassign30MemoryonlyPassword() throws CoreException {
66
		init30(false);
61
		String taskNumber = "5";
67
		String taskNumber = "5";
62
		doReassignOld(taskNumber, "tests@mylyn.eclipse.org");
68
		doReassignOld(taskNumber, "tests@mylyn.eclipse.org");
63
	}
69
	}
64
70
65
	public void testReassign31() throws CoreException {
71
	public void testReassign31() throws CoreException {
66
		init31();
72
		init31(false);
67
		String taskNumber = "1";
73
		String taskNumber = "1";
68
74
69
		TasksUiPlugin.getTaskDataManager().clear();
75
		TasksUiPlugin.getTaskDataManager().clear();
Lines 178-184 Link Here
178
	}
184
	}
179
185
180
	public void testSubTaskHasIncoming() throws CoreException {
186
	public void testSubTaskHasIncoming() throws CoreException {
181
		init30();
187
		init30(true);
182
		String taskNumber = "6";
188
		String taskNumber = "6";
183
		BugzillaTask task = generateLocalTaskAndDownload(taskNumber);
189
		BugzillaTask task = generateLocalTaskAndDownload(taskNumber);
184
		assertNotNull(task);
190
		assertNotNull(task);
Lines 188-194 Link Here
188
	}
194
	}
189
195
190
	public void testFocedQuerySynchronization() throws CoreException {
196
	public void testFocedQuerySynchronization() throws CoreException {
191
		init222();
197
		init222(true);
192
		TasksUiPlugin.getSynchronizationManager().setForceSyncExec(true);
198
		TasksUiPlugin.getSynchronizationManager().setForceSyncExec(true);
193
		TasksUiPlugin.getTaskDataManager().clear();
199
		TasksUiPlugin.getTaskDataManager().clear();
194
		assertEquals(0, taskList.getAllTasks().size());
200
		assertEquals(0, taskList.getAllTasks().size());
Lines 214-220 Link Here
214
	}
220
	}
215
221
216
	public void testCreateTaskFromExistingId() throws Exception {
222
	public void testCreateTaskFromExistingId() throws Exception {
217
		init222();
223
		init222(true);
218
		try {
224
		try {
219
			connector.createTaskFromExistingId(repository, "9999", new NullProgressMonitor());
225
			connector.createTaskFromExistingId(repository, "9999", new NullProgressMonitor());
220
			fail();
226
			fail();
Lines 233-239 Link Here
233
	}
239
	}
234
240
235
	public void testAnonymousRepositoryAccess() throws Exception {
241
	public void testAnonymousRepositoryAccess() throws Exception {
236
		init218();
242
		init218(true);
237
		assertNotNull(repository);
243
		assertNotNull(repository);
238
		repository.setAuthenticationCredentials("", "");
244
		repository.setAuthenticationCredentials("", "");
239
		// test anonymous task retrieval
245
		// test anonymous task retrieval
Lines 271-277 Link Here
271
	}
277
	}
272
278
273
	public void testUpdate() throws Exception {
279
	public void testUpdate() throws Exception {
274
		init222();
280
		init222(true);
275
		String taskNumber = "3";
281
		String taskNumber = "3";
276
		TasksUiPlugin.getTaskDataManager().clear();
282
		TasksUiPlugin.getTaskDataManager().clear();
277
		assertEquals(0, TasksUiPlugin.getTaskListManager().getTaskList().getAllTasks().size());
283
		assertEquals(0, TasksUiPlugin.getTaskListManager().getTaskList().getAllTasks().size());
Lines 288-294 Link Here
288
	}
294
	}
289
295
290
	public void testUpdateWithSubTasks() throws Exception {
296
	public void testUpdateWithSubTasks() throws Exception {
291
		init222();
297
		init222(true);
292
		String taskNumber = "23";
298
		String taskNumber = "23";
293
		TasksUiPlugin.getTaskDataManager().clear();
299
		TasksUiPlugin.getTaskDataManager().clear();
294
		assertEquals(0, TasksUiPlugin.getTaskListManager().getTaskList().getAllTasks().size());
300
		assertEquals(0, TasksUiPlugin.getTaskListManager().getTaskList().getAllTasks().size());
Lines 298-304 Link Here
298
	}
304
	}
299
305
300
	public void testContextAttachFailure() throws Exception {
306
	public void testContextAttachFailure() throws Exception {
301
		init218();
307
		init218(true);
302
		BugzillaTask task = this.generateLocalTaskAndDownload("3");
308
		BugzillaTask task = this.generateLocalTaskAndDownload("3");
303
		assertNotNull(task);
309
		assertNotNull(task);
304
		assertNotNull(TasksUiPlugin.getTaskDataManager().getNewTaskData(task.getRepositoryUrl(), task.getTaskId()));
310
		assertNotNull(TasksUiPlugin.getTaskDataManager().getNewTaskData(task.getRepositoryUrl(), task.getTaskId()));
Lines 318-324 Link Here
318
	}
324
	}
319
325
320
	public void testSynchronize() throws CoreException {
326
	public void testSynchronize() throws CoreException {
321
		init222();
327
		init222(true);
322
328
323
		TasksUiPlugin.getTaskDataManager().clear();
329
		TasksUiPlugin.getTaskDataManager().clear();
324
330
Lines 378-384 Link Here
378
	}
384
	}
379
385
380
	public void testUniqueQueryHitObjects() {
386
	public void testUniqueQueryHitObjects() {
381
		init222();
387
		init222(true);
382
		BugzillaRepositoryQuery query1 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
388
		BugzillaRepositoryQuery query1 = new BugzillaRepositoryQuery(IBugzillaConstants.TEST_BUGZILLA_222_URL,
383
				"queryurl", "description1");
389
				"queryurl", "description1");
384
		BugzillaTask query1Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description1");
390
		BugzillaTask query1Hit = new BugzillaTask(IBugzillaConstants.TEST_BUGZILLA_222_URL, "1", "description1");
Lines 405-411 Link Here
405
	}
411
	}
406
412
407
	public void testAttachToExistingReport() throws Exception {
413
	public void testAttachToExistingReport() throws Exception {
408
		init222();
414
		init222(true);
409
		String taskNumber = "33";
415
		String taskNumber = "33";
410
		BugzillaTask task = generateLocalTaskAndDownload(taskNumber);
416
		BugzillaTask task = generateLocalTaskAndDownload(taskNumber);
411
		RepositoryTaskData taskData = TasksUiPlugin.getTaskDataManager().getNewTaskData(task.getRepositoryUrl(),
417
		RepositoryTaskData taskData = TasksUiPlugin.getTaskDataManager().getNewTaskData(task.getRepositoryUrl(),
Lines 497-503 Link Here
497
503
498
	public void testSynchChangedReports() throws Exception {
504
	public void testSynchChangedReports() throws Exception {
499
505
500
		init222();
506
		init222(true);
501
		String taskID = "4";
507
		String taskID = "4";
502
		BugzillaTask task4 = generateLocalTaskAndDownload(taskID);
508
		BugzillaTask task4 = generateLocalTaskAndDownload(taskID);
503
		RepositoryTaskData taskData4 = TasksUiPlugin.getTaskDataManager().getEditableCopy(task4.getRepositoryUrl(),
509
		RepositoryTaskData taskData4 = TasksUiPlugin.getTaskDataManager().getEditableCopy(task4.getRepositoryUrl(),
Lines 575-581 Link Here
575
581
576
	public void testIncomingWhenOfflineDeleted() throws Exception {
582
	public void testIncomingWhenOfflineDeleted() throws Exception {
577
583
578
		init222();
584
		init222(true);
579
		BugzillaTask task7 = generateLocalTaskAndDownload("7");
585
		BugzillaTask task7 = generateLocalTaskAndDownload("7");
580
		RepositoryTaskData recentTaskData = TasksUiPlugin.getTaskDataManager().getNewTaskData(task7.getRepositoryUrl(),
586
		RepositoryTaskData recentTaskData = TasksUiPlugin.getTaskDataManager().getNewTaskData(task7.getRepositoryUrl(),
581
				task7.getTaskId());
587
				task7.getTaskId());
Lines 618-624 Link Here
618
	}
624
	}
619
625
620
	public void testTimeTracker222() throws Exception {
626
	public void testTimeTracker222() throws Exception {
621
		init222();
627
		init222(true);
622
		timeTracker(15, true);
628
		timeTracker(15, true);
623
	}
629
	}
624
630
Lines 635-641 Link Here
635
	// }
641
	// }
636
642
637
	public void testTimeTracker218() throws Exception {
643
	public void testTimeTracker218() throws Exception {
638
		init218();
644
		init218(true);
639
		timeTracker(20, false);
645
		timeTracker(20, false);
640
	}
646
	}
641
647
Lines 724-730 Link Here
724
	 * Ensure obsoletes and patches are marked as such by the parser.
730
	 * Ensure obsoletes and patches are marked as such by the parser.
725
	 */
731
	 */
726
	public void testAttachmentAttributes() throws Exception {
732
	public void testAttachmentAttributes() throws Exception {
727
		init222();
733
		init222(true);
728
		int bugId = 19;
734
		int bugId = 19;
729
		String taskNumber = "" + bugId;
735
		String taskNumber = "" + bugId;
730
		BugzillaTask task = generateLocalTaskAndDownload(taskNumber);
736
		BugzillaTask task = generateLocalTaskAndDownload(taskNumber);
(-)src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java (-14 / +14 lines)
Lines 70-104 Link Here
70
		manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
70
		manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
71
	}
71
	}
72
72
73
	protected void init31() {
73
	protected void init31(boolean useKeyring) {
74
		init(IBugzillaConstants.TEST_BUGZILLA_31_URL);
74
		init(IBugzillaConstants.TEST_BUGZILLA_31_URL, useKeyring);
75
	}
75
	}
76
76
77
	protected void init30() {
77
	protected void init30(boolean useKeyring) {
78
		init(IBugzillaConstants.TEST_BUGZILLA_30_URL);
78
		init(IBugzillaConstants.TEST_BUGZILLA_30_URL, useKeyring);
79
	}
79
	}
80
80
81
	protected void init222() {
81
	protected void init222(boolean useKeyring) {
82
		init(IBugzillaConstants.TEST_BUGZILLA_222_URL);
82
		init(IBugzillaConstants.TEST_BUGZILLA_222_URL, useKeyring);
83
	}
83
	}
84
84
85
	protected void init2201() {
85
	protected void init2201(boolean useKeyring) {
86
		init(IBugzillaConstants.TEST_BUGZILLA_2201_URL);
86
		init(IBugzillaConstants.TEST_BUGZILLA_2201_URL, useKeyring);
87
	}
87
	}
88
88
89
	protected void init220() {
89
	protected void init220(boolean useKeyring) {
90
		init(IBugzillaConstants.TEST_BUGZILLA_220_URL);
90
		init(IBugzillaConstants.TEST_BUGZILLA_220_URL, useKeyring);
91
	}
91
	}
92
92
93
	protected void init218() {
93
	protected void init218(boolean useKeyring) {
94
		init(IBugzillaConstants.TEST_BUGZILLA_218_URL);
94
		init(IBugzillaConstants.TEST_BUGZILLA_218_URL, useKeyring);
95
	}
95
	}
96
96
97
	@SuppressWarnings("deprecation")
97
	@SuppressWarnings("deprecation")
98
	protected void init(String url) {
98
	protected void init(String url, boolean useKeyring) {
99
		repository = new TaskRepository(DEFAULT_KIND, url);
99
		repository = new TaskRepository(DEFAULT_KIND, url);
100
		Credentials credentials = TestUtil.readCredentials();
100
		Credentials credentials = TestUtil.readCredentials();
101
		repository.setAuthenticationCredentials(credentials.username, credentials.password);
101
		repository.setAuthenticationCredentials(credentials.username, credentials.password, useKeyring);
102
102
103
		repository.setTimeZoneId("Canada/Eastern");
103
		repository.setTimeZoneId("Canada/Eastern");
104
		assertNotNull(manager);
104
		assertNotNull(manager);

Return to bug 200634