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 2.0
14 * which accompanies this distribution, and is available at
15 * https://www.eclipse.org/legal/epl-2.0/
17 * SPDX-License-Identifier: EPL-2.0
18 *******************************************************************************/
19 package org
.eclipse
.egit
.ui
.internal
;
21 import java
.net
.MalformedURLException
;
24 import org
.eclipse
.core
.runtime
.Platform
;
25 import org
.eclipse
.egit
.ui
.Activator
;
26 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
27 import org
.eclipse
.jface
.resource
.ResourceManager
;
28 import org
.eclipse
.jface
.viewers
.IDecoration
;
29 import org
.eclipse
.swt
.graphics
.Image
;
30 import org
.osgi
.framework
.Version
;
33 * Icons for the the Eclipse plugin. Mostly decorations.
35 public class UIIcons
{
37 /** Decoration for resource in the index but not yet committed. */
38 public final static ImageDescriptor OVR_STAGED
;
40 /** Decoration for resource added to index but not yet committed. */
41 public final static ImageDescriptor OVR_STAGED_ADD
;
43 /** Decoration for resource removed from the index but not commit. */
44 public final static ImageDescriptor OVR_STAGED_REMOVE
;
46 /** Decoration for resource that was removed and added with another name */
47 public static final ImageDescriptor OVR_STAGED_RENAME
;
49 /** Decoration for resource not being tracked by Git */
50 public final static ImageDescriptor OVR_UNTRACKED
;
52 /** Decoration for tracked resource with a merge conflict. */
53 public final static ImageDescriptor OVR_CONFLICT
;
55 /** Decoration for tracked resources that we want to ignore changes in. */
56 public final static ImageDescriptor OVR_ASSUMEUNCHANGED
;
58 /** Decoration for tracked resources that are dirty. */
59 public final static ImageDescriptor OVR_DIRTY
;
61 /** Decoration for warning **/
62 public final static ImageDescriptor OVR_ERROR
;
64 /** Decoration for symlink **/
65 public final static ImageDescriptor OVR_SYMLINK
;
68 public final static ImageDescriptor ELCL16_FIND
;
69 /** Compare / View icon */
70 public final static ImageDescriptor ELCL16_COMPARE_VIEW
;
71 /** Next arrow icon */
72 public final static ImageDescriptor ELCL16_NEXT
;
73 /** Previous arrow icon */
74 public final static ImageDescriptor ELCL16_PREVIOUS
;
76 public final static ImageDescriptor ELCL16_COMMIT
;
78 public final static ImageDescriptor ELCL16_COMMENTS
;
80 public final static ImageDescriptor ELCL16_AUTHOR
;
82 public final static ImageDescriptor ELCL16_COMMITTER
;
84 public final static ImageDescriptor ELCL16_ID
;
86 public final static ImageDescriptor ELCL16_DELETE
;
88 public final static ImageDescriptor ELCL16_ADD
;
90 public final static ImageDescriptor ELCL16_ADD_ALL
;
92 public final static ImageDescriptor ELCL16_TRASH
;
94 public final static ImageDescriptor ELCL16_CLEAR
;
96 public final static ImageDescriptor ELCL16_REFRESH
;
97 /** Linked with icon */
98 public final static ImageDescriptor ELCL16_SYNCED
;
100 public final static ImageDescriptor ELCL16_FILTER
;
102 /** Enabled, checked, checkbox image */
103 public final static ImageDescriptor CHECKBOX_ENABLED_CHECKED
;
104 /** Enabled, unchecked, checkbox image */
105 public final static ImageDescriptor CHECKBOX_ENABLED_UNCHECKED
;
106 /** Disabled, checked, checkbox image */
107 public final static ImageDescriptor CHECKBOX_DISABLED_CHECKED
;
108 /** Disabled, unchecked, checkbox image */
109 public final static ImageDescriptor CHECKBOX_DISABLED_UNCHECKED
;
110 /** Edit configuration */
111 public final static ImageDescriptor EDITCONFIG
;
112 /** Create Patch Wizard banner */
113 public final static ImageDescriptor WIZBAN_CREATE_PATCH
;
115 /** Import Wizard banner */
116 public final static ImageDescriptor WIZBAN_IMPORT_REPO
;
118 /** Connect Wizard banner */
119 public final static ImageDescriptor WIZBAN_CONNECT_REPO
;
122 * Commit Wizard banner
123 * @TODO make use of this wizban
125 public final static ImageDescriptor WIZBAN_COMMIT
;
127 /** Fetch from Gerrit Wizard banner */
128 public final static ImageDescriptor WIZBAN_FETCH_GERRIT
;
130 /** Fetch Wizard banner */
131 public final static ImageDescriptor WIZBAN_FETCH
;
135 * @TODO make use of this wizban
137 public final static ImageDescriptor WIZBAN_PULL
;
139 /** Push to Gerrit Wizard banner */
140 public final static ImageDescriptor WIZBAN_PUSH_GERRIT
;
142 /** Push Wizard banner */
143 public final static ImageDescriptor WIZBAN_PUSH
;
145 /** Synchronize Wizard banner */
146 public final static ImageDescriptor WIZBAN_SYNCHRONIZE
;
148 /** History view, show full repo history */
149 public final static ImageDescriptor FILTERNONE
;
151 /** History view, select all version in same project */
152 public final static ImageDescriptor FILTERPROJECT
;
154 /** History view, select all version in same folder */
155 public final static ImageDescriptor FILTERFOLDER
;
157 /** History view, select all version of resource */
158 public final static ImageDescriptor FILTERRESOURCE
;
161 public final static ImageDescriptor FETCH
;
164 public final static ImageDescriptor PULL
;
167 public final static ImageDescriptor PUSH
;
169 /** Collapse all button */
170 public final static ImageDescriptor COLLAPSEALL
;
172 /** Repository tree node */
173 public final static ImageDescriptor REPOSITORY
;
175 /** Gerrit Repository tree node */
176 public final static ImageDescriptor REPOSITORY_GERRIT
;
178 /** New Repository button */
179 public final static ImageDescriptor NEW_REPOSITORY
;
181 /** Create Repository button */
182 public final static ImageDescriptor CREATE_REPOSITORY
;
184 /** Remote Repository tree node */
185 public final static ImageDescriptor REMOTE_REPOSITORY
;
188 public final static ImageDescriptor RESET
;
190 /** Remote Repository tree node */
191 public final static ImageDescriptor REMOTE_SPEC
;
193 /** Branches tree node */
194 public final static ImageDescriptor BRANCHES
;
196 /** Checked-out decorator for branch */
197 public final static ImageDescriptor OVR_CHECKEDOUT
;
200 public final static ImageDescriptor TAGS
;
203 public final static ImageDescriptor TAG
;
205 /** Create Tag icon */
206 public final static ImageDescriptor CREATE_TAG
;
209 public final static ImageDescriptor BRANCH
;
211 /** Create Branch icon */
212 public final static ImageDescriptor CREATE_BRANCH
;
215 public final static ImageDescriptor CLONEGIT
;
217 /** Changeset Icon */
218 public final static ImageDescriptor CHANGESET
;
221 public final static ImageDescriptor GERRIT
;
223 /** Expand all icon */
224 public final static ImageDescriptor EXPAND_ALL
;
227 public final static ImageDescriptor CHECKOUT
;
229 /** Signed Off By icon */
230 public final static ImageDescriptor SIGNED_OFF
;
232 /** Check all icon */
233 public final static ImageDescriptor CHECK_ALL
;
235 /** Uncheck all icon */
236 public final static ImageDescriptor UNCHECK_ALL
;
238 /** Amend commit icon */
239 public final static ImageDescriptor AMEND_COMMIT
;
241 /** Untracked file icon */
242 public final static ImageDescriptor UNTRACKED_FILE
;
244 /** Commit note icon */
245 public final static ImageDescriptor NOTE
;
247 /** Show Annotation icon */
248 public final static ImageDescriptor ANNOTATE
;
251 public final static ImageDescriptor COMMIT
;
253 /** Cherry-pick icon */
254 public final static ImageDescriptor CHERRY_PICK
;
257 public final static ImageDescriptor REBASE
;
259 /** Rebase continue icon */
260 public final static ImageDescriptor REBASE_CONTINUE
;
262 /** Rebase skip icon */
263 public final static ImageDescriptor REBASE_SKIP
;
265 /** Rebase abort icon */
266 public final static ImageDescriptor REBASE_ABORT
;
268 /** Rebase process steps icon */
269 public final static ImageDescriptor REBASE_PROCESS_STEPS
;
272 public final static ImageDescriptor MERGE
;
274 /** Annotated tag icon */
275 public final static ImageDescriptor TAG_ANNOTATED
;
277 /** Submodules icon */
278 public final static ImageDescriptor SUBMODULES
;
281 public final static ImageDescriptor CLEAN
;
284 public final static ImageDescriptor STASH
;
286 /** Stash apply icon */
287 public final static ImageDescriptor STASH_APPLY
;
289 /** Stash apply icon */
290 public final static ImageDescriptor STASH_CREATE
;
292 /** History view icon */
293 public final static ImageDescriptor HISTORY
;
295 /** Search commit icon */
296 public final static ImageDescriptor SEARCH_COMMIT
;
298 /** Hierarchy layout icon */
299 public final static ImageDescriptor HIERARCHY
;
301 /** Flat presentation icon */
302 public final static ImageDescriptor FLAT
;
304 /** Compact tree presentation icon */
305 public final static ImageDescriptor COMPACT
;
307 /** Squash icon arrow up */
308 public final static ImageDescriptor SQUASH_UP
;
310 /** Squash icon arrow down */
311 public final static ImageDescriptor SQUASH_DOWN
;
313 /** Fixup icon arrow up */
314 public final static ImageDescriptor FIXUP_UP
;
316 /** Fixup icon arrow down */
317 public final static ImageDescriptor FIXUP_DOWN
;
320 public final static ImageDescriptor REVERT
;
323 public final static ImageDescriptor REWORD
;
325 /** Icon for done rebase step */
326 public final static ImageDescriptor DONE_STEP
;
328 /** Reword for current rebase step */
329 public final static ImageDescriptor CURRENT_STEP
;
331 /** Sort alphabetically icon */
332 public final static ImageDescriptor ALPHABETICALLY_SORT
;
334 /** Sort by state icon */
335 public final static ImageDescriptor STATE_SORT
;
338 public final static ImageDescriptor UNSTAGE
;
340 /** "Unstage all" icon */
341 public final static ImageDescriptor UNSTAGE_ALL
;
343 /** Assume Unchanged icon */
344 public final static ImageDescriptor ASSUME_UNCHANGED
;
347 public final static ImageDescriptor UNTRACK
;
349 /** {@link #BRANCH} overlaid with {@link #OVR_CHECKEDOUT}. */
350 public final static ImageDescriptor CHECKED_OUT_BRANCH
;
353 public final static URL base
;
357 OVR_CHECKEDOUT
= map("ovr/checkedout_ov.png"); //$NON-NLS-1$
358 OVR_STAGED
= map("ovr/staged.png"); //$NON-NLS-1$
359 OVR_STAGED_ADD
= map("ovr/staged_added.png"); //$NON-NLS-1$
360 OVR_STAGED_REMOVE
= map("ovr/staged_removed.png"); //$NON-NLS-1$
361 OVR_STAGED_RENAME
= map("ovr/staged_renamed.png"); //$NON-NLS-1$
362 OVR_UNTRACKED
= map("ovr/untracked.png"); //$NON-NLS-1$
363 OVR_CONFLICT
= map("ovr/conflict.png"); //$NON-NLS-1$
364 OVR_ASSUMEUNCHANGED
= map("ovr/assume_unchanged.png"); //$NON-NLS-1$
365 OVR_DIRTY
= map("ovr/dirty.png"); //$NON-NLS-1$
366 OVR_SYMLINK
= map("ovr/symlink_ovr.png"); //$NON-NLS-1$
367 ELCL16_FIND
= map("elcl16/find.png"); //$NON-NLS-1$
368 ELCL16_COMPARE_VIEW
= map("elcl16/compare_view.png"); //$NON-NLS-1$
369 ELCL16_NEXT
= map("elcl16/next_nav.png"); //$NON-NLS-1$
370 ELCL16_PREVIOUS
= map("elcl16/prev_nav.png"); //$NON-NLS-1$
371 WIZBAN_CREATE_PATCH
= map("wizban/createpatch_wizban.png"); //$NON-NLS-1$
372 WIZBAN_IMPORT_REPO
= map("wizban/import_wiz.png"); //$NON-NLS-1$
373 WIZBAN_CONNECT_REPO
= map("wizban/newconnect_wizban.png"); //$NON-NLS-1$
374 WIZBAN_COMMIT
= map("wizban/commit_wizban.png"); //$NON-NLS-1$
375 WIZBAN_FETCH_GERRIT
= map("wizban/fetch_gerrit_wizban.png"); //$NON-NLS-1$
376 WIZBAN_FETCH
= map("wizban/fetch_wizban.png"); //$NON-NLS-1$
377 WIZBAN_PULL
= map("wizban/pull_wizban.png"); //$NON-NLS-1$
378 WIZBAN_PUSH_GERRIT
= map("wizban/push_gerrit_wizban.png"); //$NON-NLS-1$
379 WIZBAN_PUSH
= map("wizban/push_wizban.png"); //$NON-NLS-1$
380 WIZBAN_SYNCHRONIZE
= map("wizban/synchronize_wizban.png"); //$NON-NLS-1$
381 EDITCONFIG
= map("obj16/editconfig.png"); //$NON-NLS-1$
382 ELCL16_COMMIT
= map("elcl16/commit.png"); //$NON-NLS-1$
383 ELCL16_COMMENTS
= map("elcl16/comment.png"); //$NON-NLS-1$
384 ELCL16_AUTHOR
= map("elcl16/author.png"); //$NON-NLS-1$
385 ELCL16_COMMITTER
= map("elcl16/committer.png"); //$NON-NLS-1$
386 ELCL16_DELETE
= map("elcl16/delete.png"); //$NON-NLS-1$
387 ELCL16_ADD
= map("elcl16/add.png"); //$NON-NLS-1$
388 ELCL16_ADD_ALL
= map("elcl16/add_all.png"); //$NON-NLS-1$
389 // For Photon and newer, use the new "flat look" trash icon
390 ELCL16_TRASH
= map(Platform
.getBundle("org.eclipse.ui").getVersion() //$NON-NLS-1$
391 .compareTo(Version
.valueOf("3.109.100")) >= 0 ?
//$NON-NLS-1$
392 "elcl16/trash_flat.png" : "elcl16/trash.png"); //$NON-NLS-1$ //$NON-NLS-2$
393 ELCL16_CLEAR
= map("elcl16/clear_co.png"); //$NON-NLS-1$
394 ELCL16_REFRESH
= map("elcl16/refresh.png"); //$NON-NLS-1$
395 ELCL16_SYNCED
= map("elcl16/synced.png"); //$NON-NLS-1$
396 ELCL16_FILTER
= map("elcl16/filter_ps.png"); //$NON-NLS-1$
397 ELCL16_ID
= map("elcl16/sha1.png"); //$NON-NLS-1$
398 CHECKBOX_ENABLED_CHECKED
= map("checkboxes/enabled_checked.png"); //$NON-NLS-1$
399 CHECKBOX_ENABLED_UNCHECKED
= map("checkboxes/enabled_unchecked.png"); //$NON-NLS-1$
400 CHECKBOX_DISABLED_CHECKED
= map("checkboxes/disabled_checked.png"); //$NON-NLS-1$
401 CHECKBOX_DISABLED_UNCHECKED
= map("checkboxes/disabled_unchecked.png"); //$NON-NLS-1$
402 FILTERNONE
= map("elcl16/filter_none.png"); //$NON-NLS-1$
403 FILTERRESOURCE
= map("elcl16/filterresource.png"); //$NON-NLS-1$
404 FILTERPROJECT
= map("elcl16/filterproject.png"); //$NON-NLS-1$
405 FILTERFOLDER
= map("elcl16/filterfolder.png"); //$NON-NLS-1$
406 FETCH
= map("obj16/fetch.png"); //$NON-NLS-1$
407 PUSH
= map("obj16/push.png"); //$NON-NLS-1$
408 PULL
= map("obj16/pull.png"); //$NON-NLS-1$
409 REPOSITORY
= map("obj16/repository_rep.png"); //$NON-NLS-1$
410 REPOSITORY_GERRIT
= map("obj16/repository_gerrit.png"); //$NON-NLS-1$
411 NEW_REPOSITORY
= map("etool16/newlocation_wiz.png"); //$NON-NLS-1$
412 REMOTE_REPOSITORY
= map("obj16/remote_entry_tbl.png"); //$NON-NLS-1$
413 REMOTE_SPEC
= map("obj16/synchronize.png"); //$NON-NLS-1$
414 BRANCHES
= map("obj16/branches_obj.png"); //$NON-NLS-1$
415 TAGS
= map("obj16/tags.png"); //$NON-NLS-1$
416 TAG
= map("obj16/version_rep.png"); //$NON-NLS-1$
417 CREATE_TAG
= map("obj16/new_tag_obj.png"); //$NON-NLS-1$
418 BRANCH
= map("obj16/branch_obj.png"); //$NON-NLS-1$
419 CREATE_BRANCH
= map("obj16/new_branch_obj.png"); //$NON-NLS-1$
420 COLLAPSEALL
= map("elcl16/collapseall.png"); //$NON-NLS-1$
421 CLONEGIT
= map("obj16/cloneGit.png"); //$NON-NLS-1$
422 RESET
= map("obj16/reset.png"); //$NON-NLS-1$
423 CHANGESET
= map("obj16/changelog_obj.png"); //$NON-NLS-1$
424 GERRIT
= map("obj16/gerrit_obj.png"); //$NON-NLS-1$
425 EXPAND_ALL
= map("elcl16/expandall.png"); //$NON-NLS-1$
426 CHECKOUT
= map("obj16/checkout.png"); //$NON-NLS-1$
427 SIGNED_OFF
= map("obj16/signed-off.png"); //$NON-NLS-1$
428 CHECK_ALL
= map("obj16/check_all.png"); //$NON-NLS-1$
429 UNCHECK_ALL
= map("obj16/uncheck_all.png"); //$NON-NLS-1$
430 AMEND_COMMIT
= map("obj16/commit_amend.png"); //$NON-NLS-1$
431 UNTRACKED_FILE
= map("obj16/untracked_file.png"); //$NON-NLS-1$
432 NOTE
= map("obj16/note.png"); //$NON-NLS-1$
433 ANNOTATE
= map("etool16/annotate.png"); //$NON-NLS-1$
434 COMMIT
= map("obj16/commit.png"); //$NON-NLS-1$
435 CHERRY_PICK
= map("obj16/cherry-pick.png"); //$NON-NLS-1$
436 REBASE
= map("obj16/rebase.png"); //$NON-NLS-1$
437 REBASE_CONTINUE
= map("elcl16/continue.png"); //$NON-NLS-1$
438 REBASE_SKIP
= map("elcl16/skip.png"); //$NON-NLS-1$
439 REBASE_ABORT
= map("elcl16/progress_stop.png"); //$NON-NLS-1$
440 REBASE_PROCESS_STEPS
= map("elcl16/start.png"); //$NON-NLS-1$
441 OVR_ERROR
= map("ovr/error.png"); //$NON-NLS-1$
442 MERGE
= map("obj16/merge.png"); //$NON-NLS-1$
443 TAG_ANNOTATED
= map("obj16/annotated-tag.png"); //$NON-NLS-1$
444 CREATE_REPOSITORY
= map("etool16/createRepository.png"); //$NON-NLS-1$
445 SUBMODULES
= map("obj16/submodules.png"); //$NON-NLS-1$
446 CLEAN
= map("obj16/clean_obj.png"); //$NON-NLS-1$
447 STASH
= map("obj16/stash.png"); //$NON-NLS-1$
448 STASH_APPLY
= map("obj16/stash-apply.png"); //$NON-NLS-1$
449 STASH_CREATE
= map("obj16/stash-create.png"); //$NON-NLS-1$
450 HISTORY
= map("obj16/history.png"); //$NON-NLS-1$
451 SEARCH_COMMIT
= map("obj16/search-commit.png"); //$NON-NLS-1$
452 HIERARCHY
= map("elcl16/hierarchicalLayout.png"); //$NON-NLS-1$
453 FLAT
= map("elcl16/flatLayout.png"); //$NON-NLS-1$
454 COMPACT
= map("elcl16/compactLayout.png"); //$NON-NLS-1$
455 SQUASH_UP
= map("obj16/squash-up.png"); //$NON-NLS-1$
456 SQUASH_DOWN
= map("obj16/squash-down.png"); //$NON-NLS-1$
457 FIXUP_UP
= map("obj16/fixup-up.png"); //$NON-NLS-1$
458 FIXUP_DOWN
= map("obj16/fixup-down.png"); //$NON-NLS-1$
459 REVERT
= map("obj16/revert.png"); //$NON-NLS-1$
460 REWORD
= map("obj16/reword.png"); //$NON-NLS-1$
461 DONE_STEP
= map("obj16/done_step.png"); //$NON-NLS-1$
462 CURRENT_STEP
= map("obj16/current_step.png"); //$NON-NLS-1$
463 ALPHABETICALLY_SORT
= map("obj16/alphab_sort_co.png"); //$NON-NLS-1$
464 STATE_SORT
= map("obj16/state_sort_co.png"); //$NON-NLS-1$
465 UNSTAGE
= map("obj16/unstage.png"); //$NON-NLS-1$
466 UNSTAGE_ALL
= map("elcl16/unstage_all.png"); //$NON-NLS-1$
467 ASSUME_UNCHANGED
= map("obj16/assume_unchanged.png"); //$NON-NLS-1$
468 UNTRACK
= map("obj16/untrack.png"); //$NON-NLS-1$
469 CHECKED_OUT_BRANCH
= new DecorationOverlayDescriptor(BRANCH
,
470 OVR_CHECKEDOUT
, IDecoration
.TOP_LEFT
);
473 private static ImageDescriptor
map(final String icon
) {
476 return ImageDescriptor
.createFromURL(new URL(base
, icon
));
477 } catch (MalformedURLException mux
) {
478 Activator
.logError(UIText
.UIIcons_errorLoadingPluginImage
, mux
);
481 return ImageDescriptor
.getMissingImageDescriptor();
484 private static URL
init() {
486 return new URL(Activator
.getDefault().getBundle().getEntry("/"), //$NON-NLS-1$
487 "icons/"); //$NON-NLS-1$
488 } catch (MalformedURLException mux
) {
489 Activator
.logError(UIText
.UIIcons_errorDeterminingIconBase
, mux
);
495 * Get the image for the given descriptor from the resource manager which
496 * handles disposal of the image when the resource manager itself is
499 * @param resourceManager
500 * {code ResourceManager} managing the image resources
502 * object describing an image
503 * @return the image for the given descriptor
505 public static Image
getImage(ResourceManager resourceManager
,
506 ImageDescriptor descriptor
) {
507 return (Image
) resourceManager
.get(descriptor
);