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
;
15 * Preferences used by the plugin.
16 * All plugin preferences shall be referenced by a constant in this class.
18 public class UIPreferences
{
20 public final static String RESOURCEHISTORY_SHOW_COMMENT_WRAP
= "resourcehistory_show_comment_wrap";
22 public static final String RESOURCEHISTORY_SHOW_COMMENT_FILL
= "resourcehistory_fill_comment_paragraph";
24 public final static String RESOURCEHISTORY_SHOW_REV_DETAIL
= "resourcehistory_show_rev_detail";
26 public final static String RESOURCEHISTORY_SHOW_REV_COMMENT
= "resourcehistory_show_rev_comment";
28 public final static String RESOURCEHISTORY_GRAPH_SPLIT
= "resourcehistory_graph_split";
30 public final static String RESOURCEHISTORY_REV_SPLIT
= "resourcehistory_rev_split";
32 public final static String RESOURCEHISTORY_SHOW_TOOLTIPS
= "resourcehistory_show_tooltips";
34 public final static String RESOURCEHISTORY_SHOW_FINDTOOLBAR
= "resourcehistory_show_findtoolbar";
36 public final static String FINDTOOLBAR_IGNORE_CASE
= "findtoolbar_ignore_case";
38 public final static String FINDTOOLBAR_COMMIT_ID
= "findtoolbar_commit_id";
40 public final static String FINDTOOLBAR_COMMENTS
= "findtoolbar_comments";
42 public final static String FINDTOOLBAR_AUTHOR
= "findtoolbar_author";
44 public final static String FINDTOOLBAR_COMMITTER
= "findtoolbar_committer";
46 public final static String FINDTOOLBAR_FIND_IN
= "findtoolbar_find_in";
49 public final static String THEME_CommitGraphNormalFont
= "org.spearce.egit.ui.CommitGraphNormalFont";
51 public final static String THEME_CommitGraphHighlightFont
= "org.spearce.egit.ui.CommitGraphHighlightFont";
53 public final static String THEME_CommitMessageFont
= "org.spearce.egit.ui.CommitMessageFont";
56 * Get the preference values associated with a fixed integer array.
63 * number of entries in the returned array.
64 * @return the preference values for the array.
66 public static int[] getIntArray(final Preferences prefs
, final String key
,
68 final String s
= prefs
.getString(key
);
69 final int[] r
= new int[cnt
];
71 final String
[] e
= s
.split(",");
72 for (int i
= 0; i
< Math
.min(e
.length
, r
.length
); i
++)
73 r
[i
] = Integer
.parseInt(e
[i
].trim());
79 * Set the preference values associated with a fixed integer array.
88 public static void setValue(final Preferences prefs
, final String key
,
90 final StringBuilder s
= new StringBuilder();
91 for (int i
= 0; i
< data
.length
; i
++) {
96 prefs
.setValue(key
, s
.toString());
100 * Set the preference values associated with a fixed integer array.
109 public static void setDefault(final Preferences prefs
, final String key
,
111 final StringBuilder s
= new StringBuilder();
112 for (int i
= 0; i
< data
.length
; i
++) {
117 prefs
.setDefault(key
, s
.toString());