Skip to main content
summaryrefslogtreecommitdiffstats
blob: 358a61d0708d65a053c4e355d982dec965490943 (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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
/*******************************************************************************
 * Copyright (c) 2004, 2009 Tasktop Technologies 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:
 *     Tasktop Technologies - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.tasks.ui;

import java.net.MalformedURLException;
import java.net.URL;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;

/**
 * @noextend This class is not intended to be subclassed by clients.
 * @noinstantiate This class is not intended to be instantiated by clients.
 * @author Mik Kersten
 * @since 3.0
 */
public class TasksUiImages {

	private static final URL baseURL = TasksUiPlugin.getDefault().getBundle().getEntry("/icons/"); //$NON-NLS-1$

	private static final String VIEW = "eview16"; //$NON-NLS-1$

	private static final String TOOL = "etool16"; //$NON-NLS-1$

	private static final String TOOL_SMALL = "etool12"; //$NON-NLS-1$

	private static final String OBJ = "obj16"; //$NON-NLS-1$

	private static final String WIZBAN = "wizban"; //$NON-NLS-1$

	// Tasks and Task List elements

	public static final ImageDescriptor TASK = create(TOOL, "task.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_COMPLETE = create(TOOL, "task-complete.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_INCOMPLETE = create(TOOL, "task-incomplete.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_COMPLETED = create(TOOL, "task-completed.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_NOTES = create(TOOL, "task-notes.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_NEW = create(TOOL, "task-new.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_NEW_SUB = create(TOOL, "sub-task-new.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_REPOSITORY_HISTORY = create(TOOL, "task-repository-history.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_REMOTE = create(TOOL, "task-remote.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_WORKING_SET = create(TOOL, "open-task.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASKS_VIEW = create("eview16", "task-list.gif"); //$NON-NLS-1$ //$NON-NLS-2$

	public static final ImageDescriptor TASK_ATTACHMENT_PATCH = create(OBJ, "attachment-patch.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_RETRIEVE = create(TOOL, "task-retrieve.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_REPOSITORY = create(TOOL, "task-repository.gif"); //$NON-NLS-1$

	public static final ImageDescriptor TASK_REPOSITORY_NEW = create(TOOL, "task-repository-new.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CATEGORY = create(TOOL, "category.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CATEGORY_NEW = create(TOOL, "category-new.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CATEGORY_UNCATEGORIZED = create(TOOL, "category-archive.gif"); //$NON-NLS-1$

	public static final ImageDescriptor QUERY = create(TOOL, "query.gif"); //$NON-NLS-1$

	public static final ImageDescriptor QUERY_NEW = create(TOOL, "query-new.gif"); //$NON-NLS-1$

	/**
	 * @since 3.2
	 */
	public static final ImageDescriptor QUERY_OFFLINE = ImageDescriptor.createWithFlags(TasksUiImages.QUERY,
			SWT.IMAGE_GRAY);

	public static final ImageDescriptor QUERY_UNMATCHED = create(TOOL, "query-unmatched.png"); //$NON-NLS-1$

	public static final ImageDescriptor REPOSITORY = create("eview16", "repository.gif"); //$NON-NLS-1$ //$NON-NLS-2$

	public static final ImageDescriptor REPOSITORY_OFFLINE = ImageDescriptor.createWithFlags(TasksUiImages.REPOSITORY,
			SWT.IMAGE_GRAY);

	public static final ImageDescriptor REPOSITORY_SYNCHRONIZE_SMALL = create(TOOL_SMALL,
			"repository-synchronize-small.png"); //$NON-NLS-1$

	/**
	 * @since 3.2
	 */
	public static final ImageDescriptor REPOSITORY_UPDATE_CONFIGURATION = create(TOOL,
			"repository-synchronize-attributes.png"); //$NON-NLS-1$

	public static final ImageDescriptor REPOSITORY_SYNCHRONIZE = create(TOOL, "repository-synchronize.gif"); //$NON-NLS-1$

	public static final ImageDescriptor REPOSITORY_SUBMIT = create(TOOL, "repository-submit.gif"); //$NON-NLS-1$

	public static final ImageDescriptor REPOSITORY_SMALL = create(OBJ, "repository-small.gif"); //$NON-NLS-1$

	public static final ImageDescriptor REPOSITORY_NEW = create("etool16", "repository-new.gif"); //$NON-NLS-1$ //$NON-NLS-2$

	/**
	 * @since 3.1
	 */
	public static final ImageDescriptor REPOSITORY_VALIDATE = create("obj16", "resource_obj.gif"); //$NON-NLS-1$ //$NON-NLS-2$

	public static final ImageDescriptor REPOSITORIES_VIEW = create("eview16", "repositories.gif"); //$NON-NLS-1$ //$NON-NLS-2$

	// Context and activation

	public static final ImageDescriptor CONTEXT_ACTIVE = create(TOOL, "task-active.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_ACTIVE_CENTERED = create(TOOL, "task-active-centered.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_INACTIVE_EMPTY = create(TOOL, "task-inactive.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_INACTIVE = create(TOOL, "task-context.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_FOCUS = create(VIEW, "focus.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_ATTACH = create(TOOL, "context-attach.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_RETRIEVE = create(TOOL, "context-retrieve.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_TRANSFER = create(TOOL, "context-transfer.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_CLEAR = create(TOOL, "context-clear.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_HISTORY_PREVIOUS = create(TOOL, "navigate-previous.gif"); //$NON-NLS-1$

	@Deprecated
	public static final ImageDescriptor CONTEXT_HISTORY_PREVIOUS_PAUSE = create(TOOL, "navigate-previous-pause.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_HISTORY_PREVIOUS_ACTIVE = create(TOOL, "navigate-previous-active.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_HISTORY_NEXT = create(TOOL, "navigate-next.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_CAPTURE_PAUSE = create(TOOL, "capture-pause.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_ADD = create(TOOL, "context-add.gif"); //$NON-NLS-1$

	public static final ImageDescriptor CONTEXT_COPY = create(TOOL, "context-transfer.gif"); //$NON-NLS-1$

	// Comments and collaboration

	public static final ImageDescriptor COMMENT = create(TOOL, "comment.gif"); //$NON-NLS-1$

	public static final ImageDescriptor COMMENT_SORT_DOWN = create(TOOL, "sort-down.gif"); //$NON-NLS-1$

	public static final ImageDescriptor COMMENT_SORT_UP = create(TOOL, "sort-up.gif"); //$NON-NLS-1$

	public static final ImageDescriptor COMMENT_SORT_DOWN_GRAY = create(TOOL, "sort-down-gray.gif"); //$NON-NLS-1$

	public static final ImageDescriptor COMMENT_SORT_UP_GRAY = create(TOOL, "sort-up-gray.gif"); //$NON-NLS-1$

	public static final ImageDescriptor COMMENT_REPLY = create(TOOL, "reply.gif"); //$NON-NLS-1$

	/**
	 * @since 3.1
	 */
	public static final ImageDescriptor COMMENT_REPLY_SMALL = create(TOOL_SMALL, "reply.gif"); //$NON-NLS-1$

	// Wizard banners

	public static final ImageDescriptor BANNER_REPOSITORY = create(WIZBAN, "banner-repository.gif"); //$NON-NLS-1$

	public static final ImageDescriptor BANNER_REPOSITORY_SETTINGS = create(WIZBAN, "banner-repository-settings.gif"); //$NON-NLS-1$

	public static final ImageDescriptor BANNER_REPOSITORY_CONTEXT = create(WIZBAN, "banner-repository-context.gif"); //$NON-NLS-1$

	public static final ImageDescriptor BANNER_WORKING_SET = create(WIZBAN, "workset_wiz.png"); //$NON-NLS-1$

	/**
	 * @since 3.2
	 */
	public static final ImageDescriptor PRESENTATION_CATEGORIZED = create(TOOL, "presentation-categorized.png"); //$NON-NLS-1$

	/**
	 * @since 3.2
	 */
	public static final ImageDescriptor PRESENTATION_SCHEDULED = create(TOOL, "presentation-scheduled.png"); //$NON-NLS-1$

	/**
	 * @since 3.2
	 */
	public static final ImageDescriptor BANNER_REPORT_BUG = create(WIZBAN, "bug-wizard.gif"); //$NON-NLS-1$

	/**
	 * @since 3.7
	 */

	public static final ImageDescriptor LOCK_CLOSE = create(TOOL_SMALL, "lock.gif"); //$NON-NLS-1$

	/**
	 * @since 3.7
	 */
	public static final ImageDescriptor LOCK_OPEN = create(TOOL_SMALL, "unlock.gif"); //$NON-NLS-1$

	public static Image getImageForPriority(PriorityLevel priorityLevel) {
		if (priorityLevel == null) {
			return null;
		} else {
			ImageDescriptor imageDescriptor = getImageDescriptorForPriority(priorityLevel);
			if (imageDescriptor != null) {
				return CommonImages.getImage(imageDescriptor);
			}
		}
		return null;
	}

	public static ImageDescriptor getImageDescriptorForPriority(PriorityLevel priorityLevel) {
		if (priorityLevel == null) {
			return null;
		}
		switch (priorityLevel) {
		case P1:
			return CommonImages.PRIORITY_1;
		case P2:
			return CommonImages.PRIORITY_2;
		case P3:
			return CommonImages.PRIORITY_3;
		case P4:
			return CommonImages.PRIORITY_4;
		case P5:
			return CommonImages.PRIORITY_5;
		default:
			return null;
		}
	}

	public static ImageDescriptor create(String prefix, String name) {
		try {
			return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
		} catch (MalformedURLException e) {
			return ImageDescriptor.getMissingImageDescriptor();
		}
	}

	private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException {
		if (baseURL == null) {
			throw new MalformedURLException();
		}

		StringBuffer buffer = new StringBuffer(prefix);
		buffer.append('/');
		buffer.append(name);
		return new URL(baseURL, buffer.toString());
	}

}

Back to the top