1 /*******************************************************************************
2 * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
3 * Copyright (C) 2008, Roger C. Soares <rogersoares@intelinet.com.br>
4 * Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org>
5 * Copyright (C) 2010, Chris Aniszczyk <caniszczyk@gmail.com>
6 * Copyright (C) 2013, Daniel Megert <daniel_megert@ch.ibm.com>
7 * Copyright (C) 2013, Robin Stocker <robin@nibor.org>
8 * Copyright (C) 2014, Axel Richard <axel.richard@obeo.fr>
9 * Copyright (C) 2015, Denis Zygann <d.zygann@web.de>
10 * Copyright (C) 2016, Thomas Wolf <thomas.wolf@paranor.ch>
12 * All rights reserved. This program and the accompanying materials
13 * are made available under the terms of the Eclipse Public License v1.0
14 * which accompanies this distribution, and is available at
15 * http://www.eclipse.org/legal/epl-v10.html
16 *******************************************************************************/
17 package org
.eclipse
.egit
.ui
.internal
;
19 import java
.net
.MalformedURLException
;
22 import org
.eclipse
.egit
.ui
.Activator
;
23 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
24 import org
.eclipse
.jface
.resource
.ResourceManager
;
25 import org
.eclipse
.jface
.viewers
.IDecoration
;
26 import org
.eclipse
.swt
.graphics
.Image
;
29 * Icons for the the Eclipse plugin. Mostly decorations.
31 public class UIIcons
{
33 /** Decoration for resource in the index but not yet committed. */
34 public final static ImageDescriptor OVR_STAGED
;
36 /** Decoration for resource added to index but not yet committed. */
37 public final static ImageDescriptor OVR_STAGED_ADD
;
39 /** Decoration for resource removed from the index but not commit. */
40 public final static ImageDescriptor OVR_STAGED_REMOVE
;
42 /** Decoration for resource that was removed and added with another name */
43 public static final ImageDescriptor OVR_STAGED_RENAME
;
45 /** Decoration for resource not being tracked by Git */
46 public final static ImageDescriptor OVR_UNTRACKED
;
48 /** Decoration for tracked resource with a merge conflict. */
49 public final static ImageDescriptor OVR_CONFLICT
;
51 /** Decoration for tracked resources that we want to ignore changes in. */
52 public final static ImageDescriptor OVR_ASSUMEUNCHANGED
;
54 /** Decoration for tracked resources that are dirty. */
55 public final static ImageDescriptor OVR_DIRTY
;
57 /** Decoration for warning **/
58 public final static ImageDescriptor OVR_ERROR
;
60 /** Decoration for symlink **/
61 public final static ImageDescriptor OVR_SYMLINK
;
64 public final static ImageDescriptor ELCL16_FIND
;
65 /** Compare / View icon */
66 public final static ImageDescriptor ELCL16_COMPARE_VIEW
;
67 /** Next arrow icon */
68 public final static ImageDescriptor ELCL16_NEXT
;
69 /** Previous arrow icon */
70 public final static ImageDescriptor ELCL16_PREVIOUS
;
72 public final static ImageDescriptor ELCL16_COMMIT
;
74 public final static ImageDescriptor ELCL16_COMMENTS
;
76 public final static ImageDescriptor ELCL16_AUTHOR
;
78 public final static ImageDescriptor ELCL16_COMMITTER
;
80 public final static ImageDescriptor ELCL16_ID
;
82 public final static ImageDescriptor ELCL16_DELETE
;
84 public final static ImageDescriptor ELCL16_ADD
;
86 public final static ImageDescriptor ELCL16_TRASH
;
88 public final static ImageDescriptor ELCL16_CLEAR
;
90 public final static ImageDescriptor ELCL16_REFRESH
;
91 /** Linked with icon */
92 public final static ImageDescriptor ELCL16_SYNCED
;
94 public final static ImageDescriptor ELCL16_FILTER
;
96 /** Enabled, checked, checkbox image */
97 public final static ImageDescriptor CHECKBOX_ENABLED_CHECKED
;
98 /** Enabled, unchecked, checkbox image */
99 public final static ImageDescriptor CHECKBOX_ENABLED_UNCHECKED
;
100 /** Disabled, checked, checkbox image */
101 public final static ImageDescriptor CHECKBOX_DISABLED_CHECKED
;
102 /** Disabled, unchecked, checkbox image */
103 public final static ImageDescriptor CHECKBOX_DISABLED_UNCHECKED
;
104 /** Edit configuration */
105 public final static ImageDescriptor EDITCONFIG
;
106 /** Create Patch Wizard banner */
107 public final static ImageDescriptor WIZBAN_CREATE_PATCH
;
109 /** Import Wizard banner */
110 public final static ImageDescriptor WIZBAN_IMPORT_REPO
;
112 /** Connect Wizard banner */
113 public final static ImageDescriptor WIZBAN_CONNECT_REPO
;
116 * Commit Wizard banner
117 * @TODO make use of this wizban
119 public final static ImageDescriptor WIZBAN_COMMIT
;
121 /** Fetch from Gerrit Wizard banner */
122 public final static ImageDescriptor WIZBAN_FETCH_GERRIT
;
124 /** Fetch Wizard banner */
125 public final static ImageDescriptor WIZBAN_FETCH
;
129 * @TODO make use of this wizban
131 public final static ImageDescriptor WIZBAN_PULL
;
133 /** Push to Gerrit Wizard banner */
134 public final static ImageDescriptor WIZBAN_PUSH_GERRIT
;
136 /** Push Wizard banner */
137 public final static ImageDescriptor WIZBAN_PUSH
;
139 /** Synchronize Wizard banner */
140 public final static ImageDescriptor WIZBAN_SYNCHRONIZE
;
142 /** History view, select all version in same project */
143 public final static ImageDescriptor FILTERPROJECT
;
145 /** History view, select all version in same folder */
146 public final static ImageDescriptor FILTERFOLDER
;
148 /** History view, select all version of resource */
149 public final static ImageDescriptor FILTERRESOURCE
;
152 public final static ImageDescriptor FETCH
;
155 public final static ImageDescriptor PULL
;
158 public final static ImageDescriptor PUSH
;
160 /** Collapse all button */
161 public final static ImageDescriptor COLLAPSEALL
;
163 /** Repository tree node */
164 public final static ImageDescriptor REPOSITORY
;
166 /** Gerrit Repository tree node */
167 public final static ImageDescriptor REPOSITORY_GERRIT
;
169 /** New Repository button */
170 public final static ImageDescriptor NEW_REPOSITORY
;
172 /** Create Repository button */
173 public final static ImageDescriptor CREATE_REPOSITORY
;
175 /** Remote Repository tree node */
176 public final static ImageDescriptor REMOTE_REPOSITORY
;
179 public final static ImageDescriptor RESET
;
181 /** Remote Repository tree node */
182 public final static ImageDescriptor REMOTE_SPEC
;
184 /** Branches tree node */
185 public final static ImageDescriptor BRANCHES
;
187 /** Checked-out decorator for branch */
188 public final static ImageDescriptor OVR_CHECKEDOUT
;
191 public final static ImageDescriptor TAGS
;
194 public final static ImageDescriptor TAG
;
196 /** Create Tag icon */
197 public final static ImageDescriptor CREATE_TAG
;
200 public final static ImageDescriptor BRANCH
;
202 /** Create Branch icon */
203 public final static ImageDescriptor CREATE_BRANCH
;
206 public final static ImageDescriptor CLONEGIT
;
208 /** Changeset Icon */
209 public final static ImageDescriptor CHANGESET
;
212 public final static ImageDescriptor GERRIT
;
214 /** Expand all icon */
215 public final static ImageDescriptor EXPAND_ALL
;
218 public final static ImageDescriptor CHECKOUT
;
220 /** Signed Off By icon */
221 public final static ImageDescriptor SIGNED_OFF
;
223 /** Check all icon */
224 public final static ImageDescriptor CHECK_ALL
;
226 /** Uncheck all icon */
227 public final static ImageDescriptor UNCHECK_ALL
;
229 /** Amend commit icon */
230 public final static ImageDescriptor AMEND_COMMIT
;
232 /** Untracked file icon */
233 public final static ImageDescriptor UNTRACKED_FILE
;
235 /** Commit note icon */
236 public final static ImageDescriptor NOTE
;
238 /** Show Annotation icon */
239 public final static ImageDescriptor ANNOTATE
;
242 public final static ImageDescriptor COMMIT
;
244 /** Cherry-pick icon */
245 public final static ImageDescriptor CHERRY_PICK
;
248 public final static ImageDescriptor REBASE
;
250 /** Rebase continue icon */
251 public final static ImageDescriptor REBASE_CONTINUE
;
253 /** Rebase skip icon */
254 public final static ImageDescriptor REBASE_SKIP
;
256 /** Rebase abort icon */
257 public final static ImageDescriptor REBASE_ABORT
;
259 /** Rebase process steps icon */
260 public final static ImageDescriptor REBASE_PROCESS_STEPS
;
263 public final static ImageDescriptor MERGE
;
265 /** Annotated tag icon */
266 public final static ImageDescriptor TAG_ANNOTATED
;
268 /** Submodules icon */
269 public final static ImageDescriptor SUBMODULES
;
272 public final static ImageDescriptor CLEAN
;
275 public final static ImageDescriptor STASH
;
277 /** History view icon */
278 public final static ImageDescriptor HISTORY
;
280 /** Search commit icon */
281 public final static ImageDescriptor SEARCH_COMMIT
;
283 /** Hierarchy layout icon */
284 public final static ImageDescriptor HIERARCHY
;
286 /** Flat presentation icon */
287 public final static ImageDescriptor FLAT
;
289 /** Compact tree presentation icon */
290 public final static ImageDescriptor COMPACT
;
292 /** Squash icon arrow up */
293 public final static ImageDescriptor SQUASH_UP
;
295 /** Squash icon arrow down */
296 public final static ImageDescriptor SQUASH_DOWN
;
298 /** Fixup icon arrow up */
299 public final static ImageDescriptor FIXUP_UP
;
301 /** Fixup icon arrow down */
302 public final static ImageDescriptor FIXUP_DOWN
;
305 public final static ImageDescriptor REWORD
;
307 /** Icon for done rebase step */
308 public final static ImageDescriptor DONE_STEP
;
310 /** Reword for current rebase step */
311 public final static ImageDescriptor CURRENT_STEP
;
313 /** Sort alphabetically icon */
314 public final static ImageDescriptor ALPHABETICALLY_SORT
;
316 /** Sort by state icon */
317 public final static ImageDescriptor STATE_SORT
;
319 /** {@link #BRANCH} overlaid with {@link #OVR_CHECKEDOUT}. */
320 public final static ImageDescriptor CHECKED_OUT_BRANCH
;
323 public final static URL base
;
327 OVR_STAGED
= map("ovr/staged.gif"); //$NON-NLS-1$
328 OVR_STAGED_ADD
= map("ovr/staged_added.gif"); //$NON-NLS-1$
329 OVR_STAGED_REMOVE
= map("ovr/staged_removed.gif"); //$NON-NLS-1$
330 OVR_STAGED_RENAME
= map("ovr/staged_renamed.gif"); //$NON-NLS-1$
331 OVR_UNTRACKED
= map("ovr/untracked.gif"); //$NON-NLS-1$
332 OVR_CONFLICT
= map("ovr/conflict.gif"); //$NON-NLS-1$
333 OVR_ASSUMEUNCHANGED
= map("ovr/assume_unchanged.gif"); //$NON-NLS-1$
334 OVR_DIRTY
= map("ovr/dirty.gif"); //$NON-NLS-1$
335 OVR_SYMLINK
= map("ovr/symlink_ovr.gif"); //$NON-NLS-1$
336 ELCL16_FIND
= map("elcl16/find.gif"); //$NON-NLS-1$
337 ELCL16_COMPARE_VIEW
= map("elcl16/compare_view.gif"); //$NON-NLS-1$
338 ELCL16_NEXT
= map("elcl16/next.gif"); //$NON-NLS-1$
339 ELCL16_PREVIOUS
= map("elcl16/previous.gif"); //$NON-NLS-1$
340 WIZBAN_CREATE_PATCH
= map("wizban/createpatch_wizban.png"); //$NON-NLS-1$
341 WIZBAN_IMPORT_REPO
= map("wizban/import_wiz.png"); //$NON-NLS-1$
342 WIZBAN_CONNECT_REPO
= map("wizban/newconnect_wizban.png"); //$NON-NLS-1$
343 WIZBAN_COMMIT
= map("wizban/commit_wizban.png"); //$NON-NLS-1$
344 WIZBAN_FETCH_GERRIT
= map("wizban/fetch_gerrit_wizban.png"); //$NON-NLS-1$
345 WIZBAN_FETCH
= map("wizban/fetch_wizban.png"); //$NON-NLS-1$
346 WIZBAN_PULL
= map("wizban/pull_wizban.png"); //$NON-NLS-1$
347 WIZBAN_PUSH_GERRIT
= map("wizban/push_gerrit_wizban.png"); //$NON-NLS-1$
348 WIZBAN_PUSH
= map("wizban/push_wizban.png"); //$NON-NLS-1$
349 WIZBAN_SYNCHRONIZE
= map("wizban/synchronize_wizban.png"); //$NON-NLS-1$
350 EDITCONFIG
= map("obj16/editconfig.gif"); //$NON-NLS-1$
351 ELCL16_COMMIT
= map("elcl16/commit.gif"); //$NON-NLS-1$
352 ELCL16_COMMENTS
= map("elcl16/comment.gif"); //$NON-NLS-1$
353 ELCL16_AUTHOR
= map("elcl16/author.gif"); //$NON-NLS-1$
354 ELCL16_COMMITTER
= map("elcl16/committer.gif"); //$NON-NLS-1$
355 ELCL16_DELETE
= map("elcl16/delete.gif"); //$NON-NLS-1$
356 ELCL16_ADD
= map("elcl16/add.gif"); //$NON-NLS-1$
357 ELCL16_TRASH
= map("elcl16/trash.gif"); //$NON-NLS-1$
358 ELCL16_CLEAR
= map("elcl16/clear.gif"); //$NON-NLS-1$
359 ELCL16_REFRESH
= map("elcl16/refresh.gif"); //$NON-NLS-1$
360 ELCL16_SYNCED
= map("elcl16/synced.png"); //$NON-NLS-1$
361 ELCL16_FILTER
= map("elcl16/filter_ps.gif"); //$NON-NLS-1$
362 ELCL16_ID
= map("elcl16/sha1.gif"); //$NON-NLS-1$
363 CHECKBOX_ENABLED_CHECKED
= map("checkboxes/enabled_checked.gif"); //$NON-NLS-1$
364 CHECKBOX_ENABLED_UNCHECKED
= map("checkboxes/enabled_unchecked.gif"); //$NON-NLS-1$
365 CHECKBOX_DISABLED_CHECKED
= map("checkboxes/disabled_checked.gif"); //$NON-NLS-1$
366 CHECKBOX_DISABLED_UNCHECKED
= map("checkboxes/disabled_unchecked.gif"); //$NON-NLS-1$
367 FILTERRESOURCE
= map("elcl16/filterresource.gif"); //$NON-NLS-1$
368 FILTERPROJECT
= map("elcl16/filterproject.gif"); //$NON-NLS-1$
369 FILTERFOLDER
= map("elcl16/filterfolder.gif"); //$NON-NLS-1$
370 FETCH
= map("obj16/fetch.png"); //$NON-NLS-1$
371 PUSH
= map("obj16/push.png"); //$NON-NLS-1$
372 PULL
= map("obj16/pull.png"); //$NON-NLS-1$
373 REPOSITORY
= map("obj16/repository_rep.gif"); //$NON-NLS-1$
374 REPOSITORY_GERRIT
= map("obj16/repository_gerrit.gif"); //$NON-NLS-1$
375 NEW_REPOSITORY
= map("etool16/newlocation_wiz.gif"); //$NON-NLS-1$
376 REMOTE_REPOSITORY
= map("obj16/remote_entry_tbl.gif"); //$NON-NLS-1$
377 REMOTE_SPEC
= map("obj16/synchronize.png"); //$NON-NLS-1$
378 BRANCHES
= map("obj16/branches_obj.gif"); //$NON-NLS-1$
379 OVR_CHECKEDOUT
= map("ovr/checkedout_ov.gif"); //$NON-NLS-1$
380 TAGS
= map("obj16/tags.gif"); //$NON-NLS-1$
381 TAG
= map("obj16/version_rep.gif"); //$NON-NLS-1$
382 CREATE_TAG
= map("obj16/new_tag_obj.gif"); //$NON-NLS-1$
383 BRANCH
= map("obj16/branch_obj.gif"); //$NON-NLS-1$
384 CREATE_BRANCH
= map("obj16/new_branch_obj.gif"); //$NON-NLS-1$
385 COLLAPSEALL
= map("elcl16/collapseall.gif"); //$NON-NLS-1$
386 CLONEGIT
= map("obj16/cloneGit.gif"); //$NON-NLS-1$
387 RESET
= map("obj16/reset.gif"); //$NON-NLS-1$
388 CHANGESET
= map("obj16/changelog_obj.gif"); //$NON-NLS-1$
389 GERRIT
= map("obj16/gerrit_obj.gif"); //$NON-NLS-1$
390 EXPAND_ALL
= map("wizban/expandall.gif"); //$NON-NLS-1$
391 CHECKOUT
= map("obj16/checkout.gif"); //$NON-NLS-1$
392 SIGNED_OFF
= map("obj16/signed-off.png"); //$NON-NLS-1$
393 CHECK_ALL
= map("obj16/check_all.gif"); //$NON-NLS-1$
394 UNCHECK_ALL
= map("obj16/uncheck_all.gif"); //$NON-NLS-1$
395 AMEND_COMMIT
= map("obj16/commit_amend.gif"); //$NON-NLS-1$
396 UNTRACKED_FILE
= map("obj16/untracked_file.gif"); //$NON-NLS-1$
397 NOTE
= map("obj16/note.png"); //$NON-NLS-1$
398 ANNOTATE
= map("etool16/annotate.gif"); //$NON-NLS-1$
399 COMMIT
= map("obj16/commit.png"); //$NON-NLS-1$
400 CHERRY_PICK
= map("obj16/cherry-pick.png"); //$NON-NLS-1$
401 REBASE
= map("obj16/rebase.gif"); //$NON-NLS-1$
402 REBASE_CONTINUE
= map("elcl16/continue.gif"); //$NON-NLS-1$
403 REBASE_SKIP
= map("elcl16/skip.gif"); //$NON-NLS-1$
404 REBASE_ABORT
= map("elcl16/progress_stop.gif"); //$NON-NLS-1$
405 REBASE_PROCESS_STEPS
= map("elcl16/start.gif"); //$NON-NLS-1$
406 OVR_ERROR
= map("ovr/error.png"); //$NON-NLS-1$
407 MERGE
= map("obj16/merge.gif"); //$NON-NLS-1$
408 TAG_ANNOTATED
= map("obj16/annotated-tag.gif"); //$NON-NLS-1$
409 CREATE_REPOSITORY
= map("etool16/createRepository.gif"); //$NON-NLS-1$
410 SUBMODULES
= map("obj16/submodules.gif"); //$NON-NLS-1$
411 CLEAN
= map("obj16/clean_obj.gif"); //$NON-NLS-1$
412 STASH
= map("obj16/stash.png"); //$NON-NLS-1$
413 HISTORY
= map("obj16/history.gif"); //$NON-NLS-1$
414 SEARCH_COMMIT
= map("obj16/search-commit.gif"); //$NON-NLS-1$
415 HIERARCHY
= map("elcl16/hierarchicalLayout.gif"); //$NON-NLS-1$
416 FLAT
= map("elcl16/flatLayout.gif"); //$NON-NLS-1$
417 COMPACT
= map("elcl16/compactLayout.gif"); //$NON-NLS-1$
418 SQUASH_UP
= map("obj16/squash-up.png"); //$NON-NLS-1$
419 SQUASH_DOWN
= map("obj16/squash-down.png"); //$NON-NLS-1$
420 FIXUP_UP
= map("obj16/fixup-up.png"); //$NON-NLS-1$
421 FIXUP_DOWN
= map("obj16/fixup-down.png"); //$NON-NLS-1$
422 REWORD
= map("obj16/reword.gif"); //$NON-NLS-1$
423 DONE_STEP
= map("obj16/done_step.gif"); //$NON-NLS-1$
424 CURRENT_STEP
= map("obj16/current_step.gif"); //$NON-NLS-1$
425 ALPHABETICALLY_SORT
= map("obj16/alphab_sort_co.gif"); //$NON-NLS-1$
426 STATE_SORT
= map("obj16/state_sort_co.png"); //$NON-NLS-1$
427 CHECKED_OUT_BRANCH
= new DecorationOverlayDescriptor(BRANCH
,
428 OVR_CHECKEDOUT
, IDecoration
.TOP_LEFT
);
431 private static ImageDescriptor
map(final String icon
) {
434 return ImageDescriptor
.createFromURL(new URL(base
, icon
));
435 } catch (MalformedURLException mux
) {
436 Activator
.logError(UIText
.UIIcons_errorLoadingPluginImage
, mux
);
438 return ImageDescriptor
.getMissingImageDescriptor();
441 private static URL
init() {
443 return new URL(Activator
.getDefault().getBundle().getEntry("/"), //$NON-NLS-1$
444 "icons/"); //$NON-NLS-1$
445 } catch (MalformedURLException mux
) {
446 Activator
.logError(UIText
.UIIcons_errorDeterminingIconBase
, mux
);
452 * Get the image for the given descriptor from the resource manager which
453 * handles disposal of the image when the resource manager itself is
456 * @param resourceManager
457 * {code ResourceManager} managing the image resources
459 * object describing an image
460 * @return the image for the given descriptor
462 public static Image
getImage(ResourceManager resourceManager
,
463 ImageDescriptor descriptor
) {
464 return (Image
) resourceManager
.get(descriptor
);