Implement icon and text decorations of various resource states
[egit/torarne.git] / org.spearce.egit.ui / src / org / spearce / egit / ui / UIIcons.java
blob952816ce025bd495b829fbf31af33fbf7de2299c
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>
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of the Eclipse Public License v1.0
8 * See LICENSE for the full license text, also available.
9 *******************************************************************************/
10 package org.spearce.egit.ui;
12 import java.net.MalformedURLException;
13 import java.net.URL;
15 import org.eclipse.jface.resource.ImageDescriptor;
17 /**
18 * Icons for the the Eclipse plugin. Mostly decorations.
20 public class UIIcons {
22 /** Decoration for resource in the index but not yet committed. */
23 public static final ImageDescriptor OVR_STAGED;
25 /** Decoration for resource added to index but not yet committed. */
26 public static final ImageDescriptor OVR_STAGED_ADD;
28 /** Decoration for resource removed from the index but not commit. */
29 public static final ImageDescriptor OVR_STAGED_REMOVE;
31 /** Decoration for resource not being tracked by Git */
32 public static final ImageDescriptor OVR_UNTRACKED;
34 /** Decoration for tracked resource with a merge conflict. */
35 public static final ImageDescriptor OVR_CONFLICT;
37 /** Decoration for tracked resources that we want to ignore changes in. */
38 public static final ImageDescriptor OVR_ASSUMEVALID;
40 /** Find icon */
41 public static final ImageDescriptor ELCL16_FIND;
42 /** Next arrow icon */
43 public static final ImageDescriptor ELCL16_NEXT;
44 /** Previous arrow icon */
45 public static final ImageDescriptor ELCL16_PREVIOUS;
46 /** Commit icon */
47 public static final ImageDescriptor ELCL16_COMMIT;
48 /** Comments icon */
49 public static final ImageDescriptor ELCL16_COMMENTS;
50 /** Author icon */
51 public static final ImageDescriptor ELCL16_AUTHOR;
52 /** Committer icon */
53 public static final ImageDescriptor ELCL16_COMMITTER;
54 /** Delete icon */
55 public static final ImageDescriptor ELCL16_DELETE;
56 /** Add icon */
57 public static final ImageDescriptor ELCL16_ADD;
58 /** Trash icon */
59 public static final ImageDescriptor ELCL16_TRASH;
60 /** Clear icon */
61 public static final ImageDescriptor ELCL16_CLEAR;
63 /** Enabled, checked, checkbox image */
64 public static final ImageDescriptor CHECKBOX_ENABLED_CHECKED;
65 /** Enabled, unchecked, checkbox image */
66 public static final ImageDescriptor CHECKBOX_ENABLED_UNCHECKED;
67 /** Disabled, checked, checkbox image */
68 public static final ImageDescriptor CHECKBOX_DISABLED_CHECKED;
69 /** Disabled, unchecked, checkbox image */
70 public static final ImageDescriptor CHECKBOX_DISABLED_UNCHECKED;
72 /** Import Wizard banner */
73 public static final ImageDescriptor WIZBAN_IMPORT_REPO;
75 /** Connect Wizard banner */
76 public static final ImageDescriptor WIZBAN_CONNECT_REPO;
78 /** History filter, select all version in repo */
79 public static ImageDescriptor FILTERREPO;
81 /** History filter, select all version in same project */
82 public static ImageDescriptor FILTERPROJECT;
84 /** History filter, select all version in same folder */
85 public static ImageDescriptor FILTERFOLDER;
87 private static final URL base;
89 static {
90 base = init();
91 OVR_STAGED = map("ovr/staged.gif");
92 OVR_STAGED_ADD = map("ovr/staged_added.gif");
93 OVR_STAGED_REMOVE = map("ovr/staged_removed.gif");
94 OVR_UNTRACKED = map("ovr/untracked.gif");
95 OVR_CONFLICT = map("ovr/conflict.gif");
96 OVR_ASSUMEVALID = map("ovr/assume_valid.gif");
97 ELCL16_FIND = map("elcl16/find.gif");
98 ELCL16_NEXT = map("elcl16/next.gif");
99 ELCL16_PREVIOUS = map("elcl16/previous.gif");
100 WIZBAN_IMPORT_REPO = map("wizban/import_wiz.png");
101 WIZBAN_CONNECT_REPO = map("wizban/newconnect_wizban.png");
102 ELCL16_COMMIT = map("elcl16/commit.gif");
103 ELCL16_COMMENTS = map("elcl16/comment.gif");
104 ELCL16_AUTHOR = map("elcl16/author.gif");
105 ELCL16_COMMITTER = map("elcl16/committer.gif");
106 ELCL16_DELETE = map("elcl16/delete.gif");
107 ELCL16_ADD = map("elcl16/add.gif");
108 ELCL16_TRASH = map("elcl16/trash.gif");
109 ELCL16_CLEAR = map("elcl16/clear.gif");
110 CHECKBOX_ENABLED_CHECKED = map("checkboxes/enabled_checked.gif");
111 CHECKBOX_ENABLED_UNCHECKED = map("checkboxes/enabled_unchecked.gif");
112 CHECKBOX_DISABLED_CHECKED = map("checkboxes/disabled_checked.gif");
113 CHECKBOX_DISABLED_UNCHECKED = map("checkboxes/disabled_unchecked.gif");
114 FILTERREPO = map("elcl16/filterrepo.gif");
115 FILTERPROJECT = map("elcl16/filterproject.gif");
116 FILTERFOLDER = map("elcl16/filterfolder.gif");
119 private static ImageDescriptor map(final String icon) {
120 if (base != null) {
121 try {
122 return ImageDescriptor.createFromURL(new URL(base, icon));
123 } catch (MalformedURLException mux) {
124 Activator.logError("Can't load plugin image.", mux);
127 return ImageDescriptor.getMissingImageDescriptor();
130 private static URL init() {
131 try {
132 return new URL(Activator.getDefault().getBundle().getEntry("/"),
133 "icons/");
134 } catch (MalformedURLException mux) {
135 Activator.logError("Can't determine icon base.", mux);
136 return null;