Create the import wizard question checkbox properly
[egit/imyousuf.git] / org.spearce.egit.ui / src / org / spearce / egit / ui / UIPreferences.java
blob5ab6b25c89fd6b7d71195fd8616c5ca237dfde90
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 * Get the preference values associated with a fixed integer array.
58 * @param prefs
59 * the store to read.
60 * @param key
61 * key name.
62 * @param cnt
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,
67 final int cnt) {
68 final String s = prefs.getString(key);
69 final int[] r = new int[cnt];
70 if (s != null) {
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());
75 return r;
78 /**
79 * Set the preference values associated with a fixed integer array.
81 * @param prefs
82 * the store to read.
83 * @param key
84 * key name.
85 * @param data
86 * entries to store.
88 public static void setValue(final Preferences prefs, final String key,
89 final int[] data) {
90 final StringBuilder s = new StringBuilder();
91 for (int i = 0; i < data.length; i++) {
92 if (i > 0)
93 s.append(',');
94 s.append(data[i]);
96 prefs.setValue(key, s.toString());
99 /**
100 * Set the preference values associated with a fixed integer array.
102 * @param prefs
103 * the store to read.
104 * @param key
105 * key nam
106 * @param data
107 * entries to store.
109 public static void setDefault(final Preferences prefs, final String key,
110 final int[] data) {
111 final StringBuilder s = new StringBuilder();
112 for (int i = 0; i < data.length; i++) {
113 if (i > 0)
114 s.append(',');
115 s.append(data[i]);
117 prefs.setDefault(key, s.toString());