1 19 20 package org.netbeans.modules.websvc.core.webservices.ui.panels; 21 22 import java.util.prefs.Preferences ; 23 import org.openide.util.NbPreferences; 24 25 30 public class WebProxySetter { 31 32 private final String PROXY_HOST = "http.proxyHost"; private final String PROXY_PORT = "http.proxyPort"; 35 private static WebProxySetter defaultInstance = new WebProxySetter(); 36 37 private WebProxySetter() { 38 } 39 40 private Preferences findNode() { 41 Preferences n = NbPreferences.root ().node ("/org/netbeans/core"); 42 assert n != null; 43 return n; 44 } 45 46 public static WebProxySetter getInstance(){ 47 return defaultInstance; 48 } 49 50 51 public String getProxyHost() { 52 return findNode().get ("proxyHttpHost", ""); 53 } 54 55 56 public String getProxyPort() { 57 return findNode().get ("proxyHttpPort", ""); 58 } 59 60 61 public int getProxyType() { 62 return findNode().getInt ("proxyType", 1); 63 } 64 65 66 public void setProxyConfiguration (int proxyType, String host, String port) { 67 findNode().putInt ("proxyType", proxyType); 68 findNode().put ("proxyHttpHost", host); 69 findNode().put ("proxyHttpPort", port); 70 if (proxyType == 0) { 72 System.setProperty(PROXY_HOST, ""); System.setProperty(PROXY_PORT, ""); } else { 75 System.setProperty(PROXY_HOST, host); 76 System.setProperty(PROXY_PORT, port); 77 } 78 } 79 80 81 } 82 | Popular Tags |