KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jsch > internal > core > PreferenceInitializer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * Atsuhiko Yamanaka, JCraft,Inc. - initial API and implementation.
10  * IBM Corporation - ongoing maintenance
11  *******************************************************************************/

12 package org.eclipse.jsch.internal.core;
13
14 import org.eclipse.core.runtime.Platform;
15 import org.eclipse.core.runtime.preferences.*;
16
17 public class PreferenceInitializer extends AbstractPreferenceInitializer{
18
19   public static String JavaDoc SSH_HOME_DEFAULT=null;
20   static{
21     String JavaDoc ssh_dir_name=".ssh"; //$NON-NLS-1$
22

23     // Windows doesn't like files or directories starting with a dot.
24
if(Platform.getOS().equals(Platform.OS_WIN32)){
25       ssh_dir_name="ssh"; //$NON-NLS-1$
26
}
27     SSH_HOME_DEFAULT=System.getProperty("user.home"); //$NON-NLS-1$
28
if(SSH_HOME_DEFAULT!=null){
29       SSH_HOME_DEFAULT=SSH_HOME_DEFAULT+java.io.File.separator+ssh_dir_name;
30     }
31   }
32   
33   public void initializeDefaultPreferences(){
34     IEclipsePreferences defaultNode=new DefaultScope().getNode(JSchCorePlugin.ID);
35     defaultNode.put(IConstants.KEY_SSH2HOME, SSH_HOME_DEFAULT);
36     defaultNode.put(IConstants.KEY_PRIVATEKEY, IConstants.PRIVATE_KEYS_DEFAULT);
37     Utils.migrateSSH2Preferences();
38   }
39
40 }
41
Popular Tags