This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 13702
Collapse All | Expand All

(-)core/src/org/netbeans/core/Bundle.properties (+2 lines)
Lines 55-60 Link Here
55
HINT_UI_Mode=UI Mode
55
HINT_UI_Mode=UI Mode
56
PROP_ignoredFiles=Ignored Files
56
PROP_ignoredFiles=Ignored Files
57
HINT_ignoredFiles=Regular expression of files to ignore. Match whole name, no path. Blank for none.
57
HINT_ignoredFiles=Regular expression of files to ignore. Match whole name, no path. Blank for none.
58
PROP_NON_PROXY_HOSTS=Non Proxy Hosts
59
HINT_NON_PROXY_HOSTS=Ignore Hosts List
58
60
59
CTL_NO_PROXY=No Proxy
61
CTL_NO_PROXY=No Proxy
60
CTL_SYSTEM_PROXY=Use System Proxy Settings
62
CTL_SYSTEM_PROXY=Use System Proxy Settings
(-)core/src/org/netbeans/core/IDESettings.java (-21 / +52 lines)
Lines 7-13 Link Here
7
 * http://www.sun.com/
7
 * http://www.sun.com/
8
 * 
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
11
 * Microsystems, Inc. All Rights Reserved.
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
12
 */
13
13
Lines 70-75 Link Here
70
    public static final String PROP_WWWBROWSER = "WWWBrowser"; // NOI18N
70
    public static final String PROP_WWWBROWSER = "WWWBrowser"; // NOI18N
71
    /** UI Mode */
71
    /** UI Mode */
72
    public static final String PROP_UIMODE = "UIMode"; // NOI18N
72
    public static final String PROP_UIMODE = "UIMode"; // NOI18N
73
     /** Non Proxy Hosts */
74
    public static final String PROP_NON_PROXY_HOSTS = "userNonProxy"; // NOI18N
73
75
74
    /** files that should be ignored 
76
    /** files that should be ignored 
75
     * 
77
     * 
Lines 121-126 Link Here
121
    private static int proxyType = -1; // not initialized
123
    private static int proxyType = -1; // not initialized
122
    private static String userProxyHost = System.getProperty(KEY_PROXY_HOST, "");
124
    private static String userProxyHost = System.getProperty(KEY_PROXY_HOST, "");
123
    private static String userProxyPort = System.getProperty(KEY_PROXY_PORT, "");
125
    private static String userProxyPort = System.getProperty(KEY_PROXY_PORT, "");
126
    private static String userNonProxyHosts;
127
    private static String defaultNonProxyHosts;
124
    
128
    
125
    private static int uiMode = 2; // MDI default
129
    private static int uiMode = 2; // MDI default
126
    
130
    
Lines 133-146 Link Here
133
    protected void initialize () {
137
    protected void initialize () {
134
        // Set default values of properties        
138
        // Set default values of properties        
135
        super.initialize ();
139
        super.initialize ();
136
        setProxy();
140
        this.defaultNonProxyHosts = getDefaultNonProxyHosts ();
141
        this.userNonProxyHosts = this.defaultNonProxyHosts;
142
        setProxy ();
137
        putProperty(PROP_WWWBROWSER, "", false);
143
        putProperty(PROP_WWWBROWSER, "", false);
138
    }
144
    }
139
145
140
    private void setProxy() {
146
    private void setProxy() {
141
        String host = getProxyHost ();
147
        String host = getProxyHost ();
142
        String port = getProxyPort();
148
        String port = getProxyPort();
143
        String nonProxyHosts = getDefaultNonProxyHosts();
149
        String nonProxyHosts = getNonProxyHosts ();
144
        System.setProperty (KEY_PROXY_HOST, host);
150
        System.setProperty (KEY_PROXY_HOST, host);
145
        System.setProperty (KEY_PROXY_PORT, port);
151
        System.setProperty (KEY_PROXY_PORT, port);
146
        System.setProperty (KEY_NON_PROXY_HOSTS, nonProxyHosts);
152
        System.setProperty (KEY_NON_PROXY_HOSTS, nonProxyHosts);
Lines 362-367 Link Here
362
        return null;
368
        return null;
363
    }
369
    }
364
    
370
    
371
    public void setUserNonProxyHosts (String value) {
372
        value = value == null ? "" : value;
373
        if (!value.equals (this.userNonProxyHosts)) {
374
            System.setProperty (KEY_NON_PROXY_HOSTS, value);
375
            System.setProperty (KEY_HTTPS_NON_PROXY_HOSTS, value);
376
            firePropertyChange (KEY_NON_PROXY_HOSTS, this.userNonProxyHosts, value);
377
            this.userNonProxyHosts = value;
378
        }
379
    }
380
    
381
    public String getUserNonProxyHosts () {
382
        return this.userNonProxyHosts;
383
    }
384
    
365
    public void readOldProxyHost (String value) {
385
    public void readOldProxyHost (String value) {
366
        setUserProxyHost (value);
386
        setUserProxyHost (value);
367
    }
387
    }
Lines 376-390 Link Here
376
     */
396
     */
377
    public void setProxyHost (String value) {
397
    public void setProxyHost (String value) {
378
        value = value == null ? "" : value;
398
        value = value == null ? "" : value;
379
        if (MANUAL_SET_PROXY == getProxyType ()) {
399
        assert MANUAL_SET_PROXY == getProxyType () : "Don't set proxy host if proxy type " + getProxyType ();
380
            if (!getUserProxyHost().equals (value)) {
400
        if (!getUserProxyHost().equals (value)) {
381
                String oldHost = getUserProxyHost ();
401
            String oldHost = getUserProxyHost ();
382
                setUserProxyHost (value);
402
            setUserProxyHost (value);
383
                System.setProperty (KEY_PROXY_HOST, value);
403
            System.setProperty (KEY_PROXY_HOST, value);
384
                System.setProperty (KEY_HTTPS_PROXY_HOST, value);
404
            System.setProperty (KEY_HTTPS_PROXY_HOST, value);
385
            }
386
        }
405
        }
387
        assert false : "Don't set proxy host if proxy type " + getProxyType ();
388
    }
406
    }
389
407
390
    /**
408
    /**
Lines 412-426 Link Here
412
     */
430
     */
413
    public void setProxyPort (String value) {
431
    public void setProxyPort (String value) {
414
        value = value == null ? "" : value;
432
        value = value == null ? "" : value;
415
        if (MANUAL_SET_PROXY == getProxyType ()) {
433
        assert MANUAL_SET_PROXY == getProxyType () : "Don't set proxy port if proxy type " + getProxyType ();
416
            if (!getUserProxyPort ().equals (value)) {
434
        if (!getUserProxyPort ().equals (value)) {
417
                String oldPort = getUserProxyPort ();
435
            String oldPort = getUserProxyPort ();
418
                setUserProxyPort (value);
436
            setUserProxyPort (value);
419
                System.setProperty (KEY_PROXY_PORT, getProxyPort ());
437
            System.setProperty (KEY_PROXY_PORT, getProxyPort ());
420
                System.setProperty (KEY_HTTPS_PROXY_PORT, getProxyPort ());
438
            System.setProperty (KEY_HTTPS_PROXY_PORT, getProxyPort ());
421
            }
422
        }
439
        }
423
        assert false : "Don't set proxy port if proxy type " + getProxyType ();
424
    }
440
    }
425
441
426
    /** Getter for showing file extensions.
442
    /** Getter for showing file extensions.
Lines 551-558 Link Here
551
     *  PENDING: should be a user settable property
567
     *  PENDING: should be a user settable property
552
     * @return sensible default for non-proxy hosts, including 'localhost'
568
     * @return sensible default for non-proxy hosts, including 'localhost'
553
     */
569
     */
554
    private String getDefaultNonProxyHosts() {
570
    private static String getDefaultNonProxyHosts() {
555
        String nonProxy = "localhost|127.0.0.1"; // NOI18N
571
        String userPreset = System.getProperty (KEY_NON_PROXY_HOSTS);
572
        String nonProxy = (userPreset == null ? "" : userPreset + "|") + "localhost|127.0.0.1"; // NOI18N
556
        String localhost = ""; // NOI18N
573
        String localhost = ""; // NOI18N
557
        try {
574
        try {
558
            localhost = InetAddress.getLocalHost().getHostName();
575
            localhost = InetAddress.getLocalHost().getHostName();
Lines 637-642 Link Here
637
        }
654
        }
638
655
639
        return systemProxy.substring (i+1);
656
        return systemProxy.substring (i+1);
657
    }
658
659
    public String getNonProxyHosts () {
660
        switch (getProxyType ()) {
661
            case AUTO_DETECT_PROXY :
662
                return this.defaultNonProxyHosts;
663
            case MANUAL_SET_PROXY :
664
                return getUserNonProxyHosts ();
665
            case DIRECT_CONNECTION :
666
                return ""; // NOI18N
667
        }
668
        
669
        assert false : "Unknown proxy type " + getProxyType ();
670
        return null;
640
    }
671
    }
641
    
672
    
642
}
673
}
(-)core/src/org/netbeans/core/IDESettingsBeanInfo.java (+6 lines)
Lines 63-68 Link Here
63
                                               null, "readOldProxyHost"), // NOI18N
63
                                               null, "readOldProxyHost"), // NOI18N
64
                       new PropertyDescriptor ("proxyPort", IDESettings.class,
64
                       new PropertyDescriptor ("proxyPort", IDESettings.class,
65
                                               null, "readOldProxyPort"), // NOI18N
65
                                               null, "readOldProxyPort"), // NOI18N
66
                       // need to store nonProxyHosts
67
                       new PropertyDescriptor (IDESettings.PROP_NON_PROXY_HOSTS, IDESettings.class,
68
                                               "getUserNonProxyHosts", "setUserNonProxyHosts"), // NOI18N
66
                   };
69
                   };
67
70
68
            desc[0].setDisplayName (NbBundle.getMessage (IDESettingsBeanInfo.class, "PROP_CONFIRM_DELETE"));
71
            desc[0].setDisplayName (NbBundle.getMessage (IDESettingsBeanInfo.class, "PROP_CONFIRM_DELETE"));
Lines 103-108 Link Here
103
            
106
            
104
            desc[12].setHidden (true);
107
            desc[12].setHidden (true);
105
            desc[13].setHidden (true);
108
            desc[13].setHidden (true);
109
            
110
            desc[14].setDisplayName (NbBundle.getMessage (IDESettingsBeanInfo.class, "PROP_NON_PROXY_HOSTS"));
111
            desc[14].setShortDescription (NbBundle.getMessage (IDESettingsBeanInfo.class,"HINT_NON_PROXY_HOSTS"));            
106
            
112
            
107
            return desc;
113
            return desc;
108
        } catch (IntrospectionException ex) {
114
        } catch (IntrospectionException ex) {
(-)core/test/unit/src/org/netbeans/core/HttpSettingsTest.java (-1 / +40 lines)
Lines 7-18 Link Here
7
 * http://www.sun.com/
7
 * http://www.sun.com/
8
 *
8
 *
9
 * The Original Code is NetBeans. The Initial Developer of the Original
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
11
 * Microsystems, Inc. All Rights Reserved.
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
12
 */
13
13
14
package org.netbeans.core;
14
package org.netbeans.core;
15
15
16
import com.sun.xml.bind.v2.model.runtime.RuntimeElement;
16
import org.netbeans.junit.*;
17
import org.netbeans.junit.*;
17
import junit.textui.TestRunner;
18
import junit.textui.TestRunner;
18
import org.openide.util.io.NbMarshalledObject;
19
import org.openide.util.io.NbMarshalledObject;
Lines 40-46 Link Here
40
    protected void setUp () throws Exception {
41
    protected void setUp () throws Exception {
41
        super.setUp ();
42
        super.setUp ();
42
        System.setProperty ("netbeans.system_http_proxy", SYSTEM_PROXY_HOST + ":" + SYSTEM_PROXY_PORT);
43
        System.setProperty ("netbeans.system_http_proxy", SYSTEM_PROXY_HOST + ":" + SYSTEM_PROXY_PORT);
44
        System.setProperty ("http.nonProxyHosts", "*.netbeans.org");
43
        settings = (IDESettings)IDESettings.findObject(IDESettings.class, true);
45
        settings = (IDESettings)IDESettings.findObject(IDESettings.class, true);
46
        settings.initialize ();
44
        settings.setUserProxyHost (USER_PROXY_HOST);
47
        settings.setUserProxyHost (USER_PROXY_HOST);
45
        settings.setUserProxyPort (USER_PROXY_PORT);
48
        settings.setUserProxyPort (USER_PROXY_PORT);
46
    }
49
    }
Lines 76-84 Link Here
76
        assertEquals ("Original user proxy port returned from deserialized IDESettings", USER_PROXY_PORT, deserializedSettings.getProxyPort ());
79
        assertEquals ("Original user proxy port returned from deserialized IDESettings", USER_PROXY_PORT, deserializedSettings.getProxyPort ());
77
        deserializedSettings.setUserProxyHost ("new.cache");
80
        deserializedSettings.setUserProxyHost ("new.cache");
78
        deserializedSettings.setUserProxyPort ("80");
81
        deserializedSettings.setUserProxyPort ("80");
82
        deserializedSettings.setUserNonProxyHosts ("*.mydomain.org");
79
        IDESettings againDeserializedSettings = (IDESettings) new NbMarshalledObject (deserializedSettings).get ();
83
        IDESettings againDeserializedSettings = (IDESettings) new NbMarshalledObject (deserializedSettings).get ();
80
        assertEquals ("New user proxy host returned from deserialized IDESettings after change", "new.cache", againDeserializedSettings.getProxyHost ());
84
        assertEquals ("New user proxy host returned from deserialized IDESettings after change", "new.cache", againDeserializedSettings.getProxyHost ());
81
        assertEquals ("New user proxy port returned from deserialized IDESettings after change", "80", againDeserializedSettings.getProxyPort ());
85
        assertEquals ("New user proxy port returned from deserialized IDESettings after change", "80", againDeserializedSettings.getProxyPort ());
86
        assertEquals ("New user non proxy hosts returned from deserialized IDESettings after change", "*.mydomain.org", againDeserializedSettings.getNonProxyHosts ());
87
    }
88
    
89
    public void testIfTakeUpNonProxyFromProperty () {
90
        assertTrue ("*.netbeans.org in among not Http Proxy Hosts.", settings.getNonProxyHosts ().indexOf ("*.netbeans.org") != -1);
91
    }
92
    
93
    public void testNonProxy () {
94
        assertEquals ("The IDESettings takes as same value as System properties in initial.", System.getProperty ("http.nonProxyHosts"), settings.getNonProxyHosts ());
95
        
96
        // change value in IDESettings
97
        settings.setProxyType (IDESettings.MANUAL_SET_PROXY);
98
        settings.setUserNonProxyHosts ("myhost.mydomain.net");
99
        assertEquals ("IDESettings returns new value.", "myhost.mydomain.net", settings.getNonProxyHosts ());
100
        assertEquals ("System property http.nonProxyHosts was changed as well.", settings.getNonProxyHosts (), System.getProperty ("http.nonProxyHosts"));
101
        
102
        // switch proxy type to DIRECT_CONNECTION
103
        settings.setProxyType (IDESettings.DIRECT_CONNECTION);
104
        assertFalse ("IDESettings doesn't return new value if DIRECT_CONNECTION set.", "myhost.mydomain.net".equals (settings.getNonProxyHosts ()));
105
        assertEquals ("System property http.nonProxyHosts was changed as well.", settings.getNonProxyHosts (), System.getProperty ("http.nonProxyHosts"));
106
        
107
        // switch proxy type back to MANUAL_SET_PROXY
108
        settings.setProxyType (IDESettings.MANUAL_SET_PROXY);
109
        assertEquals ("IDESettings again returns new value.", "myhost.mydomain.net", settings.getNonProxyHosts ());
110
        assertEquals ("System property http.nonProxyHosts was changed as well.", settings.getNonProxyHosts (), System.getProperty ("http.nonProxyHosts"));
111
        
112
        // switch proxy type to AUTO_DETECT_PROXY
113
        settings.setProxyType (IDESettings.AUTO_DETECT_PROXY);
114
        assertFalse ("IDESettings doesn't return new value if AUTO_DETECT_PROXY set.", "myhost.mydomain.net".equals (settings.getNonProxyHosts ()));
115
        assertEquals ("System property http.nonProxyHosts was changed as well.", settings.getNonProxyHosts (), System.getProperty ("http.nonProxyHosts"));
116
                
117
        // switch proxy type back to MANUAL_SET_PROXY
118
        settings.setProxyType (IDESettings.MANUAL_SET_PROXY);
119
        assertEquals ("IDESettings again returns new value.", "myhost.mydomain.net", settings.getNonProxyHosts ());
120
        assertEquals ("System property http.nonProxyHosts was changed as well.", settings.getNonProxyHosts (), System.getProperty ("http.nonProxyHosts"));
82
    }
121
    }
83
    
122
    
84
}
123
}
(-)editor/options/src/org/netbeans/modules/options/general/Bundle.properties (-2 / +6 lines)
Lines 6-12 Link Here
6
# http://www.sun.com/
6
# http://www.sun.com/
7
# 
7
# 
8
# The Original Code is NetBeans. The Initial Developer of the Original
8
# The Original Code is NetBeans. The Initial Developer of the Original
9
# Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun
9
# Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
10
# Microsystems, Inc. All Rights Reserved.
10
# Microsystems, Inc. All Rights Reserved.
11
11
12
12
Lines 37-42 Link Here
37
AD_Host=Host
37
AD_Host=Host
38
AN_Port=Port
38
AN_Port=Port
39
AD_Port=Port
39
AD_Port=Port
40
AN_NonProxy=No Proxy For
41
AD_NonProxy=No Proxy For
40
AN_Update_Period=Update Period
42
AN_Update_Period=Update Period
41
AD_Update_Period=Update Period
43
AD_Update_Period=Update Period
42
AN_Ask_Before_Check=Ask Before Check
44
AN_Ask_Before_Check=Ask Before Check
Lines 58-65 Link Here
58
Confirm_Delete=&Confirm Delete:
60
Confirm_Delete=&Confirm Delete:
59
Web_Proxy=Web Proxy:
61
Web_Proxy=Web Proxy:
60
Proxy_Settings=Proxy
62
Proxy_Settings=Proxy
61
Proxy_Port=P&roxy Port:
63
Proxy_Port=Po&rt:
62
Proxy_Host=Pro&xy Host:
64
Proxy_Host=Pro&xy Host:
65
Non_Proxy=No Prox&y For:
66
Non_Proxy_Hint=(e.g. localhost, .netbeans.org, .mydomain.com)
63
Code_Folding=Code Folding:
67
Code_Folding=Code Folding:
64
Show=Show:
68
Show=Show:
65
Editor=Editor
69
Editor=Editor
(-)editor/options/src/org/netbeans/modules/options/general/GeneralOptionsModel.java (-1 / +21 lines)
Lines 7-13 Link Here
7
 * http://www.sun.com/
7
 * http://www.sun.com/
8
 * 
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
11
 * Microsystems, Inc. All Rights Reserved.
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
12
 */
13
13
Lines 84-89 Link Here
84
        ideSettings.setUserProxyPort ("" + proxyPort);
84
        ideSettings.setUserProxyPort ("" + proxyPort);
85
    }
85
    }
86
    
86
    
87
    String getUserNonProxy () {
88
        IDESettings ideSettings = (IDESettings) IDESettings.findObject 
89
            (IDESettings.class, true);
90
        return code2view (ideSettings.getUserNonProxyHosts ());
91
    }
92
    
93
    void setUserNonProxy (String nonProxy) {
94
        IDESettings ideSettings = (IDESettings) IDESettings.findObject 
95
            (IDESettings.class, true);
96
        ideSettings.setUserNonProxyHosts (view2code (nonProxy));
97
    }
98
    
87
    boolean getAutoUpdateAskBeforeCheck () {
99
    boolean getAutoUpdateAskBeforeCheck () {
88
        Settings settings = (Settings) Settings.findObject 
100
        Settings settings = (Settings) Settings.findObject 
89
            (Settings.class, true);
101
            (Settings.class, true);
Lines 203-208 Link Here
203
                return baseOptions;
215
                return baseOptions;
204
        }
216
        }
205
        return null;
217
        return null;
218
    }
219
    
220
    private static String code2view (String code) {
221
        return code == null ? code : code.replace ("|", ", ");
222
    }
223
    
224
    private static String view2code (String view) {
225
        return view == null ? view : view.replace (", ", "|");
206
    }
226
    }
207
}
227
}
208
228
(-)editor/options/src/org/netbeans/modules/options/general/GeneralOptionsPanel.java (-23 / +40 lines)
Lines 7-13 Link Here
7
 * http://www.sun.com/
7
 * http://www.sun.com/
8
 * 
8
 * 
9
 * The Original Code is NetBeans. The Initial Developer of the Original
9
 * The Original Code is NetBeans. The Initial Developer of the Original
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
10
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
11
 * Microsystems, Inc. All Rights Reserved.
11
 * Microsystems, Inc. All Rights Reserved.
12
 */
12
 */
13
13
Lines 67-72 Link Here
67
    private JRadioButton    rbHTTPProxy = new JRadioButton ();
67
    private JRadioButton    rbHTTPProxy = new JRadioButton ();
68
    private JTextField      tfHost = new JTextField (); 
68
    private JTextField      tfHost = new JTextField (); 
69
    private JTextField      tfPort = new JTextField (); 
69
    private JTextField      tfPort = new JTextField (); 
70
    private JTextField      tfNonProxy = new JTextField (); 
70
    private JComboBox       cbUpdatePeriod = new JComboBox (new String [] {
71
    private JComboBox       cbUpdatePeriod = new JComboBox (new String [] {
71
                                loc ("CTL_Update_every_startup"),
72
                                loc ("CTL_Update_every_startup"),
72
                                loc ("CTL_Update_every_day"),
73
                                loc ("CTL_Update_every_day"),
Lines 88-93 Link Here
88
        tfHost.getAccessibleContext ().setAccessibleDescription (loc ("AD_Host"));
89
        tfHost.getAccessibleContext ().setAccessibleDescription (loc ("AD_Host"));
89
        tfPort.getAccessibleContext ().setAccessibleName (loc ("AN_Port"));
90
        tfPort.getAccessibleContext ().setAccessibleName (loc ("AN_Port"));
90
        tfPort.getAccessibleContext ().setAccessibleDescription (loc ("AD_Port"));
91
        tfPort.getAccessibleContext ().setAccessibleDescription (loc ("AD_Port"));
92
        tfNonProxy.getAccessibleContext ().setAccessibleName (loc ("AN_NonProxy"));
93
        tfNonProxy.getAccessibleContext ().setAccessibleDescription (loc ("AD_NonProxy"));
91
        cbUpdatePeriod.getAccessibleContext ().setAccessibleName (loc ("AN_Update_Period"));
94
        cbUpdatePeriod.getAccessibleContext ().setAccessibleName (loc ("AN_Update_Period"));
92
        cbUpdatePeriod.getAccessibleContext ().setAccessibleDescription (loc ("AD_Update_Period"));
95
        cbUpdatePeriod.getAccessibleContext ().setAccessibleDescription (loc ("AD_Update_Period"));
93
        cbAskBeforeCheck.getAccessibleContext ().setAccessibleName (loc ("AN_Ask_Before_Check"));
96
        cbAskBeforeCheck.getAccessibleContext ().setAccessibleName (loc ("AN_Ask_Before_Check"));
Lines 100-105 Link Here
100
        cbWebBrowser.addActionListener (this);
103
        cbWebBrowser.addActionListener (this);
101
        tfHost.addActionListener (this);
104
        tfHost.addActionListener (this);
102
        tfPort.addActionListener (this);
105
        tfPort.addActionListener (this);
106
        tfNonProxy.addActionListener (this);
103
        cbUpdatePeriod.addActionListener (this);
107
        cbUpdatePeriod.addActionListener (this);
104
        cbAskBeforeCheck.addActionListener (this);
108
        cbAskBeforeCheck.addActionListener (this);
105
        
109
        
Lines 115-150 Link Here
115
        loc (rbNoProxy, "No_Proxy");
119
        loc (rbNoProxy, "No_Proxy");
116
        loc (rbSystemProxy, "Use_System_Proxy_Settings");
120
        loc (rbSystemProxy, "Use_System_Proxy_Settings");
117
        loc (rbHTTPProxy, "Use_HTTP_Proxy");
121
        loc (rbHTTPProxy, "Use_HTTP_Proxy");
122
        tfPort.setColumns (4);
118
        
123
        
119
        FormLayout layout = new FormLayout(
124
        FormLayout layout = new FormLayout(
120
            "5dlu, l:p, 5dlu, p:g, 1dlu, p", // cols
125
            "5dlu, l:p, 5dlu, p:g, 5dlu, l:p, 5dlu, p", // cols
121
            "p, 3dlu, p, 3dlu, p, 3dlu, p, 10dlu, p, 3dlu" +
126
            "p, 3dlu, p, 3dlu, p, 3dlu, p, 10dlu, p, 3dlu" +
122
            ", p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 10dlu, p, 3dlu, p, 3dlu, p"); // rows
127
            ", p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 10dlu, p, 3dlu, p, 3dlu, p"); // rows
123
        PanelBuilder builder = new PanelBuilder (layout, this);
128
        PanelBuilder builder = new PanelBuilder (layout, this);
124
        CellConstraints cc = new CellConstraints ();
129
        CellConstraints cc = new CellConstraints ();
125
        CellConstraints lc = new CellConstraints ();
130
        CellConstraints lc = new CellConstraints ();
126
        builder.addSeparator (loc ("General"),          cc.xyw (1,  1, 6));
131
        builder.addSeparator (loc ("General"),          cc.xyw (1,  1, 8));
127
        builder.addLabel (    loc ("Package_View_Type"),lc.xy  (2,  3),
132
        builder.addLabel (    loc ("Package_View_Type"),lc.xy  (2,  3),
128
                              rbFlatternPackages,       cc.xyw (4,  3, 3));
133
                              rbFlatternPackages,       cc.xyw (4,  3, 3));
129
        builder.add (         rbTreePackages,           cc.xyw (4,  5, 3));
134
        builder.add (         rbTreePackages,           cc.xyw (4,  5, 3));
130
        builder.addLabel (    loc ("Web_Browser"),      lc.xy  (2,  7), 
135
        builder.addLabel (    loc ("Web_Browser"),      lc.xy  (2,  7), 
131
                              cbWebBrowser,             cc.xy  (4,  7));
136
                              cbWebBrowser,             cc.xyw  (4,  7, 5));
132
137
133
        builder.addSeparator (loc ("Proxy_Settings"),   cc.xyw (1,  9, 6));
138
        builder.addSeparator (loc ("Proxy_Settings"),   cc.xyw (1,  9, 8));
134
        builder.addLabel (    loc ("Web_Proxy"),        lc.xy  (2,  11), 
139
        builder.addLabel (    loc ("Web_Proxy"),        lc.xy  (2,  11), 
135
                              rbNoProxy,                cc.xyw (4,  11, 3));
140
                              rbNoProxy,                cc.xyw (4,  11, 3));
136
        builder.add (         rbSystemProxy,            cc.xyw (4,  13, 3));
141
        builder.add (         rbSystemProxy,            cc.xyw (4,  13, 3));
137
        builder.add (         rbHTTPProxy,              cc.xyw (4,  15, 3));
142
        builder.add (         rbHTTPProxy,              cc.xyw (4,  15, 3));
138
        builder.addLabel (    loc ("Proxy_Host"),       lc.xy  (2,  17), 
143
        builder.addLabel (    loc ("Proxy_Host"),       lc.xy  (2,  17), 
139
                              tfHost,                   cc.xyw (4,  17, 3));
144
                              tfHost,                   cc.xyw (4,  17, 1));
140
        builder.addLabel (    loc ("Proxy_Port"),       lc.xy  (2,  19),
145
        builder.addLabel (    loc ("Proxy_Port"),       lc.xy  (6,  17),
141
                              tfPort,                   cc.xyw (4,  19, 3));
146
                              tfPort,                   cc.xyw (8,  17, 1));
142
147
        builder.addLabel (    loc ("Non_Proxy"),        lc.xy  (2,  19),
143
        builder.addSeparator (loc ("Auto_Update"),      cc.xyw (1,  21, 6));
148
                              tfNonProxy,               cc.xyw (4,  19, 5));
144
        builder.addLabel (    loc ("Check_Period"),     lc.xy  (2,  23),
149
        builder.addLabel (    loc ("Non_Proxy_Hint"),   lc.xy (4, 21));
145
                              cbUpdatePeriod,           cc.xyw (4,  23, 3));
150
146
        builder.addLabel (    loc ("Ask_Before_Check"), lc.xy  (2,  25),
151
        builder.addSeparator (loc ("Auto_Update"),      cc.xyw (1,  23, 8));
147
                              cbAskBeforeCheck,         cc.xyw (4,  25, 3));
152
        builder.addLabel (    loc ("Check_Period"),     lc.xy  (2,  25),
153
                              cbUpdatePeriod,           cc.xyw (4,  25, 5));
154
        builder.addLabel (    loc ("Ask_Before_Check"), lc.xy  (2,  27),
155
                              cbAskBeforeCheck,         cc.xyw (4,  27, 3));
148
156
149
        // if system proxy setting is not detectable, disable this radio
157
        // if system proxy setting is not detectable, disable this radio
150
        // button
158
        // button
Lines 186-201 Link Here
186
                rbNoProxy.setSelected (true);
194
                rbNoProxy.setSelected (true);
187
                tfHost.setEnabled (false);
195
                tfHost.setEnabled (false);
188
                tfPort.setEnabled (false);
196
                tfPort.setEnabled (false);
197
                tfNonProxy.setEnabled (false);
189
                break;
198
                break;
190
            case 1:
199
            case 1:
191
                rbSystemProxy.setSelected (true);
200
                rbSystemProxy.setSelected (true);
192
                tfHost.setEnabled (false);
201
                tfHost.setEnabled (false);
193
                tfPort.setEnabled (false);
202
                tfPort.setEnabled (false);
203
                tfNonProxy.setEnabled (false);
194
                break;
204
                break;
195
            default:
205
            default:
196
                rbHTTPProxy.setSelected (true);
206
                rbHTTPProxy.setSelected (true);
197
                tfHost.setEnabled (true);
207
                tfHost.setEnabled (true);
198
                tfPort.setEnabled (true);
208
                tfPort.setEnabled (true);
209
                tfNonProxy.setEnabled (true);
199
                break;
210
                break;
200
        }
211
        }
201
        tfHost.setText (model.getProxyHost ());
212
        tfHost.setText (model.getProxyHost ());
Lines 204-209 Link Here
204
            tfPort.setText (Integer.toString (port));
215
            tfPort.setText (Integer.toString (port));
205
        else
216
        else
206
            tfPort.setText ("");
217
            tfPort.setText ("");
218
        tfNonProxy.setText (model.getUserNonProxy ());
207
219
208
        // Autoupdate settings
220
        // Autoupdate settings
209
        cbAskBeforeCheck.setSelected (model.getAutoUpdateAskBeforeCheck ());
221
        cbAskBeforeCheck.setSelected (model.getAutoUpdateAskBeforeCheck ());
Lines 249-262 Link Here
249
        if (model == null) return;
261
        if (model == null) return;
250
        
262
        
251
        // proxy settings
263
        // proxy settings
252
        model.setProxyHost (tfHost.getText ());
253
        try {
254
            model.setProxyPort (
255
                Math.max (Integer.parseInt (tfPort.getText ()), 0)
256
            );
257
        } catch (NumberFormatException ex) {
258
            model.setProxyPort (0);
259
        }
260
        if (rbNoProxy.isSelected ()) {
264
        if (rbNoProxy.isSelected ()) {
261
            model.setProxyType (0);
265
            model.setProxyType (0);
262
        } else
266
        } else
Lines 265-270 Link Here
265
        } else {
269
        } else {
266
            model.setProxyType (2);
270
            model.setProxyType (2);
267
        }
271
        }
272
        model.setProxyHost (tfHost.getText ());
273
        model.setUserNonProxy (tfNonProxy.getText ());
274
        try {
275
            model.setProxyPort (
276
                Math.max (Integer.parseInt (tfPort.getText ()), 0)
277
            );
278
        } catch (NumberFormatException ex) {
279
            model.setProxyPort (0);
280
        }
268
281
269
        // Autoupdate settings
282
        // Autoupdate settings
270
        model.setAutoUpdateAskBeforeCheck (cbAskBeforeCheck.isSelected ());
283
        model.setAutoUpdateAskBeforeCheck (cbAskBeforeCheck.isSelected ());
Lines 312-317 Link Here
312
            if (!tfPort.getText ().equals (Integer.toString (model.getProxyPort ()))) return true;
325
            if (!tfPort.getText ().equals (Integer.toString (model.getProxyPort ()))) return true;
313
        } else
326
        } else
314
            if (!tfPort.getText ().equals ("")) return true;
327
            if (!tfPort.getText ().equals ("")) return true;
328
        if (!tfNonProxy.getText ().equals (model.getUserNonProxy ())) {
329
            return true;
330
        }
315
        return changed;
331
        return changed;
316
    }
332
    }
317
    
333
    
Lines 319-324 Link Here
319
        changed = true;
335
        changed = true;
320
        tfHost.setEnabled (rbHTTPProxy.isSelected ());
336
        tfHost.setEnabled (rbHTTPProxy.isSelected ());
321
        tfPort.setEnabled (rbHTTPProxy.isSelected ());
337
        tfPort.setEnabled (rbHTTPProxy.isSelected ());
338
        tfNonProxy.setEnabled (rbHTTPProxy.isSelected ());
322
    }
339
    }
323
}
340
}
324
341

Return to bug 13702