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 * which accompanies this distribution, and is available at
9 * http://www.eclipse.org/legal/epl-v10.html
10 *******************************************************************************/
11 package org
.eclipse
.egit
.ui
;
13 import org
.eclipse
.core
.runtime
.Preferences
;
16 * Preferences used by the plugin.
17 * All plugin preferences shall be referenced by a constant in this class.
19 public class UIPreferences
{
21 public final static String RESOURCEHISTORY_SHOW_COMMENT_WRAP
= "resourcehistory_show_comment_wrap"; //$NON-NLS-1$
23 public static final String RESOURCEHISTORY_SHOW_COMMENT_FILL
= "resourcehistory_fill_comment_paragraph"; //$NON-NLS-1$
25 public final static String RESOURCEHISTORY_SHOW_REV_DETAIL
= "resourcehistory_show_rev_detail"; //$NON-NLS-1$
27 public final static String RESOURCEHISTORY_SHOW_REV_COMMENT
= "resourcehistory_show_rev_comment"; //$NON-NLS-1$
29 public final static String RESOURCEHISTORY_GRAPH_SPLIT
= "resourcehistory_graph_split"; //$NON-NLS-1$
31 public final static String RESOURCEHISTORY_REV_SPLIT
= "resourcehistory_rev_split"; //$NON-NLS-1$
33 public final static String RESOURCEHISTORY_SHOW_TOOLTIPS
= "resourcehistory_show_tooltips"; //$NON-NLS-1$
35 public final static String RESOURCEHISTORY_SHOW_FINDTOOLBAR
= "resourcehistory_show_findtoolbar"; //$NON-NLS-1$
37 public final static String FINDTOOLBAR_IGNORE_CASE
= "findtoolbar_ignore_case"; //$NON-NLS-1$
39 public final static String FINDTOOLBAR_COMMIT_ID
= "findtoolbar_commit_id"; //$NON-NLS-1$
41 public final static String FINDTOOLBAR_COMMENTS
= "findtoolbar_comments"; //$NON-NLS-1$
43 public final static String FINDTOOLBAR_AUTHOR
= "findtoolbar_author"; //$NON-NLS-1$
45 public final static String FINDTOOLBAR_COMMITTER
= "findtoolbar_committer"; //$NON-NLS-1$
47 public final static String FINDTOOLBAR_FIND_IN
= "findtoolbar_find_in"; //$NON-NLS-1$
50 public final static String THEME_CommitGraphNormalFont
= "org.eclipse.egit.ui.CommitGraphNormalFont"; //$NON-NLS-1$
52 public final static String THEME_CommitGraphHighlightFont
= "org.eclipse.egit.ui.CommitGraphHighlightFont"; //$NON-NLS-1$
54 public final static String THEME_CommitMessageFont
= "org.eclipse.egit.ui.CommitMessageFont"; //$NON-NLS-1$
56 public final static String THEME_UncommittedChangeForegroundColor
= "org.eclipse.egit.ui.UncommittedChangeForegroundColor"; //$NON-NLS-1$
58 public final static String THEME_UncommittedChangeBackgroundColor
= "org.eclipse.egit.ui.UncommittedChangeBackgroundColor"; //$NON-NLS-1$
60 public final static String THEME_UncommittedChangeFont
= "org.eclipse.egit.ui.UncommittedChangeFont"; //$NON-NLS-1$
63 public final static String DECORATOR_RECOMPUTE_ANCESTORS
= "decorator_recompute_ancestors"; //$NON-NLS-1$
65 public final static String DECORATOR_RECURSIVE_LIMIT
= "decorator_recursive_limit"; //$NON-NLS-1$
67 public final static String DECORATOR_FILETEXT_DECORATION
= "decorator_filetext_decoration"; //$NON-NLS-1$
69 public final static String DECORATOR_FOLDERTEXT_DECORATION
= "decorator_foldertext_decoration"; //$NON-NLS-1$
71 public final static String DECORATOR_PROJECTTEXT_DECORATION
= "decorator_projecttext_decoration"; //$NON-NLS-1$
73 public final static String DECORATOR_SHOW_TRACKED_ICON
= "decorator_show_tracked_icon"; //$NON-NLS-1$
75 public final static String DECORATOR_SHOW_UNTRACKED_ICON
= "decorator_show_untracked_icon"; //$NON-NLS-1$
77 public final static String DECORATOR_SHOW_STAGED_ICON
= "decorator_show_staged_icon"; //$NON-NLS-1$
79 public final static String DECORATOR_SHOW_CONFLICTS_ICON
= "decorator_show_conflicts_icon"; //$NON-NLS-1$
81 public final static String DECORATOR_SHOW_ASSUME_VALID_ICON
= "decorator_show_assume_valid_icon"; //$NON-NLS-1$
84 * Get the preference values associated with a fixed integer array.
91 * number of entries in the returned array.
92 * @return the preference values for the array.
94 public static int[] getIntArray(final Preferences prefs
, final String key
,
96 final String s
= prefs
.getString(key
);
97 final int[] r
= new int[cnt
];
99 final String
[] e
= s
.split(","); //$NON-NLS-1$
100 for (int i
= 0; i
< Math
.min(e
.length
, r
.length
); i
++)
101 r
[i
] = Integer
.parseInt(e
[i
].trim());
107 * Set the preference values associated with a fixed integer array.
116 public static void setValue(final Preferences prefs
, final String key
,
118 final StringBuilder s
= new StringBuilder();
119 for (int i
= 0; i
< data
.length
; i
++) {
124 prefs
.setValue(key
, s
.toString());
128 * Set the preference values associated with a fixed integer array.
137 public static void setDefault(final Preferences prefs
, final String key
,
139 final StringBuilder s
= new StringBuilder();
140 for (int i
= 0; i
< data
.length
; i
++) {
145 prefs
.setDefault(key
, s
.toString());