Implement icon and text decorations of various resource states
[egit/torarne.git] / org.spearce.egit.ui / src / org / spearce / egit / ui / UIPreferences.java
blobe8127166e13957257406dd4e507b72130088a18f
1 /*******************************************************************************
2 * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
3 * Copyright (C) 2008, Roger C. Soares <rogersoares@intelinet.com.br>
4 * Copyright (C) 2008, 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 org.eclipse.core.runtime.Preferences;
14 /**
15 * Preferences used by the plugin.
16 * All plugin preferences shall be referenced by a constant in this class.
18 public class UIPreferences {
19 /** */
20 public final static String RESOURCEHISTORY_SHOW_COMMENT_WRAP = "resourcehistory_show_comment_wrap";
21 /** */
22 public static final String RESOURCEHISTORY_SHOW_COMMENT_FILL = "resourcehistory_fill_comment_paragraph";
23 /** */
24 public final static String RESOURCEHISTORY_SHOW_REV_DETAIL = "resourcehistory_show_rev_detail";
25 /** */
26 public final static String RESOURCEHISTORY_SHOW_REV_COMMENT = "resourcehistory_show_rev_comment";
27 /** */
28 public final static String RESOURCEHISTORY_GRAPH_SPLIT = "resourcehistory_graph_split";
29 /** */
30 public final static String RESOURCEHISTORY_REV_SPLIT = "resourcehistory_rev_split";
31 /** */
32 public final static String RESOURCEHISTORY_SHOW_TOOLTIPS = "resourcehistory_show_tooltips";
33 /** */
34 public final static String RESOURCEHISTORY_SHOW_FINDTOOLBAR = "resourcehistory_show_findtoolbar";
35 /** */
36 public final static String FINDTOOLBAR_IGNORE_CASE = "findtoolbar_ignore_case";
37 /** */
38 public final static String FINDTOOLBAR_COMMIT_ID = "findtoolbar_commit_id";
39 /** */
40 public final static String FINDTOOLBAR_COMMENTS = "findtoolbar_comments";
41 /** */
42 public final static String FINDTOOLBAR_AUTHOR = "findtoolbar_author";
43 /** */
44 public final static String FINDTOOLBAR_COMMITTER = "findtoolbar_committer";
45 /** */
46 public final static String FINDTOOLBAR_FIND_IN = "findtoolbar_find_in";
48 /** */
49 public final static String THEME_CommitGraphNormalFont = "org.spearce.egit.ui.CommitGraphNormalFont";
50 /** */
51 public final static String THEME_CommitGraphHighlightFont = "org.spearce.egit.ui.CommitGraphHighlightFont";
52 /** */
53 public final static String THEME_CommitMessageFont = "org.spearce.egit.ui.CommitMessageFont";
55 /** */
56 public final static String DECORATOR_CALCULATE_DIRTY = "decorator_calculate_dirty";
57 /** */
58 public final static String DECORATOR_FILETEXT_DECORATION = "decorator_filetext_decoration";
59 /** */
60 public final static String DECORATOR_FOLDERTEXT_DECORATION = "decorator_foldertext_decoration";
61 /** */
62 public final static String DECORATOR_PROJECTTEXT_DECORATION = "decorator_projecttext_decoration";
63 /** */
64 public final static String DECORATOR_SHOW_TRACKED_ICON = "decorator_show_tracked_icon";
65 /** */
66 public final static String DECORATOR_SHOW_UNTRACKED_ICON = "decorator_show_untracked_icon";
67 /** */
68 public final static String DECORATOR_SHOW_STAGED_ICON = "decorator_show_staged_icon";
69 /** */
70 public final static String DECORATOR_SHOW_CONFLICTS_ICON = "decorator_show_conflicts_icon";
71 /** */
72 public final static String DECORATOR_SHOW_ASSUME_VALID_ICON = "decorator_show_assume_valid_icon";
74 /**
75 * Get the preference values associated with a fixed integer array.
77 * @param prefs
78 * the store to read.
79 * @param key
80 * key name.
81 * @param cnt
82 * number of entries in the returned array.
83 * @return the preference values for the array.
85 public static int[] getIntArray(final Preferences prefs, final String key,
86 final int cnt) {
87 final String s = prefs.getString(key);
88 final int[] r = new int[cnt];
89 if (s != null) {
90 final String[] e = s.split(",");
91 for (int i = 0; i < Math.min(e.length, r.length); i++)
92 r[i] = Integer.parseInt(e[i].trim());
94 return r;
97 /**
98 * Set the preference values associated with a fixed integer array.
100 * @param prefs
101 * the store to read.
102 * @param key
103 * key name.
104 * @param data
105 * entries to store.
107 public static void setValue(final Preferences prefs, final String key,
108 final int[] data) {
109 final StringBuilder s = new StringBuilder();
110 for (int i = 0; i < data.length; i++) {
111 if (i > 0)
112 s.append(',');
113 s.append(data[i]);
115 prefs.setValue(key, s.toString());
119 * Set the preference values associated with a fixed integer array.
121 * @param prefs
122 * the store to read.
123 * @param key
124 * key nam
125 * @param data
126 * entries to store.
128 public static void setDefault(final Preferences prefs, final String key,
129 final int[] data) {
130 final StringBuilder s = new StringBuilder();
131 for (int i = 0; i < data.length; i++) {
132 if (i > 0)
133 s.append(',');
134 s.append(data[i]);
136 prefs.setDefault(key, s.toString());