mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
CustomProxySelector: auto proxy (PAC) needs login info too
This commit is contained in:
parent
916de939e6
commit
0c7e0d6bb4
@ -483,25 +483,39 @@
|
|||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="autoProxyUsePAC" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="autoProxyUsernameLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="autoProxyPasswordLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="autoProxyPACURL" max="32767" attributes="0"/>
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Component id="autoProxyUsername" min="-2" pref="178" max="-2" attributes="0"/>
|
||||||
|
<Component id="autoProxyPassword" min="-2" pref="180" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="noProxy" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="noProxy" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="autoProxy" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="autoProxy" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="manualProxy" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Component id="manualProxy" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
|
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Component id="autoProxyUsePAC" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="autoProxyPACURL" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Component id="manualProxyHTTP" min="-2" max="-2" attributes="0"/>
|
<Component id="manualProxyHTTP" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="manualProxySOCKS" min="-2" max="-2" attributes="0"/>
|
<Component id="manualProxySOCKS" min="-2" max="-2" attributes="0"/>
|
||||||
@ -518,8 +532,10 @@
|
|||||||
<Component id="manualProxyHostName" min="-2" pref="541" max="-2" attributes="0"/>
|
<Component id="manualProxyHostName" min="-2" pref="541" max="-2" attributes="0"/>
|
||||||
<Component id="manualProxyPort" alignment="0" min="-2" pref="74" max="-2" attributes="0"/>
|
<Component id="manualProxyPort" alignment="0" min="-2" pref="74" max="-2" attributes="0"/>
|
||||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
||||||
<Component id="manualProxyPassword" alignment="0" pref="180" max="32767" attributes="0"/>
|
<Component id="manualProxyPassword" alignment="0" max="32767" attributes="0"/>
|
||||||
<Component id="manualProxyUsername" alignment="0" max="32767" attributes="0"/>
|
<Component id="manualProxyUsername" alignment="0" min="-2" pref="180" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -527,8 +543,6 @@
|
|||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -546,6 +560,16 @@
|
|||||||
<Component id="autoProxyPACURL" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="autoProxyPACURL" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="autoProxyUsername" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="autoProxyUsernameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="autoProxyPasswordLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="autoProxyPassword" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="manualProxy" min="-2" max="-2" attributes="0"/>
|
<Component id="manualProxy" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
@ -572,7 +596,7 @@
|
|||||||
<Component id="manualProxyPassword" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="manualProxyPassword" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="manualProxyPasswordLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="manualProxyPasswordLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace pref="225" max="32767" attributes="0"/>
|
<EmptySpace pref="163" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -587,7 +611,7 @@
|
|||||||
<Connection code="tr("No proxy")" type="code"/>
|
<Connection code="tr("No proxy")" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||||
<Connection code="PROXY_TYPE_NONE" type="code"/>
|
<Connection code="Constants.PROXY_TYPE_NONE" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
@ -600,7 +624,7 @@
|
|||||||
<Connection code="tr("Auto-detect proxy settings")" type="code"/>
|
<Connection code="tr("Auto-detect proxy settings")" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||||
<Connection code="PROXY_TYPE_AUTO" type="code"/>
|
<Connection code="Constants.PROXY_TYPE_AUTO" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
@ -616,7 +640,7 @@
|
|||||||
<Connection code="tr("Manual proxy configuration")" type="code"/>
|
<Connection code="tr("Manual proxy configuration")" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||||
<Connection code="PROXY_TYPE_MANUAL" type="code"/>
|
<Connection code="Constants.PROXY_TYPE_MANUAL" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Events>
|
<Events>
|
||||||
@ -642,7 +666,7 @@
|
|||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="HTTP"/>
|
<Property name="text" type="java.lang.String" value="HTTP"/>
|
||||||
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||||
<Connection code="PROXY_MANUAL_TYPE_HTTP" type="code"/>
|
<Connection code="Constants.PROXY_MANUAL_TYPE_HTTP" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
@ -653,7 +677,7 @@
|
|||||||
</Property>
|
</Property>
|
||||||
<Property name="text" type="java.lang.String" value="SOCKS"/>
|
<Property name="text" type="java.lang.String" value="SOCKS"/>
|
||||||
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
<Property name="actionCommand" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||||
<Connection code="PROXY_MANUAL_TYPE_SOCKS" type="code"/>
|
<Connection code="Constants.PROXY_MANUAL_TYPE_SOCKS" type="code"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
@ -696,6 +720,27 @@
|
|||||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="autoProxyUsernameLabel">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||||
|
<Connection code="tr("Username:")" type="code"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JTextField" name="autoProxyUsername">
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JPasswordField" name="autoProxyPassword">
|
||||||
|
<Properties>
|
||||||
|
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="autoProxyPasswordLabel">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||||
|
<Connection code="tr("Password:")" type="code"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
@ -252,6 +252,10 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
manualProxyUsername = new javax.swing.JTextField();
|
manualProxyUsername = new javax.swing.JTextField();
|
||||||
manualProxyPasswordLabel = new javax.swing.JLabel();
|
manualProxyPasswordLabel = new javax.swing.JLabel();
|
||||||
manualProxyPassword = new javax.swing.JPasswordField();
|
manualProxyPassword = new javax.swing.JPasswordField();
|
||||||
|
autoProxyUsernameLabel = new javax.swing.JLabel();
|
||||||
|
autoProxyUsername = new javax.swing.JTextField();
|
||||||
|
autoProxyPassword = new javax.swing.JPasswordField();
|
||||||
|
autoProxyPasswordLabel = new javax.swing.JLabel();
|
||||||
javax.swing.JPanel jPanel3 = new javax.swing.JPanel();
|
javax.swing.JPanel jPanel3 = new javax.swing.JPanel();
|
||||||
javax.swing.JButton okButton = new javax.swing.JButton();
|
javax.swing.JButton okButton = new javax.swing.JButton();
|
||||||
javax.swing.JButton cancelButton = new javax.swing.JButton();
|
javax.swing.JButton cancelButton = new javax.swing.JButton();
|
||||||
@ -492,6 +496,12 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
|
|
||||||
manualProxyPassword.setToolTipText("");
|
manualProxyPassword.setToolTipText("");
|
||||||
|
|
||||||
|
autoProxyUsernameLabel.setText(tr("Username:"));
|
||||||
|
|
||||||
|
autoProxyPassword.setToolTipText("");
|
||||||
|
|
||||||
|
autoProxyPasswordLabel.setText(tr("Password:"));
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
|
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
|
||||||
jPanel4.setLayout(jPanel4Layout);
|
jPanel4.setLayout(jPanel4Layout);
|
||||||
jPanel4Layout.setHorizontalGroup(
|
jPanel4Layout.setHorizontalGroup(
|
||||||
@ -500,19 +510,29 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||||
|
.addGap(12, 12, 12)
|
||||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(noProxy)
|
.addComponent(autoProxyUsePAC)
|
||||||
.addComponent(autoProxy)
|
|
||||||
.addComponent(manualProxy))
|
|
||||||
.addGap(0, 0, Short.MAX_VALUE))
|
|
||||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||||
.addGap(12, 12, 12)
|
.addGap(12, 12, 12)
|
||||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
.addComponent(autoProxyUsernameLabel)
|
||||||
.addComponent(autoProxyUsePAC)
|
.addComponent(autoProxyPasswordLabel))))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(autoProxyPACURL))
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(autoProxyPACURL)
|
||||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||||
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(autoProxyUsername, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(autoProxyPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE))))
|
||||||
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||||
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(noProxy)
|
||||||
|
.addComponent(autoProxy)
|
||||||
|
.addComponent(manualProxy)
|
||||||
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||||
|
.addGap(12, 12, 12)
|
||||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||||
.addComponent(manualProxyHTTP)
|
.addComponent(manualProxyHTTP)
|
||||||
@ -529,9 +549,9 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
.addComponent(manualProxyHostName, javax.swing.GroupLayout.PREFERRED_SIZE, 541, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(manualProxyHostName, javax.swing.GroupLayout.PREFERRED_SIZE, 541, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(manualProxyPort, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(manualProxyPort, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||||
.addComponent(manualProxyPassword, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
|
.addComponent(manualProxyPassword, javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(manualProxyUsername, javax.swing.GroupLayout.Alignment.LEADING)))))
|
.addComponent(manualProxyUsername, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
|
||||||
.addGap(0, 0, Short.MAX_VALUE)))))
|
.addGap(0, 0, Short.MAX_VALUE)))
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
jPanel4Layout.setVerticalGroup(
|
jPanel4Layout.setVerticalGroup(
|
||||||
@ -546,6 +566,14 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
.addComponent(autoProxyUsePAC)
|
.addComponent(autoProxyUsePAC)
|
||||||
.addComponent(autoProxyPACURL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(autoProxyPACURL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(autoProxyUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(autoProxyUsernameLabel))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(autoProxyPasswordLabel)
|
||||||
|
.addComponent(autoProxyPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(manualProxy)
|
.addComponent(manualProxy)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
@ -567,7 +595,7 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(manualProxyPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(manualProxyPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(manualProxyPasswordLabel))
|
.addComponent(manualProxyPasswordLabel))
|
||||||
.addContainerGap(225, Short.MAX_VALUE))
|
.addContainerGap(163, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
jTabbedPane1.addTab(tr("Network"), jPanel4);
|
jTabbedPane1.addTab(tr("Network"), jPanel4);
|
||||||
@ -690,14 +718,18 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
}//GEN-LAST:event_manualProxyItemStateChanged
|
}//GEN-LAST:event_manualProxyItemStateChanged
|
||||||
|
|
||||||
private void autoProxyUsePACItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_autoProxyUsePACItemStateChanged
|
private void autoProxyUsePACItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_autoProxyUsePACItemStateChanged
|
||||||
autoProxyPACURL.setEnabled(autoProxyUsePAC.isSelected());
|
autoProxyPACFieldsSetEnabled(autoProxyUsePAC.isSelected());
|
||||||
}//GEN-LAST:event_autoProxyUsePACItemStateChanged
|
}//GEN-LAST:event_autoProxyUsePACItemStateChanged
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JTextField additionalBoardsManagerField;
|
private javax.swing.JTextField additionalBoardsManagerField;
|
||||||
private javax.swing.JRadioButton autoProxy;
|
private javax.swing.JRadioButton autoProxy;
|
||||||
private javax.swing.JTextField autoProxyPACURL;
|
private javax.swing.JTextField autoProxyPACURL;
|
||||||
|
private javax.swing.JPasswordField autoProxyPassword;
|
||||||
|
private javax.swing.JLabel autoProxyPasswordLabel;
|
||||||
private javax.swing.JCheckBox autoProxyUsePAC;
|
private javax.swing.JCheckBox autoProxyUsePAC;
|
||||||
|
private javax.swing.JTextField autoProxyUsername;
|
||||||
|
private javax.swing.JLabel autoProxyUsernameLabel;
|
||||||
private javax.swing.JCheckBox checkUpdatesBox;
|
private javax.swing.JCheckBox checkUpdatesBox;
|
||||||
private javax.swing.JComboBox comboLanguage;
|
private javax.swing.JComboBox comboLanguage;
|
||||||
private javax.swing.JComboBox comboWarnings;
|
private javax.swing.JComboBox comboWarnings;
|
||||||
@ -797,6 +829,8 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
PreferencesData.set(Constants.PREF_PROXY_MANUAL_PORT, manualProxyPort.getText());
|
PreferencesData.set(Constants.PREF_PROXY_MANUAL_PORT, manualProxyPort.getText());
|
||||||
PreferencesData.set(Constants.PREF_PROXY_MANUAL_USERNAME, manualProxyUsername.getText());
|
PreferencesData.set(Constants.PREF_PROXY_MANUAL_USERNAME, manualProxyUsername.getText());
|
||||||
PreferencesData.set(Constants.PREF_PROXY_MANUAL_PASSWORD, String.valueOf(manualProxyPassword.getPassword()));
|
PreferencesData.set(Constants.PREF_PROXY_MANUAL_PASSWORD, String.valueOf(manualProxyPassword.getPassword()));
|
||||||
|
PreferencesData.set(Constants.PREF_PROXY_AUTO_USERNAME, autoProxyUsername.getText());
|
||||||
|
PreferencesData.set(Constants.PREF_PROXY_AUTO_PASSWORD, String.valueOf(autoProxyPassword.getPassword()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPrerefencesData() {
|
private void showPrerefencesData() {
|
||||||
@ -849,6 +883,8 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
if (!PreferencesData.get(Constants.PREF_PROXY_PAC_URL, "").isEmpty()) {
|
if (!PreferencesData.get(Constants.PREF_PROXY_PAC_URL, "").isEmpty()) {
|
||||||
autoProxyUsePAC.setSelected(true);
|
autoProxyUsePAC.setSelected(true);
|
||||||
autoProxyPACURL.setText(PreferencesData.get(Constants.PREF_PROXY_PAC_URL));
|
autoProxyPACURL.setText(PreferencesData.get(Constants.PREF_PROXY_PAC_URL));
|
||||||
|
autoProxyUsername.setText(PreferencesData.get(Constants.PREF_PROXY_AUTO_USERNAME));
|
||||||
|
autoProxyPassword.setText(PreferencesData.get(Constants.PREF_PROXY_AUTO_PASSWORD));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
manualProxy.setSelected(true);
|
manualProxy.setSelected(true);
|
||||||
@ -879,7 +915,15 @@ public class Preferences extends javax.swing.JDialog {
|
|||||||
|
|
||||||
private void autoProxyFieldsSetEnabled(boolean enabled) {
|
private void autoProxyFieldsSetEnabled(boolean enabled) {
|
||||||
autoProxyUsePAC.setEnabled(enabled);
|
autoProxyUsePAC.setEnabled(enabled);
|
||||||
autoProxyPACURL.setEnabled(enabled && autoProxyUsePAC.isSelected());
|
autoProxyPACFieldsSetEnabled(enabled && autoProxyUsePAC.isSelected());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void autoProxyPACFieldsSetEnabled(boolean enabled) {
|
||||||
|
autoProxyPACURL.setEnabled(enabled);
|
||||||
|
autoProxyUsername.setEnabled(enabled);
|
||||||
|
autoProxyUsernameLabel.setEnabled(enabled);
|
||||||
|
autoProxyPassword.setEnabled(enabled);
|
||||||
|
autoProxyPasswordLabel.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableAllProxyFields() {
|
private void disableAllProxyFields() {
|
||||||
|
@ -50,6 +50,22 @@ public class CustomProxySelectorTest {
|
|||||||
assertEquals(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy.example.com", 8080)), proxy);
|
assertEquals(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy.example.com", 8080)), proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testProxyPACHTTPWithLogin() throws Exception {
|
||||||
|
preferences.put(Constants.PREF_PROXY_TYPE, Constants.PROXY_TYPE_AUTO);
|
||||||
|
preferences.put(Constants.PREF_PROXY_PAC_URL, CustomProxySelectorTest.class.getResource("proxy_http.pac").toExternalForm());
|
||||||
|
preferences.put(Constants.PREF_PROXY_AUTO_USERNAME, "auto");
|
||||||
|
preferences.put(Constants.PREF_PROXY_AUTO_PASSWORD, "autopassword");
|
||||||
|
CustomProxySelector proxySelector = new CustomProxySelector(preferences);
|
||||||
|
Proxy proxy = proxySelector.getProxyFor(uri);
|
||||||
|
|
||||||
|
assertEquals(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy.example.com", 8080)), proxy);
|
||||||
|
|
||||||
|
PasswordAuthentication authentication = Authenticator.requestPasswordAuthentication(null, 8080, uri.toURL().getProtocol(), "ciao", "");
|
||||||
|
assertEquals(authentication.getUserName(), "auto");
|
||||||
|
assertEquals(String.valueOf(authentication.getPassword()), "autopassword");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProxyPACSOCKS() throws Exception {
|
public void testProxyPACSOCKS() throws Exception {
|
||||||
preferences.put(Constants.PREF_PROXY_TYPE, Constants.PROXY_TYPE_AUTO);
|
preferences.put(Constants.PREF_PROXY_TYPE, Constants.PROXY_TYPE_AUTO);
|
||||||
|
@ -58,6 +58,8 @@ public class Constants {
|
|||||||
public static final String PREF_PROXY_MANUAL_PORT = "proxy.manual.port";
|
public static final String PREF_PROXY_MANUAL_PORT = "proxy.manual.port";
|
||||||
public static final String PREF_PROXY_MANUAL_USERNAME = "proxy.manual.username";
|
public static final String PREF_PROXY_MANUAL_USERNAME = "proxy.manual.username";
|
||||||
public static final String PREF_PROXY_MANUAL_PASSWORD = "proxy.manual.password";
|
public static final String PREF_PROXY_MANUAL_PASSWORD = "proxy.manual.password";
|
||||||
|
public static final String PREF_PROXY_AUTO_USERNAME = "proxy.manual.username";
|
||||||
|
public static final String PREF_PROXY_AUTO_PASSWORD = "proxy.manual.password";
|
||||||
|
|
||||||
public static final String PACKAGE_INDEX_URL;
|
public static final String PACKAGE_INDEX_URL;
|
||||||
public static final String LIBRARY_INDEX_URL;
|
public static final String LIBRARY_INDEX_URL;
|
||||||
|
@ -43,6 +43,8 @@ public class CustomProxySelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Proxy pacProxy(String pac, URI uri) throws IOException, ScriptException, NoSuchMethodException {
|
private Proxy pacProxy(String pac, URI uri) throws IOException, ScriptException, NoSuchMethodException {
|
||||||
|
setAuthenticator(preferences.get(Constants.PREF_PROXY_AUTO_USERNAME), preferences.get(Constants.PREF_PROXY_AUTO_PASSWORD));
|
||||||
|
|
||||||
URLConnection urlConnection = new URL(pac).openConnection();
|
URLConnection urlConnection = new URL(pac).openConnection();
|
||||||
urlConnection.connect();
|
urlConnection.connect();
|
||||||
if (urlConnection instanceof HttpURLConnection) {
|
if (urlConnection instanceof HttpURLConnection) {
|
||||||
@ -90,7 +92,7 @@ public class CustomProxySelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Proxy manualProxy() {
|
private Proxy manualProxy() {
|
||||||
setAuthenticator();
|
setAuthenticator(preferences.get(Constants.PREF_PROXY_MANUAL_USERNAME), preferences.get(Constants.PREF_PROXY_MANUAL_PASSWORD));
|
||||||
Proxy.Type type = Proxy.Type.valueOf(preferences.get(Constants.PREF_PROXY_MANUAL_TYPE));
|
Proxy.Type type = Proxy.Type.valueOf(preferences.get(Constants.PREF_PROXY_MANUAL_TYPE));
|
||||||
return new Proxy(type, new InetSocketAddress(preferences.get(Constants.PREF_PROXY_MANUAL_HOSTNAME), Integer.valueOf(preferences.get(Constants.PREF_PROXY_MANUAL_PORT))));
|
return new Proxy(type, new InetSocketAddress(preferences.get(Constants.PREF_PROXY_MANUAL_HOSTNAME), Integer.valueOf(preferences.get(Constants.PREF_PROXY_MANUAL_PORT))));
|
||||||
}
|
}
|
||||||
@ -99,12 +101,20 @@ public class CustomProxySelector {
|
|||||||
Authenticator.setDefault(null);
|
Authenticator.setDefault(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAuthenticator() {
|
private void setAuthenticator(String username, String password) {
|
||||||
|
if (username == null || username.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String actualPassword;
|
||||||
|
if (password == null) {
|
||||||
|
actualPassword = "";
|
||||||
|
} else {
|
||||||
|
actualPassword = password;
|
||||||
|
}
|
||||||
Authenticator.setDefault(
|
Authenticator.setDefault(
|
||||||
new Authenticator() {
|
new Authenticator() {
|
||||||
public PasswordAuthentication getPasswordAuthentication() {
|
public PasswordAuthentication getPasswordAuthentication() {
|
||||||
return new PasswordAuthentication(
|
return new PasswordAuthentication(username, actualPassword.toCharArray());
|
||||||
preferences.get(Constants.PREF_PROXY_MANUAL_USERNAME), preferences.get(Constants.PREF_PROXY_MANUAL_PASSWORD).toCharArray());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user