Skip to main content
summaryrefslogtreecommitdiffstats
blob: 4482e5fd3410e74c3a8e7e936701c647c3ab0bae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*******************************************************************************
 * Copyright (c) 2004 - 2006 University Of British Columbia and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     University Of British Columbia - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.tasks.ui.editors;

import org.eclipse.mylyn.internal.tasks.ui.editors.IRepositoryTaskSelection;
import org.eclipse.mylyn.tasks.core.TaskComment;

/**
 * A selection of an element in a view.
 */
public class RepositoryTaskSelection implements IRepositoryTaskSelection {

	protected String id;

	protected String repositoryUrl;

	/** The contents of the selection. */
	protected String contents;

	protected String taskSummary;

	protected String repositoryKind;

	/**
	 * The comment, if a comment was selected. If the selection was not a
	 * comment, then this is <code>null</code>.
	 */
	protected TaskComment taskComment;

	// /**
	// * Creates a new <code>RepositoryTaskSelection</code> with no supplied
	// * contents or comment.
	// *
	// * @param taskId
	// * The taskId of the Bugzilla object that the selection was on.
	// * @param server
	// * The server of the Bugzilla object that the selection was on.
	// */
	// public RepositoryTaskSelection(String id, String server, String summary)
	// {
	// this(id, server, null, null, summary);
	// }

	/**
	 * Creates a new <code>RepositoryTaskSelection</code> with no supplied
	 * comment.
	 * 
	 * @param taskId
	 *            The taskId of the Bugzilla object that the selection was on.
	 * @param server
	 *            The server of the Bugzilla object that the selection was on.
	 * @param contents
	 *            The contents of the selection.
	 */
	public RepositoryTaskSelection(String id, String server, String kind, String contents, boolean isDescription,
			String summary) {
		this(id, server, kind, contents, null, summary);
		this.isDescription = isDescription;
	}

	/**
	 * Creates a new <code>RepositoryTaskSelection</code>.
	 * 
	 * @param taskId
	 *            The taskId of the Bugzilla object that the selection was on.
	 * @param server
	 *            The server of the Bugzilla object that the selection was on.
	 * @param contents
	 *            The contents of the selection.
	 * @param taskComment
	 *            The <code>Comment</code> object for this selection. If a
	 *            comment was not selected, then this should be
	 *            <code>null</code>.
	 */
	public RepositoryTaskSelection(String id, String server, String kind, String contents, TaskComment taskComment,
			String summary) {
		this.id = id;
		this.repositoryUrl = server;
		this.repositoryKind = kind;
		this.contents = contents;
		this.taskComment = taskComment;
		this.taskSummary = summary;
	}

	// /**
	// * Creates a new <code>RepositoryTaskSelection</code> with no supplied
	// * contents.
	// *
	// * @param taskId
	// * The taskId of the Bugzilla object that the selection was on.
	// * @param server
	// * The server of the Bugzilla object that the selection was on.
	// * @param taskComment
	// * The <code>Comment</code> object for this selection. If a
	// * comment was not selected, then this should be
	// * <code>null</code>.
	// */
	// public RepositoryTaskSelection(String id, String server, TaskComment
	// taskComment, String summary) {
	// this(id, server, null, taskComment, summary);
	// }

	public boolean hasComment() {
		return taskComment != null;
	}

	public TaskComment getComment() {
		return taskComment;
	}

	public void setComment(TaskComment taskComment) {
		this.taskComment = taskComment;
	}

	public String getContents() {
		return contents;
	}

	public void setContents(String contents) {
		this.contents = contents;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getRepositoryUrl() {
		return repositoryUrl;
	}

	public String getRepositoryKind() {
		return repositoryKind;
	}

	public void setServer(String server) {
		this.repositoryUrl = server;
	}

	public boolean isEmpty() {
		return (repositoryUrl == null) || ((contents == null) && (taskComment == null));
	}

	private boolean isCommentHeader = false;

	private boolean isDescription = false;

	public boolean isCommentHeader() {
		return isCommentHeader;
	}

	public boolean isDescription() {
		return isDescription;
	}

	public void setIsCommentHeader(boolean isCommentHeader) {
		this.isCommentHeader = isCommentHeader;
	}

	public void setIsDescription(boolean isDescription) {
		this.isDescription = isDescription;
	}

	public String getBugSummary() {
		return taskSummary;
	}
}

Back to the top