package test.preferences; import org.eclipse.jface.preference.PreferencePage; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.swt.widgets.TableItem; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import test.Activator; public class ProxyPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { private Text noProxyForText; private Table table; private Text proxyConfigurationUrlText; public ProxyPreferencePage() { super("Proxy Preferences"); setPreferenceStore(Activator.getDefault().getPreferenceStore()); } /* * (non-Javadoc) * * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) */ public void init(IWorkbench workbench) { } protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginRight = 5; layout.marginTop = 5; layout.marginWidth = 0; composite.setLayout(layout); GridData data = new GridData(GridData.FILL); data.grabExcessHorizontalSpace = true; composite.setLayoutData(data); final Button directConnectionToButton = new Button(composite, SWT.RADIO); directConnectionToButton.setLayoutData(new GridData()); directConnectionToButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { } }); directConnectionToButton.setText("Direct connection to the Internet"); new Label(composite, SWT.NONE); final Button manualProxyConfigurationButton = new Button(composite, SWT.RADIO); manualProxyConfigurationButton.setText("Manual proxy configuration:"); new Label(composite, SWT.NONE); final Composite manualProxyConfigurationComposite = new Composite(composite, SWT.NONE); final GridLayout gridLayout = new GridLayout(); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; manualProxyConfigurationComposite.setLayout(gridLayout); manualProxyConfigurationComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 2, 1)); final Button useSameProxyButton = new Button(manualProxyConfigurationComposite, SWT.CHECK); final GridData gridData_2 = new GridData(); gridData_2.horizontalIndent = 15; useSameProxyButton.setLayoutData(gridData_2); useSameProxyButton.setText("Use the same proxy server for all protocols"); final SashForm sashForm = new SashForm(manualProxyConfigurationComposite, SWT.VERTICAL); final GridData gridData_1 = new GridData(SWT.FILL, SWT.FILL, true, true); gridData_1.horizontalIndent = 15; sashForm.setLayoutData(gridData_1); table = new Table(sashForm, SWT.BORDER); table.setLinesVisible(true); table.setHeaderVisible(true); final TableColumn newColumnTableColumn = new TableColumn(table, SWT.NONE); newColumnTableColumn.setWidth(100); newColumnTableColumn.setText("Type"); final TableColumn newColumnTableColumn_1 = new TableColumn(table, SWT.NONE); newColumnTableColumn_1.setWidth(100); newColumnTableColumn_1.setText("Host"); final TableColumn newColumnTableColumn_2 = new TableColumn(table, SWT.NONE); newColumnTableColumn_2.setWidth(100); newColumnTableColumn_2.setText("Port"); final TableItem newItemTableItem = new TableItem(table, SWT.BORDER); newItemTableItem.setText(0, "HTTP"); newItemTableItem.setText(2, "8080"); newItemTableItem.setText(1, "localhost"); final TableItem newItemTableItem_2 = new TableItem(table, SWT.BORDER); newItemTableItem_2.setText(0, "SOCKS"); newItemTableItem_2.setText(1, "localhost"); newItemTableItem_2.setText(2, "3128"); final Composite composite_1 = new Composite(sashForm, SWT.NONE); final GridLayout gridLayout_1 = new GridLayout(); gridLayout_1.marginTop = 5; gridLayout_1.marginWidth = 0; gridLayout_1.marginHeight = 0; composite_1.setLayout(gridLayout_1); final Label noProxyForLabel = new Label(composite_1, SWT.NONE); noProxyForLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); noProxyForLabel.setText("No proxy for:"); noProxyForText = new Text(composite_1, SWT.MULTI | SWT.BORDER); noProxyForText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); sashForm.setWeights(new int[] {127, 95 }); final Button autodetectButton = new Button(composite, SWT.RADIO); autodetectButton.setLayoutData(new GridData()); autodetectButton.setText("Auto-detect proxy settings"); new Label(composite, SWT.NONE); final Button automaticProxyConfigurationButton = new Button(composite, SWT.RADIO); automaticProxyConfigurationButton.setText("Automatic proxy configuration URL:"); new Label(composite, SWT.NONE); proxyConfigurationUrlText = new Text(composite, SWT.BORDER); final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); gridData.horizontalIndent = 17; proxyConfigurationUrlText.setLayoutData(gridData); final Button reloadButton = new Button(composite, SWT.NONE); reloadButton.setText("Reload"); return composite; } }