0
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
package com.nokia.s60tools.appdep.ui.preferences;
|
|
19 |
|
|
20 |
import java.util.ArrayList;
|
|
21 |
import java.util.List;
|
|
22 |
|
|
23 |
import org.eclipse.jface.preference.IPreferenceStore;
|
|
24 |
|
|
25 |
import com.nokia.s60tools.appdep.plugin.AppDepPlugin;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* Helper class to use Dependency Explorer preferences. Use this class for accessing DE preferences
|
|
29 |
* instead of accessing directly through {@link org.eclipse.jface.util.IPropertyChangeListener.IPreferenceStore}.
|
|
30 |
*/
|
|
31 |
public class DEPreferences {
|
|
32 |
|
|
33 |
/**
|
|
34 |
* Get search order prefixes
|
|
35 |
* @return prefixes in order they appear in preference page, or <code>null</code> if none found.
|
|
36 |
*/
|
|
37 |
public static String[] getSearchOrderPrefixs(){
|
|
38 |
String values = AppDepPlugin.getPrefsStore().getString(DEPreferenceConstants.DE_PREFIX_SEARCH_ORDER_VALUES);
|
|
39 |
String [] prefixs = null;
|
|
40 |
if(values != null){
|
|
41 |
prefixs = values.split(DEPreferenceConstants.PREFIX_SEARCH_ORDER_SEPARATOR);
|
|
42 |
}
|
|
43 |
return prefixs;
|
|
44 |
}
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Gets search order prefixes
|
|
48 |
* @return prefixes in order they appear in preference page, or empty list if none found.
|
|
49 |
*/
|
|
50 |
public static List<String> getSearchOrderPrefixsList(){
|
|
51 |
ArrayList<String> prefixList = new ArrayList<String>();
|
|
52 |
String values = AppDepPlugin.getPrefsStore().getString(DEPreferenceConstants.DE_PREFIX_SEARCH_ORDER_VALUES);
|
|
53 |
//Adding values only if there is something to add.
|
|
54 |
if(values != null && values.trim().length() > 0){
|
|
55 |
String [] prefixs = null;
|
|
56 |
prefixs = values.split(DEPreferenceConstants.PREFIX_SEARCH_ORDER_SEPARATOR);
|
|
57 |
for (int i = 0; i < prefixs.length; i++) {
|
|
58 |
prefixList.add(prefixs[i]);
|
|
59 |
}
|
|
60 |
|
|
61 |
}
|
|
62 |
|
|
63 |
return prefixList;
|
|
64 |
}
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Gets "Don't ask again" value for Search set as new root confirmation.
|
|
68 |
* @return <code>true</code> if preference "don't ask again" is cheked, <code>false</code> otherwise.
|
|
69 |
*/
|
|
70 |
public static boolean getDontAskSetAsNewRootFromSearch(){
|
|
71 |
|
|
72 |
String value = AppDepPlugin.getPrefsStore().getString(DEPreferenceConstants.DE_DONT_ASK_SET_AS_NEW_ROOT_FROM_SEARCH);
|
|
73 |
if(value != null && value.equalsIgnoreCase(DEPreferenceConstants.TRUE)){
|
|
74 |
return true;
|
|
75 |
}else{
|
|
76 |
return false;
|
|
77 |
}
|
|
78 |
|
|
79 |
}
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Sets "Don't ask again" value for Search set as new root confirmation.
|
|
83 |
* @param isDontAskAgainChecked <code>true</code> if don't ask again is selected, <code>false</code> otherwise.
|
|
84 |
*/
|
|
85 |
public static void setDontAskAtainAsNewRootFromSearch(boolean isDontAskAgainChecked){
|
|
86 |
|
|
87 |
IPreferenceStore store = AppDepPlugin.getPrefsStore();
|
|
88 |
|
|
89 |
if(isDontAskAgainChecked){
|
|
90 |
store.setValue(DEPreferenceConstants.DE_DONT_ASK_SET_AS_NEW_ROOT_FROM_SEARCH, DEPreferenceConstants.TRUE);
|
|
91 |
}else{
|
|
92 |
store.setValue(DEPreferenceConstants.DE_DONT_ASK_SET_AS_NEW_ROOT_FROM_SEARCH, DEPreferenceConstants.FALSE);
|
|
93 |
}
|
|
94 |
}
|
|
95 |
|
|
96 |
}
|