Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 245918 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rse/internal/connectorservice/dstore/Activator.java (-25 / +61 lines)
Lines 7-16 Link Here
7
 *
7
 *
8
 * Initial Contributors:
8
 * Initial Contributors:
9
 * The following IBM employees contributed to the Remote System Explorer
9
 * The following IBM employees contributed to the Remote System Explorer
10
 * component that contains this file: David McKnight, Kushal Munir, 
10
 * component that contains this file: David McKnight, Kushal Munir,
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, 
11
 * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
12
 * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
13
 * 
13
 *
14
 * Contributors:
14
 * Contributors:
15
 * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
15
 * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
16
 * David McKnight   (IBM)        - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
16
 * David McKnight   (IBM)        - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
Lines 18-32 Link Here
18
 * David McKnight   (IBM)        - [227406] [dstore] DStoreFileService must listen to buffer size preference changes
18
 * David McKnight   (IBM)        - [227406] [dstore] DStoreFileService must listen to buffer size preference changes
19
 * David McKnight   (IBM)        - [228334][api][breaking][dstore] Default DataStore connection timeout is too short
19
 * David McKnight   (IBM)        - [228334][api][breaking][dstore] Default DataStore connection timeout is too short
20
 * David McKnight   (IBM)        - [233160] [dstore] SSL/non-SSL alert are not appropriate
20
 * David McKnight   (IBM)        - [233160] [dstore] SSL/non-SSL alert are not appropriate
21
 * Martin Oberhuber (Wind River) - [245918] Allow customization of DStore Preferences
21
 *******************************************************************************/
22
 *******************************************************************************/
22
23
23
package org.eclipse.rse.internal.connectorservice.dstore;
24
package org.eclipse.rse.internal.connectorservice.dstore;
24
25
25
import org.eclipse.jface.preference.IPreferenceStore;
26
import org.eclipse.core.runtime.Platform;
27
import org.eclipse.core.runtime.preferences.DefaultScope;
28
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
26
import org.eclipse.rse.connectorservice.dstore.IUniversalDStoreConstants;
29
import org.eclipse.rse.connectorservice.dstore.IUniversalDStoreConstants;
27
import org.eclipse.rse.ui.ISystemPreferencesConstants;
30
import org.eclipse.rse.ui.ISystemPreferencesConstants;
28
import org.eclipse.rse.ui.RSEUIPlugin;
31
import org.eclipse.rse.ui.RSEUIPlugin;
29
import org.eclipse.rse.ui.SystemBasePlugin;
32
import org.eclipse.rse.ui.SystemBasePlugin;
33
import org.eclipse.ui.preferences.ScopedPreferenceStore;
30
import org.osgi.framework.BundleContext;
34
import org.osgi.framework.BundleContext;
31
35
32
/**
36
/**
Lines 36-44 Link Here
36
40
37
	//The shared instance.
41
	//The shared instance.
38
	private static Activator plugin;
42
	private static Activator plugin;
39
	
43
40
	public final static String PLUGIN_ID = "org.eclipse.rse.connectorservice.dstore"; //$NON-NLS-1$
44
	public final static String PLUGIN_ID = "org.eclipse.rse.connectorservice.dstore"; //$NON-NLS-1$
41
	
45
42
	/**
46
	/**
43
	 * The constructor.
47
	 * The constructor.
44
	 */
48
	 */
Lines 49-86 Link Here
49
	/**
53
	/**
50
	 * This method is called upon plug-in activation
54
	 * This method is called upon plug-in activation
51
	 */
55
	 */
52
	public void start(BundleContext context) throws Exception 
56
	public void start(BundleContext context) throws Exception
53
	{
57
	{
54
		super.start(context);
58
		super.start(context);
55
59
56
		initializeDefaultPreferences();
60
		initializeDefaultPreferences();
57
	}
61
	}
58
	
62
59
	
63
	/**
64
	 * A Preference Store that gives direct access to Default Preferences.
65
	 */
66
	private static class DefaultPreferenceStore extends ScopedPreferenceStore {
67
		private IEclipsePreferences[] defaultNodes;
68
		public DefaultPreferenceStore(String qualifier) {
69
			super(new DefaultScope(), qualifier);
70
			defaultNodes = new IEclipsePreferences[] {
71
				new DefaultScope().getNode(qualifier) };
72
		}
73
		public boolean hasDefault(String key) {
74
			return Platform.getPreferencesService().get(key, null, defaultNodes) != null;
75
		}
76
	}
77
60
	public void initializeDefaultPreferences() {
78
	public void initializeDefaultPreferences() {
61
		IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
79
80
		// [245918] Since our Preferences are stored in RSEUIPlugin, we cannot
81
		// use the core.runtime.preferences extension in order to do
82
		// initialization in the correct order (allow overriding by
83
		// plugin_customization.ini). We therefore explicitly check each
84
		// Preference slot, and only set a there isn't one set already. Note
85
		// that requires explicit access to the DefaultScope().
86
		// TODO move Preferences to our own PreferenceStore to simplify this
87
		DefaultPreferenceStore store = new DefaultPreferenceStore(RSEUIPlugin.getDefault().getBundle().getSymbolicName());
88
		//IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
62
		//Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
89
		//Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
63
90
64
		store.setDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_TIMEOUT, IDStoreDefaultPreferenceConstants.DEFAULT_PREF_SOCKET_TIMEOUT);	
91
		if (!store.hasDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_TIMEOUT))
65
		
92
			store.setDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_TIMEOUT, IDStoreDefaultPreferenceConstants.DEFAULT_PREF_SOCKET_TIMEOUT);
93
66
		// do keepalive
94
		// do keepalive
67
		store.setDefault(IUniversalDStoreConstants.RESID_PREF_DO_KEEPALIVE, IDStoreDefaultPreferenceConstants.DEFAULT_PREF_DO_KEEPALIVE);
95
		if (!store.hasDefault(IUniversalDStoreConstants.RESID_PREF_DO_KEEPALIVE))
68
		
96
			store.setDefault(IUniversalDStoreConstants.RESID_PREF_DO_KEEPALIVE, IDStoreDefaultPreferenceConstants.DEFAULT_PREF_DO_KEEPALIVE);
69
		// socket read timeout 
97
70
		store.setDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_READ_TIMEOUT,  IDStoreDefaultPreferenceConstants.DEFAULT_PREF_SOCKET_READ_TIMEOUT);
98
		// socket read timeout
71
		
99
		if (!store.hasDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_READ_TIMEOUT))
100
			store.setDefault(IUniversalDStoreConstants.RESID_PREF_SOCKET_READ_TIMEOUT, IDStoreDefaultPreferenceConstants.DEFAULT_PREF_SOCKET_READ_TIMEOUT);
101
72
		// keepalive response timeout
102
		// keepalive response timeout
73
		store.setDefault(IUniversalDStoreConstants.RESID_PREF_KEEPALIVE_RESPONSE_TIMEOUT,  IDStoreDefaultPreferenceConstants.DEFAULT_PREF_KEEPALIVE_RESPONSE_TIMEOUT);		
103
		if (!store.hasDefault(IUniversalDStoreConstants.RESID_PREF_KEEPALIVE_RESPONSE_TIMEOUT))
74
		
104
			store.setDefault(IUniversalDStoreConstants.RESID_PREF_KEEPALIVE_RESPONSE_TIMEOUT,
105
					IDStoreDefaultPreferenceConstants.DEFAULT_PREF_KEEPALIVE_RESPONSE_TIMEOUT);
106
75
		// show mismatched server warning
107
		// show mismatched server warning
76
		store.setDefault(IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER, IDStoreDefaultPreferenceConstants.DEFAULT_ALERT_MISMATCHED_SERVER);
108
		if (!store.hasDefault(IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER))
109
			store.setDefault(IUniversalDStoreConstants.ALERT_MISMATCHED_SERVER, IDStoreDefaultPreferenceConstants.DEFAULT_ALERT_MISMATCHED_SERVER);
77
110
78
		// cache remote classes
111
		// cache remote classes
79
		store.setDefault(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES, IDStoreDefaultPreferenceConstants.DEFAULT_PREF_CACHE_REMOTE_CLASSES);			
112
		if (!store.hasDefault(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES))
80
		
113
			store.setDefault(IUniversalDStoreConstants.RESID_PREF_CACHE_REMOTE_CLASSES, IDStoreDefaultPreferenceConstants.DEFAULT_PREF_CACHE_REMOTE_CLASSES);
114
81
		// alert defaults
115
		// alert defaults
82
		store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);		
116
		if (!store.hasDefault(ISystemPreferencesConstants.ALERT_SSL))
83
		store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
117
			store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);
118
		if (!store.hasDefault(ISystemPreferencesConstants.ALERT_NONSSL))
119
			store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
84
	}
120
	}
85
121
86
	/**
122
	/**
Lines 103-108 Link Here
103
	protected void initializeImageRegistry()
139
	protected void initializeImageRegistry()
104
	{
140
	{
105
		// TODO Auto-generated method stub
141
		// TODO Auto-generated method stub
106
		
142
107
	}
143
	}
108
}
144
}

Return to bug 245918