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

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentHandler.java (-1 / +1 lines)
Lines 51-57 Link Here
51
		try {
51
		try {
52
			String bugId = task.getTaskId();
52
			String bugId = task.getTaskId();
53
			BugzillaClient client = connector.getClientManager().getClient(repository);
53
			BugzillaClient client = connector.getClientManager().getClient(repository);
54
			client.postAttachment(bugId, comment, attachment);
54
			client.postAttachment(bugId, comment, attachment, repository);
55
		} catch (IOException e) {
55
		} catch (IOException e) {
56
			throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID,
56
			throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID,
57
					RepositoryStatus.ERROR_IO, repository.getUrl(), e));
57
					RepositoryStatus.ERROR_IO, repository.getUrl(), e));
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java (-7 / +7 lines)
Lines 73-83 Link Here
73
			int bugId = BugzillaRepositoryConnector.getBugId(taskId);
73
			int bugId = BugzillaRepositoryConnector.getBugId(taskId);
74
			RepositoryTaskData taskData;
74
			RepositoryTaskData taskData;
75
			try {
75
			try {
76
				taskData = client.getTaskData(bugId);
76
				taskData = client.getTaskData(bugId, repository);
77
			} catch (CoreException e) {
77
			} catch (CoreException e) {
78
				// TODO: Move retry handling into client
78
				// TODO: Move retry handling into client
79
				if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
79
				if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
80
					taskData = client.getTaskData(bugId);
80
					taskData = client.getTaskData(bugId, repository);
81
				} else {
81
				} else {
82
					throw e;
82
					throw e;
83
				}
83
				}
Lines 87-93 Link Here
87
					configureTaskData(repository, taskData);
87
					configureTaskData(repository, taskData);
88
				} catch (CoreException ce) {
88
				} catch (CoreException ce) {
89
					// retry since data retrieved may be corrupt
89
					// retry since data retrieved may be corrupt
90
					taskData = client.getTaskData(bugId);
90
					taskData = client.getTaskData(bugId, repository);
91
					if (taskData != null) {
91
					if (taskData != null) {
92
						configureTaskData(repository, taskData);
92
						configureTaskData(repository, taskData);
93
					}
93
					}
Lines 110-123 Link Here
110
			Set<RepositoryTaskData> result = new HashSet<RepositoryTaskData>();
110
			Set<RepositoryTaskData> result = new HashSet<RepositoryTaskData>();
111
			BugzillaClient client = connector.getClientManager().getClient(repository);
111
			BugzillaClient client = connector.getClientManager().getClient(repository);
112
			try {
112
			try {
113
				Map<String, RepositoryTaskData> dataReturned = client.getTaskData(taskIds);
113
				Map<String, RepositoryTaskData> dataReturned = client.getTaskData(taskIds, repository);
114
				for (RepositoryTaskData repositoryTaskData : dataReturned.values()) {
114
				for (RepositoryTaskData repositoryTaskData : dataReturned.values()) {
115
					result.add(repositoryTaskData);
115
					result.add(repositoryTaskData);
116
				}
116
				}
117
			} catch (CoreException e) {
117
			} catch (CoreException e) {
118
				// TODO: Move retry handling into client
118
				// TODO: Move retry handling into client
119
				if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
119
				if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
120
					Map<String, RepositoryTaskData> dataReturned = client.getTaskData(taskIds);
120
					Map<String, RepositoryTaskData> dataReturned = client.getTaskData(taskIds, repository);
121
					for (RepositoryTaskData repositoryTaskData : dataReturned.values()) {
121
					for (RepositoryTaskData repositoryTaskData : dataReturned.values()) {
122
						result.add(repositoryTaskData);
122
						result.add(repositoryTaskData);
123
					}
123
					}
Lines 150-160 Link Here
150
		try {
150
		try {
151
			BugzillaClient client = connector.getClientManager().getClient(repository);
151
			BugzillaClient client = connector.getClientManager().getClient(repository);
152
			try {
152
			try {
153
				return client.postTaskData(taskData);
153
				return client.postTaskData(taskData, repository);
154
			} catch (CoreException e) {
154
			} catch (CoreException e) {
155
				// TODO: Move retry handling into client
155
				// TODO: Move retry handling into client
156
				if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
156
				if (e.getStatus().getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) {
157
					return client.postTaskData(taskData);
157
					return client.postTaskData(taskData, repository);
158
				} else {
158
				} else {
159
					throw e;
159
					throw e;
160
				}
160
				}
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java (-2 / +2 lines)
Lines 379-390 Link Here
379
		try {
379
		try {
380
			monitor.beginTask("Running query", IProgressMonitor.UNKNOWN);
380
			monitor.beginTask("Running query", IProgressMonitor.UNKNOWN);
381
			BugzillaClient client = getClientManager().getClient(repository);
381
			BugzillaClient client = getClientManager().getClient(repository);
382
			boolean hitsReceived = client.getSearchHits(query, resultCollector);
382
			boolean hitsReceived = client.getSearchHits(query, resultCollector, repository);
383
			if (!hitsReceived) {
383
			if (!hitsReceived) {
384
				// XXX: HACK in case of ip change bugzilla can return 0 hits
384
				// XXX: HACK in case of ip change bugzilla can return 0 hits
385
				// due to invalid authorization token, forcing relogin fixes
385
				// due to invalid authorization token, forcing relogin fixes
386
				client.logout();
386
				client.logout();
387
				client.getSearchHits(query, resultCollector);
387
				client.getSearchHits(query, resultCollector, repository);
388
			}
388
			}
389
389
390
			return Status.OK_STATUS;
390
			return Status.OK_STATUS;
(-)src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java (-19 / +23 lines)
Lines 57-62 Link Here
57
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
57
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
58
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
58
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
59
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
59
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
60
import org.eclipse.mylyn.tasks.core.TaskRepository;
60
import org.eclipse.mylyn.web.core.HtmlStreamTokenizer;
61
import org.eclipse.mylyn.web.core.HtmlStreamTokenizer;
61
import org.eclipse.mylyn.web.core.HtmlTag;
62
import org.eclipse.mylyn.web.core.HtmlTag;
62
import org.eclipse.mylyn.web.core.WebClientUtil;
63
import org.eclipse.mylyn.web.core.WebClientUtil;
Lines 415-426 Link Here
415
		}
416
		}
416
	}
417
	}
417
418
418
	public RepositoryTaskData getTaskData(int id) throws IOException, CoreException {
419
	public RepositoryTaskData getTaskData(int id, TaskRepository repository) throws IOException, CoreException {
419
		final String idString = String.valueOf(id);
420
		final String idString = String.valueOf(id);
420
		Set<String> data = new HashSet<String>();
421
		Set<String> data = new HashSet<String>();
421
		data.add(idString);
422
		data.add(idString);
422
423
423
		Map<String, RepositoryTaskData> returnedData = getTaskData(data);
424
		Map<String, RepositoryTaskData> returnedData = getTaskData(data, null);
424
425
425
		return returnedData.get(idString);
426
		return returnedData.get(idString);
426
427
Lines 457-463 Link Here
457
//		}
458
//		}
458
	}
459
	}
459
460
460
	public boolean getSearchHits(AbstractRepositoryQuery query, ITaskCollector collector) throws IOException,
461
	public boolean getSearchHits(AbstractRepositoryQuery query, ITaskCollector collector, TaskRepository repository) throws IOException,
461
			CoreException {
462
			CoreException {
462
		GetMethod method = null;
463
		GetMethod method = null;
463
		try {
464
		try {
Lines 481-487 Link Here
481
				}
482
				}
482
			}
483
			}
483
			parseHtmlError(new BufferedReader(
484
			parseHtmlError(new BufferedReader(
484
					new InputStreamReader(method.getResponseBodyAsStream(), characterEncoding)));
485
					new InputStreamReader(method.getResponseBodyAsStream(), characterEncoding)), repository);
485
		} finally {
486
		} finally {
486
			if (method != null) {
487
			if (method != null) {
487
				method.releaseConnection();
488
				method.releaseConnection();
Lines 614-620 Link Here
614
		}
615
		}
615
	}
616
	}
616
617
617
	public void postAttachment(String bugReportID, String comment, ITaskAttachment attachment) throws HttpException,
618
	public void postAttachment(String bugReportID, String comment, ITaskAttachment attachment, TaskRepository repository) throws HttpException,
618
			IOException, CoreException {
619
			IOException, CoreException {
619
620
620
		// TODO: Throw IllegalArgumentException if passed null parameter
621
		// TODO: Throw IllegalArgumentException if passed null parameter
Lines 665-671 Link Here
665
						postMethod.getResponseCharSet());
666
						postMethod.getResponseCharSet());
666
				BufferedReader bufferedReader = new BufferedReader(reader);
667
				BufferedReader bufferedReader = new BufferedReader(reader);
667
668
668
				parseHtmlError(bufferedReader);
669
				parseHtmlError(bufferedReader, repository);
669
670
670
			} else {
671
			} else {
671
				postMethod.getResponseBody();
672
				postMethod.getResponseBody();
Lines 723-729 Link Here
723
724
724
	}
725
	}
725
726
726
	public String postTaskData(RepositoryTaskData taskData) throws IOException, CoreException {
727
	public String postTaskData(RepositoryTaskData taskData, TaskRepository repository) throws IOException, CoreException {
727
		NameValuePair[] formData = null;
728
		NameValuePair[] formData = null;
728
		String prefix = null;
729
		String prefix = null;
729
		String prefix2 = null;
730
		String prefix2 = null;
Lines 759-764 Link Here
759
			in.mark(1028);
760
			in.mark(1028);
760
			HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null);
761
			HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null);
761
762
763
			
762
			boolean existingBugPosted = false;
764
			boolean existingBugPosted = false;
763
			boolean isTitle = false;
765
			boolean isTitle = false;
764
			String title = "";
766
			String title = "";
Lines 770-775 Link Here
770
					continue;
772
					continue;
771
				}
773
				}
772
774
775
				String processed = repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_STRING_PROCESSED);
773
				if (isTitle) {
776
				if (isTitle) {
774
					// get all of the data in the title tag
777
					// get all of the data in the title tag
775
					if (token.getType() != Token.TAG) {
778
					if (token.getType() != Token.TAG) {
Lines 778-784 Link Here
778
					} else if (token.getType() == Token.TAG
781
					} else if (token.getType() == Token.TAG
779
							&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE
782
							&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE
780
							&& ((HtmlTag) token.getValue()).isEndTag()) {
783
							&& ((HtmlTag) token.getValue()).isEndTag()) {
781
						if (!taskData.isNew() && (title.toLowerCase(Locale.ENGLISH).indexOf("processed") != -1)) {
784
						if (!taskData.isNew() && (title.toLowerCase(Locale.ENGLISH).indexOf(processed) != -1)) {
782
							existingBugPosted = true;
785
							existingBugPosted = true;
783
						} else if (taskData.isNew() && prefix != null && prefix2 != null && postfix != null
786
						} else if (taskData.isNew() && prefix != null && prefix2 != null && postfix != null
784
								&& postfix2 != null) {
787
								&& postfix2 != null) {
Lines 815-821 Link Here
815
				} catch (IOException e) {
818
				} catch (IOException e) {
816
					// ignore
819
					// ignore
817
				}
820
				}
818
				parseHtmlError(in);
821
				parseHtmlError(in, repository);
819
			}
822
			}
820
823
821
			return result;
824
			return result;
Lines 965-972 Link Here
965
968
966
	/**
969
	/**
967
	 * Utility method for determining what potential error has occurred from a bugzilla html reponse page
970
	 * Utility method for determining what potential error has occurred from a bugzilla html reponse page
971
	 * @param repository TODO
968
	 */
972
	 */
969
	public void parseHtmlError(BufferedReader in) throws IOException, CoreException {
973
	public void parseHtmlError(BufferedReader in, TaskRepository repository) throws IOException, CoreException {
970
		HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null);
974
		HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null);
971
975
972
		boolean isTitle = false;
976
		boolean isTitle = false;
Lines 992-1010 Link Here
992
							&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE
996
							&& ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE
993
							&& ((HtmlTag) token.getValue()).isEndTag()) {
997
							&& ((HtmlTag) token.getValue()).isEndTag()) {
994
998
995
						if (title.indexOf("login") != -1 || title.indexOf("log in") != -1
999
						if (title.indexOf(repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_LOGIN)) != -1 /*|| title.indexOf("log in") != -1 */
996
								|| (title.indexOf("invalid") != -1 && title.indexOf("password") != -1)
1000
								|| (title.indexOf(repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_INVALID)) != -1 && title.indexOf(repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_PASSWORD)) != -1)
997
								|| title.indexOf("check e-mail") != -1) {
1001
								|| title.indexOf(repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_CHECK_EMAIL)) != -1) {
998
							authenticated = false;
1002
							authenticated = false;
999
							throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID,
1003
							throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID,
1000
									RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title));
1004
									RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title));
1001
						} else if (title.indexOf(IBugzillaConstants.ERROR_MIDAIR_COLLISION) != -1) {
1005
						} else if (title.indexOf(repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_COLLISION)) != -1) {
1002
							throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID,
1006
							throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID,
1003
									RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString()));
1007
									RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString()));
1004
						} else if (title.indexOf(IBugzillaConstants.ERROR_COMMENT_REQUIRED) != -1) {
1008
						} else if (title.indexOf(repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_COMMENT_REQUIRED)) != -1) {
1005
							throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID,
1009
							throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID,
1006
									RepositoryStatus.REPOSITORY_COMMENT_REQUIRED));
1010
									RepositoryStatus.REPOSITORY_COMMENT_REQUIRED));
1007
						} else if (title.indexOf(IBugzillaConstants.LOGGED_OUT) != -1) {
1011
						} else if (title.indexOf(repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_LOGGED_OUT)) != -1) {
1008
							authenticated = false;
1012
							authenticated = false;
1009
							// throw new
1013
							// throw new
1010
							// BugzillaException(IBugzillaConstants.LOGGED_OUT);
1014
							// BugzillaException(IBugzillaConstants.LOGGED_OUT);
Lines 1017-1023 Link Here
1017
					}
1021
					}
1018
				}
1022
				}
1019
			}
1023
			}
1020
1024
//			 repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_STRING_PROCESSED)
1021
			throw new CoreException(RepositoryStatus.createHtmlStatus(repositoryUrl.toString(), IStatus.INFO,
1025
			throw new CoreException(RepositoryStatus.createHtmlStatus(repositoryUrl.toString(), IStatus.INFO,
1022
					BugzillaCorePlugin.PLUGIN_ID, RepositoryStatus.ERROR_REPOSITORY,
1026
					BugzillaCorePlugin.PLUGIN_ID, RepositoryStatus.ERROR_REPOSITORY,
1023
					"A repository error has occurred.", body));
1027
					"A repository error has occurred.", body));
Lines 1066-1072 Link Here
1066
		return null;
1070
		return null;
1067
	}
1071
	}
1068
1072
1069
	public Map<String, RepositoryTaskData> getTaskData(Set<String> taskIds) throws IOException, CoreException {
1073
	public Map<String, RepositoryTaskData> getTaskData(Set<String> taskIds, TaskRepository repository) throws IOException, CoreException {
1070
		PostMethod method = null;
1074
		PostMethod method = null;
1071
		HashMap<String, RepositoryTaskData> taskDataMap = new HashMap<String, RepositoryTaskData>();
1075
		HashMap<String, RepositoryTaskData> taskDataMap = new HashMap<String, RepositoryTaskData>();
1072
		while (taskIds.size() > 0) {
1076
		while (taskIds.size() > 0) {
Lines 1116-1122 Link Here
1116
				} else {
1120
				} else {
1117
1121
1118
					parseHtmlError(new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream(),
1122
					parseHtmlError(new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream(),
1119
							characterEncoding)));
1123
							characterEncoding)), repository);
1120
				}
1124
				}
1121
			} finally {
1125
			} finally {
1122
				if (method != null) {
1126
				if (method != null) {
(-)src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java (+26 lines)
Lines 274-277 Link Here
274
274
275
	public static final String BUGZILLA_DEF_PLATFORM = "bugzilla.default.platform";
275
	public static final String BUGZILLA_DEF_PLATFORM = "bugzilla.default.platform";
276
276
277
	public static final String REPOSITORY_HTTP_ERROR_LOGIN = "bugzilla.http.error.Login";
278
279
	public static final String REPOSITORY_HTTP_ERROR_INVALID = "bugzilla.http.error.Invalid";
280
	
281
	public static final String REPOSITORY_HTTP_ERROR_PASSWORD = "bugzilla.http.error.Password";
282
	
283
	public static final String REPOSITORY_HTTP_ERROR_CHECK_EMAIL = "bugzilla.http.error.checkEmail";
284
	
285
	public static final String REPOSITORY_HTTP_ERROR_COLLISION = "bugzilla.http.error.collision";
286
	
287
	public static final String REPOSITORY_HTTP_ERROR_COMMENT_REQUIRED = "bugzilla.http.error.commentRequired";
288
	
289
	public static final String REPOSITORY_HTTP_ERROR_LOGGED_OUT = "bugzilla.http.error.loggedOut";
290
	
291
	public static final String REPOSITORY_HTTP_STRING_PROCESSED = "bugzilla.http.processed";
292
293
	public static final String REPOSITORY_HTTP_DEFAULT_ERROR_LOGIN = "login";
294
295
	public static final String REPOSITORY_HTTP_DEFAULT_ERROR_INVALID = "invalid";
296
	
297
	public static final String REPOSITORY_HTTP_DEFAULT_ERROR_PASSWORD = "password";
298
	
299
	public static final String REPOSITORY_HTTP_DEFAULT_ERROR_CHECK_EMAIL = "check e-mail";
300
	
301
	public static final String REPOSITORY_HTTP_DEFAULT_STRING_PROCESSED = "processed";
302
277
}
303
}
(-)src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java (+310 lines)
Lines 20-26 Link Here
20
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.core.runtime.IStatus;
21
import org.eclipse.core.runtime.NullProgressMonitor;
21
import org.eclipse.core.runtime.NullProgressMonitor;
22
import org.eclipse.core.runtime.Status;
22
import org.eclipse.core.runtime.Status;
23
import org.eclipse.jface.layout.GridDataFactory;
23
import org.eclipse.jface.operation.IRunnableWithProgress;
24
import org.eclipse.jface.operation.IRunnableWithProgress;
25
import org.eclipse.jface.preference.StringFieldEditor;
24
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
26
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
25
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClientFactory;
27
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClientFactory;
26
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
28
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
Lines 38-49 Link Here
38
import org.eclipse.swt.events.SelectionAdapter;
40
import org.eclipse.swt.events.SelectionAdapter;
39
import org.eclipse.swt.events.SelectionEvent;
41
import org.eclipse.swt.events.SelectionEvent;
40
import org.eclipse.swt.events.SelectionListener;
42
import org.eclipse.swt.events.SelectionListener;
43
import org.eclipse.swt.layout.GridData;
41
import org.eclipse.swt.layout.GridLayout;
44
import org.eclipse.swt.layout.GridLayout;
42
import org.eclipse.swt.widgets.Button;
45
import org.eclipse.swt.widgets.Button;
43
import org.eclipse.swt.widgets.Combo;
46
import org.eclipse.swt.widgets.Combo;
44
import org.eclipse.swt.widgets.Composite;
47
import org.eclipse.swt.widgets.Composite;
45
import org.eclipse.swt.widgets.Label;
48
import org.eclipse.swt.widgets.Label;
46
import org.eclipse.ui.PlatformUI;
49
import org.eclipse.ui.PlatformUI;
50
import org.eclipse.ui.forms.events.ExpansionAdapter;
51
import org.eclipse.ui.forms.events.ExpansionEvent;
52
import org.eclipse.ui.forms.widgets.ExpandableComposite;
53
import org.eclipse.ui.forms.widgets.Section;
47
54
48
/**
55
/**
49
 * @author Mik Kersten
56
 * @author Mik Kersten
Lines 85-90 Link Here
85
92
86
	private String os = null;
93
	private String os = null;
87
94
95
	private Composite httpStringComp;
96
97
	private ExpandableComposite httpStringComposite;
98
99
	protected static final String HTTP_ERROR_LOGIN = "Login : ";
100
101
	protected StringFieldEditor htmlErrorLogin;
102
103
	protected static final String HTTP_ERROR_INVALID = "Invalid : ";
104
105
	protected StringFieldEditor htmlErrorInvalid;
106
107
	protected static final String HTTP_ERROR_PASSWORD = "Password : ";
108
109
	protected StringFieldEditor htmlErrorPassword;
110
111
	protected static final String HTTP_ERROR_CHECK_EMAIL = "check Email : ";
112
113
	protected StringFieldEditor htmlErrorCheckEMail;
114
115
	protected static final String HTTP_ERROR_COLLISION = "collision : ";
116
117
	protected StringFieldEditor htmlErrorCollision;
118
119
	protected static final String HTTP_ERROR_COMMENT_REQUIRED = "comment required : ";
120
121
	protected StringFieldEditor htmlErrorCommentRequired;
122
123
	protected static final String HTTP_ERROR_LOGGED_OUT = "logged out : ";
124
125
	protected StringFieldEditor htmlErrorLoggedOut;
126
127
	protected static final String HTTP_STRING_PROCESSED = "processed : ";
128
129
	protected StringFieldEditor htmlStringProcessed;
130
88
	public BugzillaRepositorySettingsPage(AbstractRepositoryConnectorUi repositoryUi) {
131
	public BugzillaRepositorySettingsPage(AbstractRepositoryConnectorUi repositoryUi) {
89
		super(TITLE, DESCRIPTION, repositoryUi);
132
		super(TITLE, DESCRIPTION, repositoryUi);
90
		setNeedsAnonymousLogin(true);
133
		setNeedsAnonymousLogin(true);
Lines 265-270 Link Here
265
		defaultOSCombo = new Combo(platformOSContainer, SWT.READ_ONLY);
308
		defaultOSCombo = new Combo(platformOSContainer, SWT.READ_ONLY);
266
		populateOsCombo();
309
		populateOsCombo();
267
310
311
		httpStringComposite = toolkit.createExpandableComposite(compositeContainer, Section.COMPACT | Section.TWISTIE
312
				| Section.TITLE_BAR);
313
		httpStringComposite.clientVerticalSpacing = 0;
314
		GridData gridData_2 = new GridData(SWT.FILL, SWT.FILL, true, false);
315
		gridData_2.horizontalIndent = -5;
316
		httpStringComposite.setLayoutData(gridData_2);
317
		httpStringComposite.setFont(compositeContainer.getFont());
318
		httpStringComposite.setBackground(compositeContainer.getBackground());
319
		httpStringComposite.setText("Bugzilla HTTP Response Strings");
320
		httpStringComposite.addExpansionListener(new ExpansionAdapter() {
321
			@Override
322
			public void expansionStateChanged(ExpansionEvent e) {
323
				getControl().getShell().pack();
324
			}
325
		});
326
327
		GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).applyTo(httpStringComposite);
328
329
		httpStringComp = toolkit.createComposite(httpStringComposite, SWT.NONE);
330
		GridLayout gridLayout2 = new GridLayout();
331
		gridLayout2.numColumns = 4;
332
		gridLayout2.verticalSpacing = 0;
333
		httpStringComp.setLayout(gridLayout2);
334
		httpStringComp.setBackground(compositeContainer.getBackground());
335
		httpStringComposite.setClient(httpStringComp);
336
337
		htmlErrorLogin = new StringFieldEditor("", HTTP_ERROR_LOGIN, StringFieldEditor.UNLIMITED, httpStringComp) {
338
339
			@Override
340
			protected boolean doCheckState() {
341
				return true;
342
			}
343
344
			@Override
345
			protected void valueChanged() {
346
				super.valueChanged();
347
				isPageComplete();
348
				if (getWizard() != null) {
349
					getWizard().getContainer().updateButtons();
350
				}
351
			}
352
		};
353
354
		htmlErrorInvalid = new StringFieldEditor("", HTTP_ERROR_INVALID, StringFieldEditor.UNLIMITED, httpStringComp) {
355
356
			@Override
357
			protected boolean doCheckState() {
358
				return true;
359
			}
360
361
			@Override
362
			protected void valueChanged() {
363
				super.valueChanged();
364
				isPageComplete();
365
				if (getWizard() != null) {
366
					getWizard().getContainer().updateButtons();
367
				}
368
			}
369
		};
370
371
		htmlErrorPassword = new StringFieldEditor("", HTTP_ERROR_PASSWORD, StringFieldEditor.UNLIMITED, httpStringComp) {
372
373
			@Override
374
			protected boolean doCheckState() {
375
				return true;
376
			}
377
378
			@Override
379
			protected void valueChanged() {
380
				super.valueChanged();
381
				isPageComplete();
382
				if (getWizard() != null) {
383
					getWizard().getContainer().updateButtons();
384
				}
385
			}
386
		};
387
388
		htmlErrorCheckEMail = new StringFieldEditor("", HTTP_ERROR_CHECK_EMAIL, StringFieldEditor.UNLIMITED,
389
				httpStringComp) {
390
391
			@Override
392
			protected boolean doCheckState() {
393
				return true;
394
			}
395
396
			@Override
397
			protected void valueChanged() {
398
				super.valueChanged();
399
				isPageComplete();
400
				if (getWizard() != null) {
401
					getWizard().getContainer().updateButtons();
402
				}
403
			}
404
		};
405
406
		htmlErrorCollision = new StringFieldEditor("", HTTP_ERROR_COLLISION, StringFieldEditor.UNLIMITED,
407
				httpStringComp) {
408
409
			@Override
410
			protected boolean doCheckState() {
411
				return true;
412
			}
413
414
			@Override
415
			protected void valueChanged() {
416
				super.valueChanged();
417
				isPageComplete();
418
				if (getWizard() != null) {
419
					getWizard().getContainer().updateButtons();
420
				}
421
			}
422
		};
423
		htmlErrorCommentRequired = new StringFieldEditor("", HTTP_ERROR_COMMENT_REQUIRED, StringFieldEditor.UNLIMITED,
424
				httpStringComp) {
425
426
			@Override
427
			protected boolean doCheckState() {
428
				return true;
429
			}
430
431
			@Override
432
			protected void valueChanged() {
433
				super.valueChanged();
434
				isPageComplete();
435
				if (getWizard() != null) {
436
					getWizard().getContainer().updateButtons();
437
				}
438
			}
439
		};
440
		htmlErrorLoggedOut = new StringFieldEditor("", HTTP_ERROR_LOGGED_OUT, StringFieldEditor.UNLIMITED,
441
				httpStringComp) {
442
443
			@Override
444
			protected boolean doCheckState() {
445
				return true;
446
			}
447
448
			@Override
449
			protected void valueChanged() {
450
				super.valueChanged();
451
				isPageComplete();
452
				if (getWizard() != null) {
453
					getWizard().getContainer().updateButtons();
454
				}
455
			}
456
		};
457
		htmlStringProcessed = new StringFieldEditor("", HTTP_STRING_PROCESSED, StringFieldEditor.UNLIMITED,
458
				httpStringComp) {
459
460
			@Override
461
			protected boolean doCheckState() {
462
				return true;
463
			}
464
465
			@Override
466
			protected void valueChanged() {
467
				super.valueChanged();
468
				isPageComplete();
469
				if (getWizard() != null) {
470
					getWizard().getContainer().updateButtons();
471
				}
472
			}
473
		};
474
		if (repository != null) {
475
			String propertyValue;
476
			propertyValue = repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_LOGIN);
477
			if (propertyValue == null)
478
				propertyValue = IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_ERROR_LOGIN;
479
			htmlErrorLogin.setStringValue(propertyValue);
480
			propertyValue = repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_INVALID);
481
			if (propertyValue == null)
482
				propertyValue = IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_ERROR_INVALID;
483
			htmlErrorInvalid.setStringValue(propertyValue);
484
			propertyValue = repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_PASSWORD);
485
			if (propertyValue == null)
486
				propertyValue = IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_ERROR_PASSWORD;
487
			htmlErrorPassword.setStringValue(propertyValue);
488
			propertyValue = repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_CHECK_EMAIL);
489
			if (propertyValue == null)
490
				propertyValue = IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_ERROR_CHECK_EMAIL;
491
			htmlErrorCheckEMail.setStringValue(propertyValue);
492
			propertyValue = repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_COLLISION);
493
			if (propertyValue == null)
494
				propertyValue = IBugzillaConstants.ERROR_MIDAIR_COLLISION;
495
			htmlErrorCollision.setStringValue(propertyValue);
496
			propertyValue = repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_COMMENT_REQUIRED);
497
			if (propertyValue == null)
498
				propertyValue = IBugzillaConstants.ERROR_COMMENT_REQUIRED;
499
			htmlErrorCommentRequired.setStringValue(propertyValue);
500
			propertyValue = repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_LOGGED_OUT);
501
			if (propertyValue == null)
502
				propertyValue = IBugzillaConstants.LOGGED_OUT;
503
			htmlErrorLoggedOut.setStringValue(propertyValue);
504
			propertyValue = repository.getProperty(IBugzillaConstants.REPOSITORY_HTTP_STRING_PROCESSED);
505
			if (propertyValue == null)
506
				propertyValue = IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_STRING_PROCESSED;
507
			htmlStringProcessed.setStringValue(propertyValue);
508
		} else {
509
			htmlErrorLogin.setStringValue(IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_ERROR_LOGIN);
510
			htmlErrorInvalid.setStringValue(IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_ERROR_INVALID);
511
			htmlErrorPassword.setStringValue(IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_ERROR_PASSWORD);
512
			htmlErrorCheckEMail.setStringValue(IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_ERROR_CHECK_EMAIL);
513
			htmlErrorCollision.setStringValue(IBugzillaConstants.ERROR_MIDAIR_COLLISION);
514
			htmlErrorCommentRequired.setStringValue(IBugzillaConstants.ERROR_COMMENT_REQUIRED);
515
			htmlErrorLoggedOut.setStringValue(IBugzillaConstants.LOGGED_OUT);
516
			htmlStringProcessed.setStringValue(IBugzillaConstants.REPOSITORY_HTTP_DEFAULT_STRING_PROCESSED);
517
		}
268
	}
518
	}
269
519
270
	private void populateOsCombo() {
520
	private void populateOsCombo() {
Lines 361-366 Link Here
361
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM);
611
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_PLATFORM);
362
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS);
612
			repository.removeProperty(IBugzillaConstants.BUGZILLA_DEF_OS);
363
		}
613
		}
614
		repository.setProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_LOGIN, htmlErrorLogin.getStringValue());
615
		repository.setProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_INVALID, htmlErrorInvalid.getStringValue());
616
		repository.setProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_PASSWORD, htmlErrorPassword.getStringValue());
617
		repository.setProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_CHECK_EMAIL,
618
				htmlErrorCheckEMail.getStringValue());
619
		repository.setProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_COLLISION, htmlErrorCollision.getStringValue());
620
		repository.setProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_COMMENT_REQUIRED,
621
				htmlErrorCommentRequired.getStringValue());
622
		repository.setProperty(IBugzillaConstants.REPOSITORY_HTTP_ERROR_LOGGED_OUT, htmlErrorLoggedOut.getStringValue());
623
		repository.setProperty(IBugzillaConstants.REPOSITORY_HTTP_STRING_PROCESSED,
624
				htmlStringProcessed.getStringValue());
625
364
	}
626
	}
365
627
366
	@Override
628
	@Override
Lines 372-377 Link Here
372
				erg = false;
634
				erg = false;
373
			}
635
			}
374
		}
636
		}
637
		if (erg) {
638
			if (htmlErrorLogin != null && htmlErrorLogin.getStringValue().compareTo("")== 0) {
639
				setErrorMessage("Bugzilla HTTP Response: login field must be filled ");
640
				erg = false;
641
			}
642
		}
643
		if (erg) {
644
			if (htmlErrorInvalid != null && htmlErrorInvalid.getStringValue().compareTo("")== 0) {
645
				setErrorMessage("Bugzilla HTTP Response: invalid field must be filled ");
646
				erg = false;
647
			}
648
		}
649
		if (erg) {
650
			if (htmlErrorPassword != null && htmlErrorPassword.getStringValue().compareTo("")== 0) {
651
				setErrorMessage("Bugzilla HTTP Response: password field must be filled ");
652
				erg = false;
653
			}
654
		}
655
		if (erg) {
656
			if (htmlErrorCheckEMail != null && htmlErrorCheckEMail.getStringValue().compareTo("")== 0) {
657
				setErrorMessage("Bugzilla HTTP Response: check eMail field must be filled ");
658
				erg = false;
659
			}
660
		}
661
		if (erg) {
662
			if (htmlErrorCollision != null && htmlErrorCollision.getStringValue().compareTo("")== 0) {
663
				setErrorMessage("Bugzilla HTTP Response: collision field must be filled ");
664
				erg = false;
665
			}
666
		}
667
		if (erg) {
668
			if (htmlErrorCommentRequired != null && htmlErrorCommentRequired.getStringValue().compareTo("")== 0) {
669
				setErrorMessage("Bugzilla HTTP Response: comment required field must be filled ");
670
				erg = false;
671
			}
672
		}
673
		if (erg) {
674
			if (htmlErrorLoggedOut != null && htmlErrorLoggedOut.getStringValue().compareTo("")== 0) {
675
				setErrorMessage("Bugzilla HTTP Response: clogged out field must be filled ");
676
				erg = false;
677
			}
678
		}
679
		if (erg) {
680
			if (htmlStringProcessed != null && htmlStringProcessed.getStringValue().compareTo("")== 0) {
681
				setErrorMessage("Bugzilla HTTP Response: processed field must be filled ");
682
				erg = false;
683
			}
684
		}
375
		return erg;
685
		return erg;
376
	}
686
	}
377
687

Return to bug 173352