View | Details | Raw Unified | Return to bug 211654 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/jira/core/service/JiraClientCache.java (+11 lines)
Lines 23-28 Link Here
23
import org.eclipse.mylyn.internal.jira.core.model.JiraVersion;
23
import org.eclipse.mylyn.internal.jira.core.model.JiraVersion;
24
import org.eclipse.mylyn.internal.jira.core.model.Priority;
24
import org.eclipse.mylyn.internal.jira.core.model.Priority;
25
import org.eclipse.mylyn.internal.jira.core.model.Project;
25
import org.eclipse.mylyn.internal.jira.core.model.Project;
26
import org.eclipse.mylyn.internal.jira.core.model.ProjectRole;
26
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
27
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
27
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
28
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
28
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
29
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
Lines 120-125 Link Here
120
		return data.projects;
121
		return data.projects;
121
	}
122
	}
122
123
124
	public ProjectRole[] getProjectRoles() {
125
		return data.projectRoles;
126
	}
127
123
	private void initializePriorities(JiraClientData data, IProgressMonitor monitor) throws JiraException {
128
	private void initializePriorities(JiraClientData data, IProgressMonitor monitor) throws JiraException {
124
		data.priorities = jiraClient.getPriorities(monitor);
129
		data.priorities = jiraClient.getPriorities(monitor);
125
		data.prioritiesById = new HashMap<String, Priority>(data.priorities.length);
130
		data.prioritiesById = new HashMap<String, Priority>(data.priorities.length);
Lines 187-192 Link Here
187
		}
192
		}
188
	}
193
	}
189
194
195
	private void initializeProjectRoles(JiraClientData data, IProgressMonitor monitor) throws JiraException {
196
		data.projectRoles = jiraClient.getProjectRoles(monitor);
197
	}
198
190
	private void initializeResolutions(JiraClientData data, IProgressMonitor monitor) throws JiraException {
199
	private void initializeResolutions(JiraClientData data, IProgressMonitor monitor) throws JiraException {
191
		data.resolutions = jiraClient.getResolutions(monitor);
200
		data.resolutions = jiraClient.getResolutions(monitor);
192
		data.resolutionsById = new HashMap<String, Resolution>(data.resolutions.length);
201
		data.resolutionsById = new HashMap<String, Resolution>(data.resolutions.length);
Lines 234-239 Link Here
234
			Policy.advance(monitor, 1);
243
			Policy.advance(monitor, 1);
235
			initializeStatuses(newData, monitor);
244
			initializeStatuses(newData, monitor);
236
			Policy.advance(monitor, 1);
245
			Policy.advance(monitor, 1);
246
			initializeProjectRoles(newData, monitor);
247
			Policy.advance(monitor, 1);
237
248
238
			newData.lastUpdate = System.currentTimeMillis();
249
			newData.lastUpdate = System.currentTimeMillis();
239
			this.data = newData;
250
			this.data = newData;
(-)src/org/eclipse/mylyn/internal/jira/core/service/JiraClientData.java (+3 lines)
Lines 20-25 Link Here
20
import org.eclipse.mylyn.internal.jira.core.model.JiraStatus;
20
import org.eclipse.mylyn.internal.jira.core.model.JiraStatus;
21
import org.eclipse.mylyn.internal.jira.core.model.Priority;
21
import org.eclipse.mylyn.internal.jira.core.model.Priority;
22
import org.eclipse.mylyn.internal.jira.core.model.Project;
22
import org.eclipse.mylyn.internal.jira.core.model.Project;
23
import org.eclipse.mylyn.internal.jira.core.model.ProjectRole;
23
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
24
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
24
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
25
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
25
import org.eclipse.mylyn.internal.jira.core.model.User;
26
import org.eclipse.mylyn.internal.jira.core.model.User;
Lines 57-62 Link Here
57
58
58
	JiraStatus[] statuses = new JiraStatus[0];
59
	JiraStatus[] statuses = new JiraStatus[0];
59
60
61
	ProjectRole[] projectRoles = new ProjectRole[0];
62
60
	Map<String, JiraStatus> statusesById = new HashMap<String, JiraStatus>();
63
	Map<String, JiraStatus> statusesById = new HashMap<String, JiraStatus>();
61
64
62
	// not used
65
	// not used
(-)src/org/eclipse/mylyn/internal/jira/core/service/JiraClient.java (+17 lines)
Lines 28-33 Link Here
28
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
28
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
29
import org.eclipse.mylyn.commons.net.AuthenticationType;
29
import org.eclipse.mylyn.commons.net.AuthenticationType;
30
import org.eclipse.mylyn.internal.jira.core.model.Attachment;
30
import org.eclipse.mylyn.internal.jira.core.model.Attachment;
31
import org.eclipse.mylyn.internal.jira.core.model.Comment;
31
import org.eclipse.mylyn.internal.jira.core.model.Component;
32
import org.eclipse.mylyn.internal.jira.core.model.Component;
32
import org.eclipse.mylyn.internal.jira.core.model.CustomField;
33
import org.eclipse.mylyn.internal.jira.core.model.CustomField;
33
import org.eclipse.mylyn.internal.jira.core.model.IssueField;
34
import org.eclipse.mylyn.internal.jira.core.model.IssueField;
Lines 41-49 Link Here
41
import org.eclipse.mylyn.internal.jira.core.model.NamedFilter;
42
import org.eclipse.mylyn.internal.jira.core.model.NamedFilter;
42
import org.eclipse.mylyn.internal.jira.core.model.Priority;
43
import org.eclipse.mylyn.internal.jira.core.model.Priority;
43
import org.eclipse.mylyn.internal.jira.core.model.Project;
44
import org.eclipse.mylyn.internal.jira.core.model.Project;
45
import org.eclipse.mylyn.internal.jira.core.model.ProjectRole;
44
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
46
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
45
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
47
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
46
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
48
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
49
import org.eclipse.mylyn.internal.jira.core.model.User;
47
import org.eclipse.mylyn.internal.jira.core.model.Version;
50
import org.eclipse.mylyn.internal.jira.core.model.Version;
48
import org.eclipse.mylyn.internal.jira.core.model.WebServerInfo;
51
import org.eclipse.mylyn.internal.jira.core.model.WebServerInfo;
49
import org.eclipse.mylyn.internal.jira.core.model.filter.FilterDefinition;
52
import org.eclipse.mylyn.internal.jira.core.model.filter.FilterDefinition;
Lines 132-137 Link Here
132
		webClient.addCommentToIssue(issue, comment, monitor);
135
		webClient.addCommentToIssue(issue, comment, monitor);
133
	}
136
	}
134
137
138
	public void addComentToIssueWithViewable(String issueKey, Comment comment, IProgressMonitor monitor)
139
			throws JiraException {
140
		soapClient.addComment(issueKey, comment, monitor);
141
	}
142
135
	public void advanceIssueWorkflow(JiraIssue issue, String actionKey, String comment, IProgressMonitor monitor)
143
	public void advanceIssueWorkflow(JiraIssue issue, String actionKey, String comment, IProgressMonitor monitor)
136
			throws JiraException {
144
			throws JiraException {
137
		String[] fields = getActionFields(issue.getKey(), actionKey, monitor);
145
		String[] fields = getActionFields(issue.getKey(), actionKey, monitor);
Lines 533-538 Link Here
533
	public JiraWorkLog addWorkLog(String issueKey, JiraWorkLog log, IProgressMonitor monitor) throws JiraException {
541
	public JiraWorkLog addWorkLog(String issueKey, JiraWorkLog log, IProgressMonitor monitor) throws JiraException {
534
		return soapClient.addWorkLog(issueKey, log, monitor);
542
		return soapClient.addWorkLog(issueKey, log, monitor);
535
	}
543
	}
544
	
545
	public ProjectRole[] getProjectRoles(IProgressMonitor monitor) throws JiraException {
546
		return soapClient.getProjectRoles(monitor);
547
	}
548
549
	public User[] getProjectRoleUsers(Project project, ProjectRole projectRole, IProgressMonitor monitor)
550
			throws JiraException {
551
		return soapClient.getProjectRoleUsers(project, projectRole, monitor);
552
	}
536
553
537
	public synchronized void setConfiguration(JiraConfiguration configuration) {
554
	public synchronized void setConfiguration(JiraConfiguration configuration) {
538
		Assert.isNotNull(configuration);
555
		Assert.isNotNull(configuration);
(-)src/org/eclipse/mylyn/internal/jira/core/JiraAttribute.java (-1 / +4 lines)
Lines 95-101 Link Here
95
95
96
	USER_REPORTER(TaskAttribute.USER_REPORTER, JiraFieldType.USERPICKER, Messages.JiraAttribute_Reported_by),
96
	USER_REPORTER(TaskAttribute.USER_REPORTER, JiraFieldType.USERPICKER, Messages.JiraAttribute_Reported_by),
97
97
98
	TASK_URL(TaskAttribute.TASK_URL, JiraFieldType.URL, Messages.JiraAttribute_URL);
98
	TASK_URL(TaskAttribute.TASK_URL, JiraFieldType.URL, Messages.JiraAttribute_URL),
99
100
	PROJECT_ROLES(IJiraConstants.ATTRIBUTE_PROJECT_ROLES, JiraFieldType.SELECT, Messages.JiraAttribute_Viewable_by,
101
			true, false);
99
102
100
	public static JiraAttribute valueById(String id) {
103
	public static JiraAttribute valueById(String id) {
101
		for (JiraAttribute attribute : values()) {
104
		for (JiraAttribute attribute : values()) {
(-)src/org/eclipse/mylyn/internal/jira/core/JiraTaskDataHandler.java (-2 / +36 lines)
Lines 50-55 Link Here
50
import org.eclipse.mylyn.internal.jira.core.model.JiraWorkLog;
50
import org.eclipse.mylyn.internal.jira.core.model.JiraWorkLog;
51
import org.eclipse.mylyn.internal.jira.core.model.Priority;
51
import org.eclipse.mylyn.internal.jira.core.model.Priority;
52
import org.eclipse.mylyn.internal.jira.core.model.Project;
52
import org.eclipse.mylyn.internal.jira.core.model.Project;
53
import org.eclipse.mylyn.internal.jira.core.model.ProjectRole;
53
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
54
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
54
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
55
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
55
import org.eclipse.mylyn.internal.jira.core.model.Subtask;
56
import org.eclipse.mylyn.internal.jira.core.model.Subtask;
Lines 279-284 Link Here
279
		}
280
		}
280
281
281
		data.getRoot().createAttribute(WorkLogConverter.ATTRIBUTE_WORKLOG_NEW);
282
		data.getRoot().createAttribute(WorkLogConverter.ATTRIBUTE_WORKLOG_NEW);
283
284
		TaskAttribute projectRoles = createAttribute(data, JiraAttribute.PROJECT_ROLES);
285
		projectRoles.putOption(IJiraConstants.NEW_COMMENT_VIEWABLE_BY_ALL, IJiraConstants.NEW_COMMENT_VIEWABLE_BY_ALL);
286
		for (ProjectRole projectRole : client.getCache().getProjectRoles()) {
287
			projectRoles.putOption(projectRole.getName(), projectRole.getName());
288
		}
289
282
	}
290
	}
283
291
284
	public TaskAttribute createAttribute(TaskData data, JiraAttribute key) {
292
	public TaskAttribute createAttribute(TaskData data, JiraAttribute key) {
Lines 448-453 Link Here
448
			removeAttribute(data, JiraAttribute.ENVIRONMENT);
456
			removeAttribute(data, JiraAttribute.ENVIRONMENT);
449
		}
457
		}
450
458
459
		addAttributeValue(data, JiraAttribute.PROJECT_ROLES, IJiraConstants.NEW_COMMENT_VIEWABLE_BY_ALL);
460
451
		addComments(data, jiraIssue, client);
461
		addComments(data, jiraIssue, client);
452
		addAttachments(data, jiraIssue, client);
462
		addAttachments(data, jiraIssue, client);
453
		addCustomFields(data, jiraIssue);
463
		addCustomFields(data, jiraIssue);
Lines 599-605 Link Here
599
609
600
			if (TaskAttribute.COMMENT_NEW.equals(attribute.getId())
610
			if (TaskAttribute.COMMENT_NEW.equals(attribute.getId())
601
					|| TaskAttribute.RESOLUTION.equals(attribute.getId())
611
					|| TaskAttribute.RESOLUTION.equals(attribute.getId())
602
					|| TaskAttribute.USER_ASSIGNED.equals(attribute.getId())) {
612
					|| TaskAttribute.USER_ASSIGNED.equals(attribute.getId())
613
					|| IJiraConstants.ATTRIBUTE_PROJECT_ROLES.equals(attribute.getId())) {
603
				properties.setReadOnly(false);
614
				properties.setReadOnly(false);
604
			} else {
615
			} else {
605
				// make attributes read-only if can't find editing options
616
				// make attributes read-only if can't find editing options
Lines 976-981 Link Here
976
				} else {
987
				} else {
977
					String operationId = getOperationId(taskData);
988
					String operationId = getOperationId(taskData);
978
					String newComment = getNewComment(taskData);
989
					String newComment = getNewComment(taskData);
990
979
					Set<String> changeIds = new HashSet<String>();
991
					Set<String> changeIds = new HashSet<String>();
980
					if (changedAttributes != null) {
992
					if (changedAttributes != null) {
981
						for (TaskAttribute ta : changedAttributes) {
993
						for (TaskAttribute ta : changedAttributes) {
Lines 983-988 Link Here
983
						}
995
						}
984
					}
996
					}
985
997
998
					String commentVisibility = taskData.getRoot().getMappedAttribute(
999
							IJiraConstants.ATTRIBUTE_PROJECT_ROLES).getValue();
1000
1001
					Comment soapComment = null;
1002
					if (!IJiraConstants.NEW_COMMENT_VIEWABLE_BY_ALL.equals(commentVisibility)) {
1003
						// not related for later processing
1004
						changeIds.remove(IJiraConstants.ATTRIBUTE_PROJECT_ROLES);
1005
1006
						if (newComment != null && newComment.length() > 0) {
1007
1008
							soapComment = new Comment();
1009
							soapComment.setComment(newComment);
1010
							soapComment.setRoleLevel(commentVisibility);
1011
1012
							newComment = null;
1013
						}
1014
1015
					}
1016
986
					boolean handled = false;
1017
					boolean handled = false;
987
1018
988
					// if only reassigning do not do the workflow
1019
					// if only reassigning do not do the workflow
Lines 1007-1015 Link Here
1007
					}
1038
					}
1008
1039
1009
					// at last try to at least post the comment (if everything else failed)
1040
					// at last try to at least post the comment (if everything else failed)
1010
					if (!handled && newComment.length() > 0) {
1041
					if (!handled && newComment != null && newComment.length() > 0) {
1011
						client.addCommentToIssue(issue, newComment, monitor);
1042
						client.addCommentToIssue(issue, newComment, monitor);
1012
						handled = true;
1043
						handled = true;
1044
					} else if (soapComment != null) {
1045
						client.addComentToIssueWithViewable(issue.getKey(), soapComment, monitor);
1046
						handled = true;
1013
					}
1047
					}
1014
1048
1015
					postWorkLog(repository, client, taskData, issue, monitor);
1049
					postWorkLog(repository, client, taskData, issue, monitor);
(-)src/org/eclipse/mylyn/internal/jira/core/IJiraConstants.java (+4 lines)
Lines 59-62 Link Here
59
59
60
	public static final String JIRA_TOOLKIT_PREFIX = "com.atlassian.jira.toolkit"; //$NON-NLS-1$
60
	public static final String JIRA_TOOLKIT_PREFIX = "com.atlassian.jira.toolkit"; //$NON-NLS-1$
61
61
62
	public static final String ATTRIBUTE_PROJECT_ROLES = "attribute.jira.project-roles"; //$NON-NLS-1$
63
64
	public static final String NEW_COMMENT_VIEWABLE_BY_ALL = "All Users"; //$NON-NLS-1$
65
62
}
66
}
(-)src/org/eclipse/mylyn/internal/jira/core/Messages.java (+2 lines)
Lines 51-56 Link Here
51
51
52
	public static String JiraAttribute_New_Comment;
52
	public static String JiraAttribute_New_Comment;
53
53
54
	public static String JiraAttribute_Viewable_by;
55
54
	public static String JiraAttribute_Original_Estimate;
56
	public static String JiraAttribute_Original_Estimate;
55
57
56
	public static String JiraAttribute_Parent;
58
	public static String JiraAttribute_Parent;
(-)src/org/eclipse/mylyn/internal/jira/core/messages.properties (+1 lines)
Lines 21-26 Link Here
21
JiraAttribute_Linked_ids=Linked ids:
21
JiraAttribute_Linked_ids=Linked ids:
22
JiraAttribute_Modified=Modified:
22
JiraAttribute_Modified=Modified:
23
JiraAttribute_New_Comment=New Comment:
23
JiraAttribute_New_Comment=New Comment:
24
JiraAttribute_Viewable_by=Viewable By:
24
JiraAttribute_Original_Estimate=Original Estimate:
25
JiraAttribute_Original_Estimate=Original Estimate:
25
JiraAttribute_Parent=Parent:
26
JiraAttribute_Parent=Parent:
26
JiraAttribute_Parent_ID=Parent ID:
27
JiraAttribute_Parent_ID=Parent ID:
(-)src/org/eclipse/mylyn/internal/jira/core/service/soap/JiraSoapClient.java (+31 lines)
Lines 45-50 Link Here
45
import org.eclipse.mylyn.internal.jira.core.model.NamedFilter;
45
import org.eclipse.mylyn.internal.jira.core.model.NamedFilter;
46
import org.eclipse.mylyn.internal.jira.core.model.Priority;
46
import org.eclipse.mylyn.internal.jira.core.model.Priority;
47
import org.eclipse.mylyn.internal.jira.core.model.Project;
47
import org.eclipse.mylyn.internal.jira.core.model.Project;
48
import org.eclipse.mylyn.internal.jira.core.model.ProjectRole;
48
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
49
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
49
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
50
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
50
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
51
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
Lines 59-64 Link Here
59
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteField;
60
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteField;
60
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteIssue;
61
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteIssue;
61
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteNamedObject;
62
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteNamedObject;
63
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteProjectRoleActors;
62
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteSecurityLevel;
64
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteSecurityLevel;
63
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteServerInfo;
65
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteServerInfo;
64
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteWorklog;
66
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteWorklog;
Lines 310-315 Link Here
310
		});
312
		});
311
	}
313
	}
312
314
315
	public ProjectRole[] getProjectRoles(IProgressMonitor monitor) throws JiraException {
316
		return call(monitor, new Callable<ProjectRole[]>() {
317
			public ProjectRole[] call() throws java.rmi.RemoteException, JiraException {
318
				return JiraSoapConverter.convert(getSoapService().getProjectRoles(loginToken.getCurrentValue()));
319
			}
320
		});
321
	}
322
313
	public JiraStatus[] getStatuses(IProgressMonitor monitor) throws JiraException {
323
	public JiraStatus[] getStatuses(IProgressMonitor monitor) throws JiraException {
314
		return call(monitor, new Callable<JiraStatus[]>() {
324
		return call(monitor, new Callable<JiraStatus[]>() {
315
			public JiraStatus[] call() throws java.rmi.RemoteException, JiraException {
325
			public JiraStatus[] call() throws java.rmi.RemoteException, JiraException {
Lines 628-631 Link Here
628
		});
638
		});
629
	}
639
	}
630
640
641
	public void addComment(final String issueKey, final Comment comment, IProgressMonitor monitor) throws JiraException {
642
		call(monitor, new Callable<Object>() {
643
			public Object call() throws java.rmi.RemoteException, JiraException {
644
				getSoapService().addComment(loginToken.getCurrentValue(), issueKey, JiraSoapConverter.convert(comment));
645
				return null;
646
			}
647
		});
648
	}
649
650
	public User[] getProjectRoleUsers(final Project project, final ProjectRole projectRole, IProgressMonitor monitor)
651
			throws JiraException {
652
		return call(monitor, new Callable<User[]>() {
653
			public User[] call() throws Exception {
654
				RemoteProjectRoleActors actors = getSoapService().getProjectRoleActors(loginToken.getCurrentValue(),
655
						JiraSoapConverter.convert(projectRole), JiraSoapConverter.convert(project));
656
657
				return JiraSoapConverter.convert(actors.getUsers());
658
			}
659
		});
660
	}
661
631
}
662
}
(-)src/org/eclipse/mylyn/internal/jira/core/service/soap/JiraSoapConverter.java (-6 / +62 lines)
Lines 24-29 Link Here
24
import org.eclipse.mylyn.internal.jira.core.model.NamedFilter;
24
import org.eclipse.mylyn.internal.jira.core.model.NamedFilter;
25
import org.eclipse.mylyn.internal.jira.core.model.Priority;
25
import org.eclipse.mylyn.internal.jira.core.model.Priority;
26
import org.eclipse.mylyn.internal.jira.core.model.Project;
26
import org.eclipse.mylyn.internal.jira.core.model.Project;
27
import org.eclipse.mylyn.internal.jira.core.model.ProjectRole;
27
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
28
import org.eclipse.mylyn.internal.jira.core.model.Resolution;
28
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
29
import org.eclipse.mylyn.internal.jira.core.model.SecurityLevel;
29
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
30
import org.eclipse.mylyn.internal.jira.core.model.ServerInfo;
Lines 37-42 Link Here
37
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteIssueType;
38
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteIssueType;
38
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemotePriority;
39
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemotePriority;
39
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteProject;
40
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteProject;
41
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteProjectRole;
40
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteResolution;
42
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteResolution;
41
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteSecurityLevel;
43
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteSecurityLevel;
42
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteServerInfo;
44
import org.eclipse.mylyn.internal.jira.core.wsdl.beans.RemoteServerInfo;
Lines 216-221 Link Here
216
		return project;
218
		return project;
217
	}
219
	}
218
220
221
	public static RemoteProject convert(Project project) {
222
		RemoteProject remoteProject = new RemoteProject();
223
224
		remoteProject.setDescription(project.getDescription());
225
		remoteProject.setId(project.getId());
226
		remoteProject.setKey(project.getKey());
227
		remoteProject.setLead(project.getLead());
228
		remoteProject.setName(project.getName());
229
		remoteProject.setProjectUrl(project.getProjectUrl());
230
		remoteProject.setUrl(project.getUrl());
231
232
		return remoteProject;
233
	}
234
235
	public static ProjectRole[] convert(RemoteProjectRole[] remoteProjectRoles) {
236
		ProjectRole[] projectRoles = new ProjectRole[remoteProjectRoles.length];
237
		for (int i = 0; i < remoteProjectRoles.length; ++i) {
238
			projectRoles[i] = convert(remoteProjectRoles[i]);
239
		}
240
		return projectRoles;
241
	}
242
243
	private static ProjectRole convert(RemoteProjectRole remoteProjectRole) {
244
		ProjectRole projectRole = new ProjectRole();
245
246
		projectRole.setDescription(remoteProjectRole.getDescription());
247
		projectRole.setId(remoteProjectRole.getId());
248
		projectRole.setName(remoteProjectRole.getName());
249
250
		return projectRole;
251
	}
252
253
	public static RemoteProjectRole convert(ProjectRole projectRole) {
254
		RemoteProjectRole remoteProjectRole = new RemoteProjectRole();
255
256
		remoteProjectRole.setDescription(projectRole.getDescription());
257
		remoteProjectRole.setId(projectRole.getId());
258
		remoteProjectRole.setName(projectRole.getName());
259
260
		return remoteProjectRole;
261
	}
262
219
	protected static Component[] convert(RemoteComponent[] remoteComponents) {
263
	protected static Component[] convert(RemoteComponent[] remoteComponents) {
220
		Component[] components = new Component[remoteComponents.length];
264
		Component[] components = new Component[remoteComponents.length];
221
		for (int i = 0; i < remoteComponents.length; i++) {
265
		for (int i = 0; i < remoteComponents.length; i++) {
Lines 294-309 Link Here
294
	public static Comment[] convert(RemoteComment[] remoteComments) {
338
	public static Comment[] convert(RemoteComment[] remoteComments) {
295
		Comment[] comments = new Comment[remoteComments.length];
339
		Comment[] comments = new Comment[remoteComments.length];
296
		for (int i = 0; i < remoteComments.length; i++) {
340
		for (int i = 0; i < remoteComments.length; i++) {
297
			RemoteComment remoteComment = remoteComments[i];
341
			comments[i] = convert(remoteComments[i]);
298
			Comment comment = new Comment();
299
			comment.setAuthor(remoteComment.getAuthor());
300
			comment.setComment(remoteComment.getBody());
301
			comment.setLevel(remoteComment.getRoleLevel());
302
			comments[i] = comment;
303
		}
342
		}
304
		return comments;
343
		return comments;
305
	}
344
	}
306
345
346
	private static Comment convert(RemoteComment remoteComment) {
347
		Comment comment = new Comment();
348
		comment.setAuthor(remoteComment.getAuthor());
349
		comment.setComment(remoteComment.getBody());
350
		comment.setRoleLevel(remoteComment.getRoleLevel());
351
		return comment;
352
	}
353
354
	public static RemoteComment convert(Comment comment) {
355
		RemoteComment rComment = new RemoteComment();
356
		rComment.setAuthor(comment.getAuthor());
357
		rComment.setBody(comment.getComment());
358
		rComment.setRoleLevel(comment.getRoleLevel());
359
360
		return rComment;
361
	}
362
307
	protected static SecurityLevel[] convert(RemoteSecurityLevel[] remoteSecurityLevels) {
363
	protected static SecurityLevel[] convert(RemoteSecurityLevel[] remoteSecurityLevels) {
308
		SecurityLevel[] securityLevels = new SecurityLevel[remoteSecurityLevels.length];
364
		SecurityLevel[] securityLevels = new SecurityLevel[remoteSecurityLevels.length];
309
		for (int i = 0; i < remoteSecurityLevels.length; i++) {
365
		for (int i = 0; i < remoteSecurityLevels.length; i++) {
(-)src/org/eclipse/mylyn/internal/jira/core/model/Comment.java (-7 / +7 lines)
Lines 24-30 Link Here
24
24
25
	private static final long serialVersionUID = 1L;
25
	private static final long serialVersionUID = 1L;
26
26
27
	private String level;
27
	private String roleLevel;
28
28
29
	private String comment;
29
	private String comment;
30
30
Lines 34-43 Link Here
34
34
35
	private boolean markupDetected;
35
	private boolean markupDetected;
36
36
37
	public Comment(String comment, String author, String level, Date created) {
37
	public Comment(String comment, String author, String roleLvel, Date created) {
38
		this.comment = comment;
38
		this.comment = comment;
39
		this.author = author;
39
		this.author = author;
40
		this.level = level;
40
		this.roleLevel = roleLvel;
41
		this.created = created;
41
		this.created = created;
42
	}
42
	}
43
43
Lines 56-63 Link Here
56
		return this.created;
56
		return this.created;
57
	}
57
	}
58
58
59
	public String getLevel() {
59
	public String getRoleLevel() {
60
		return this.level;
60
		return this.roleLevel;
61
	}
61
	}
62
62
63
	public boolean isMarkupDetected() {
63
	public boolean isMarkupDetected() {
Lines 76-83 Link Here
76
		this.created = created;
76
		this.created = created;
77
	}
77
	}
78
78
79
	public void setLevel(String level) {
79
	public void setRoleLevel(String level) {
80
		this.level = level;
80
		this.roleLevel = level;
81
	}
81
	}
82
82
83
	public void setMarkupDetected(boolean markupDetected) {
83
	public void setMarkupDetected(boolean markupDetected) {
(-)src/org/eclipse/mylyn/internal/jira/core/model/ProjectRole.java (+57 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 Atlassian 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
 * Contributors:
9
 *     Atlassian - initial API and implementation
10
 ******************************************************************************/
11
12
package org.eclipse.mylyn.internal.jira.core.model;
13
14
/**
15
 * @author Jacek Jaroczynski
16
 */
17
public class ProjectRole {
18
19
	private String description;
20
21
	private Long id;
22
23
	private String name;
24
25
	/**
26
	 * @param description
27
	 */
28
	public void setDescription(String description) {
29
		this.description = description;
30
	}
31
32
	/**
33
	 * @param id
34
	 */
35
	public void setId(Long id) {
36
		this.id = id;
37
	}
38
39
	/**
40
	 * @param name
41
	 */
42
	public void setName(String name) {
43
		this.name = name;
44
	}
45
46
	public String getDescription() {
47
		return description;
48
	}
49
50
	public Long getId() {
51
		return id;
52
	}
53
54
	public String getName() {
55
		return name;
56
	}
57
}
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java (-1 / +5 lines)
Lines 731-737 Link Here
731
		descriptors.add(new TaskEditorPartDescriptor(ID_PART_NEW_COMMENT) {
731
		descriptors.add(new TaskEditorPartDescriptor(ID_PART_NEW_COMMENT) {
732
			@Override
732
			@Override
733
			public AbstractTaskEditorPart createPart() {
733
			public AbstractTaskEditorPart createPart() {
734
				return new TaskEditorNewCommentPart();
734
				return createCommentPart();
735
			}
735
			}
736
		}.setPath(PATH_COMMENTS));
736
		}.setPath(PATH_COMMENTS));
737
737
Lines 761-766 Link Here
761
		return descriptors;
761
		return descriptors;
762
	}
762
	}
763
763
764
	protected AbstractTaskEditorPart createCommentPart() {
765
		return new TaskEditorNewCommentPart();
766
	}
767
764
	private Collection<TaskEditorPartDescriptor> getContributionPartDescriptors() {
768
	private Collection<TaskEditorPartDescriptor> getContributionPartDescriptors() {
765
		return TaskEditorContributionExtensionReader.getRepositoryEditorContributions();
769
		return TaskEditorContributionExtensionReader.getRepositoryEditorContributions();
766
	}
770
	}
(-)src/org/eclipse/mylyn/internal/jira/ui/editor/JiraTaskEditorPage.java (+5 lines)
Lines 56-61 Link Here
56
	}
56
	}
57
57
58
	@Override
58
	@Override
59
	protected AbstractTaskEditorPart createCommentPart() {
60
		return new TaskEditorNewCommentPartJira(getModel());
61
	}
62
63
	@Override
59
	protected AttributeEditorFactory createAttributeEditorFactory() {
64
	protected AttributeEditorFactory createAttributeEditorFactory() {
60
		AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) {
65
		AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) {
61
			@Override
66
			@Override
(-)src/org/eclipse/mylyn/internal/jira/ui/editor/TaskEditorNewCommentPartJira.java (+50 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 Atlassian 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
 * Contributors:
9
 *     Atlassian - initial API and implementation
10
 ******************************************************************************/
11
12
package org.eclipse.mylyn.internal.jira.ui.editor;
13
14
import org.eclipse.mylyn.internal.jira.core.JiraAttribute;
15
import org.eclipse.mylyn.internal.tasks.ui.editors.SingleSelectionAttributeEditor;
16
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorNewCommentPart;
17
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
18
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
19
import org.eclipse.swt.layout.GridLayout;
20
import org.eclipse.swt.widgets.Composite;
21
import org.eclipse.ui.forms.widgets.FormToolkit;
22
23
/**
24
 * @author Jacek Jaroczynski
25
 */
26
public class TaskEditorNewCommentPartJira extends TaskEditorNewCommentPart {
27
28
	private final TaskDataModel taskDataModel;
29
30
	public TaskEditorNewCommentPartJira(TaskDataModel taskDataModel) {
31
		this.taskDataModel = taskDataModel;
32
	}
33
34
	@Override
35
	public void createControl(Composite parent, FormToolkit toolkit) {
36
		super.createControl(parent, toolkit);
37
38
		Composite composite = toolkit.createComposite(super.getComposite());
39
		GridLayout layout = new GridLayout(2, false);
40
		composite.setLayout(layout);
41
42
		TaskAttribute projectRoles = taskDataModel.getTaskData().getRoot().getAttribute(
43
				JiraAttribute.PROJECT_ROLES.id());
44
45
		SingleSelectionAttributeEditor editor = new SingleSelectionAttributeEditor(taskDataModel, projectRoles);
46
		editor.createLabelControl(composite, toolkit);
47
		editor.createControl(composite, toolkit);
48
49
	}
50
}

Return to bug 211654