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 public final static String DECORATOR_CALCULATE_DIRTY
= "decorator_calculate_dirty";
58 public final static String DECORATOR_FILETEXT_DECORATION
= "decorator_filetext_decoration";
60 public final static String DECORATOR_FOLDERTEXT_DECORATION
= "decorator_foldertext_decoration";
62 public final static String DECORATOR_PROJECTTEXT_DECORATION
= "decorator_projecttext_decoration";
64 public final static String DECORATOR_SHOW_TRACKED_ICON
= "decorator_show_tracked_icon";
66 public final static String DECORATOR_SHOW_UNTRACKED_ICON
= "decorator_show_untracked_icon";
68 public final static String DECORATOR_SHOW_STAGED_ICON
= "decorator_show_staged_icon";
70 public final static String DECORATOR_SHOW_CONFLICTS_ICON
= "decorator_show_conflicts_icon";
72 public final static String DECORATOR_SHOW_ASSUME_VALID_ICON
= "decorator_show_assume_valid_icon";
75 * Get the preference values associated with a fixed integer array.
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
,
87 final String s
= prefs
.getString(key
);
88 final int[] r
= new int[cnt
];
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());
98 * Set the preference values associated with a fixed integer array.
107 public static void setValue(final Preferences prefs
, final String key
,
109 final StringBuilder s
= new StringBuilder();
110 for (int i
= 0; i
< data
.length
; i
++) {
115 prefs
.setValue(key
, s
.toString());
119 * Set the preference values associated with a fixed integer array.
128 public static void setDefault(final Preferences prefs
, final String key
,
130 final StringBuilder s
= new StringBuilder();
131 for (int i
= 0; i
< data
.length
; i
++) {
136 prefs
.setDefault(key
, s
.toString());