Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 177936 Details for
Bug 299020
[Net] Check Button for Edit Proxy Entry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
initial patch
example_solution.txt (text/plain), 21.55 KB, created by
Wojciech Galanciak
on 2010-09-01 07:05:39 EDT
(
hide
)
Description:
initial patch
Filename:
MIME Type:
Creator:
Wojciech Galanciak
Created:
2010-09-01 07:05:39 EDT
Size:
21.55 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.net >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/plugin.xml,v >retrieving revision 1.3 >diff -u -r1.3 plugin.xml >--- plugin.xml 14 May 2009 10:31:50 -0000 1.3 >+++ plugin.xml 1 Sep 2010 10:39:02 -0000 >@@ -2,6 +2,7 @@ > <?eclipse version="3.2"?> > <plugin> > <extension-point id="authenticator" name="Authenticator" schema="schema/authenticator.exsd"/> >+ <extension-point id="proxyTester" name="Proxy Tester" schema="schema/proxyTester.exsd"/> > <extension > point="org.eclipse.equinox.preferences.preferences"> > <initializer >Index: schema/proxyTester.exsd >=================================================================== >RCS file: schema/proxyTester.exsd >diff -N schema/proxyTester.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/proxyTester.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,102 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.core.net" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.core.net" id="proxyTester" name="Proxy Tester"/> >+ </appInfo> >+ <documentation> >+ [Enter description of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appInfo> >+ <meta.element /> >+ </appInfo> >+ </annotation> >+ <complexType> >+ <choice minOccurs="1" maxOccurs="unbounded"> >+ <element ref="proxyTestProvider"/> >+ </choice> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="proxyTestProvider"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.core.net.proxy.IProxyTestProvider"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiinfo"/> >+ </appInfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ >+</schema> >Index: src/org/eclipse/core/net/proxy/IProxyTestProvider.java >=================================================================== >RCS file: src/org/eclipse/core/net/proxy/IProxyTestProvider.java >diff -N src/org/eclipse/core/net/proxy/IProxyTestProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/net/proxy/IProxyTestProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,33 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.net.proxy; >+ >+import org.eclipse.core.runtime.IStatus; >+ >+public interface IProxyTestProvider { >+ >+ /** >+ * This method should test connection with a given host. Implementors should >+ * test connection and return IStatus instance in result. If connection is >+ * established correctly, it should return >+ * org.eclipse.core.runtime.Status.Status(int, String, String) with severity >+ * IStatus.OK. If connection cannot be established, severity should be >+ * IStatus.ERROR. If any Throwable object is available as a result of any >+ * error or exception, it should return >+ * org.eclipse.core.runtime.Status.Status(int, String, int, String, >+ * Throwable). In org.eclipse.core.runtime.Status constructor as a message >+ * parameter should be set host for which connection was tested. >+ * >+ * @param host for which connection is tested. >+ * @return IStatus result of a test >+ */ >+ IStatus testConnection(String host); >+} >#P org.eclipse.ui.net >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.net/plugin.xml,v >retrieving revision 1.4 >diff -u -r1.4 plugin.xml >--- plugin.xml 30 Apr 2007 18:02:22 -0000 1.4 >+++ plugin.xml 1 Sep 2010 10:39:03 -0000 >@@ -25,5 +25,11 @@ > class="org.eclipse.ui.internal.net.auth.NetAuthenticator"> > </authenticator> > </extension> >+ <extension >+ point="org.eclipse.core.net.proxyTester"> >+ <proxyTestProvider >+ class="org.eclipse.ui.internal.net.DefaultProxyTestProvider"> >+ </proxyTestProvider> >+ </extension> > > </plugin> >Index: src/org/eclipse/ui/internal/net/DefaultProxyTestProvider.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/net/DefaultProxyTestProvider.java >diff -N src/org/eclipse/ui/internal/net/DefaultProxyTestProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/net/DefaultProxyTestProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.net; >+ >+import java.io.IOException; >+import java.net.HttpURLConnection; >+import java.net.URL; >+ >+import org.eclipse.core.net.proxy.IProxyTestProvider; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+ >+public class DefaultProxyTestProvider implements IProxyTestProvider { >+ >+ public IStatus testConnection(String host) { >+ try { >+ URL url = new URL(host); >+ int responseCode = ((HttpURLConnection) url.openConnection()) >+ .getResponseCode(); >+ if (responseCode == 200) { >+ return new Status(IStatus.OK, Activator.PLUGIN_ID, host); >+ } else { >+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, host); >+ } >+ } catch (IOException e) { >+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, host, e); >+ } >+ } >+ >+} >Index: src/org/eclipse/ui/internal/net/NetUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/NetUIMessages.java,v >retrieving revision 1.7 >diff -u -r1.7 NetUIMessages.java >--- src/org/eclipse/ui/internal/net/NetUIMessages.java 17 Mar 2009 09:12:31 -0000 1.7 >+++ src/org/eclipse/ui/internal/net/NetUIMessages.java 1 Sep 2010 10:39:04 -0000 >@@ -42,6 +42,7 @@ > public static String ProxyPreferencePage_16; > public static String ProxyPreferencePage_17; > public static String ProxyPreferencePage_18; >+ public static String ProxyPreferencePage_19; > > public static String ProxyEntryDialog_0; > public static String ProxyEntryDialog_1; >@@ -66,6 +67,18 @@ > public static String UserValidationDialog_1; > public static String UserValidationDialog_2; > public static String UserValidationDialog_3; >+ >+ public static String ProxyTestDialog_0; >+ public static String ProxyTestDialog_1; >+ public static String ProxyTestDialog_2; >+ public static String ProxyTestDialog_3; >+ public static String ProxyTestDialog_4; >+ public static String ProxyTestDialog_5; >+ public static String ProxyTestDialog_6; >+ public static String ProxyTestDialog_7; >+ public static String ProxyTestDialog_8; >+ public static String ProxyTestDialog_9; >+ public static String ProxyTestDialog_10; > > static { > NLS.initializeMessages(BUNDLE_NAME, NetUIMessages.class); >Index: src/org/eclipse/ui/internal/net/ProxyPreferencePage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/ProxyPreferencePage.java,v >retrieving revision 1.19 >diff -u -r1.19 ProxyPreferencePage.java >--- src/org/eclipse/ui/internal/net/ProxyPreferencePage.java 10 Feb 2010 14:15:08 -0000 1.19 >+++ src/org/eclipse/ui/internal/net/ProxyPreferencePage.java 1 Sep 2010 10:39:04 -0000 >@@ -25,6 +25,7 @@ > 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.Combo; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >@@ -53,6 +54,7 @@ > createProviderComposite(composite); > createProxyEntriesComposite(composite); > createNonProxiedHostsComposite(composite); >+ createTestButton(composite); > > // Adding help accessible by F1 > PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), >@@ -90,6 +92,13 @@ > nonProxyHostsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, > true, true)); > } >+ >+ private void createTestButton(Composite parent) { >+ Button test = new Button(parent, SWT.PUSH); >+ test.setText(NetUIMessages.ProxyPreferencePage_19); >+ final ProxyTester tester = new ProxyTester(); >+ test.addSelectionListener(tester); >+ } > > public void init(IWorkbench workbench) { > // Nothing to do >Index: src/org/eclipse/ui/internal/net/ProxyTestResultDialog.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/net/ProxyTestResultDialog.java >diff -N src/org/eclipse/ui/internal/net/ProxyTestResultDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/net/ProxyTestResultDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,105 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.net; >+ >+import java.util.Iterator; >+import java.util.List; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jface.dialogs.StatusDialog; >+import org.eclipse.jface.viewers.ColumnWeightData; >+import org.eclipse.jface.viewers.TableLayout; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.custom.TableEditor; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.layout.FillLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableColumn; >+import org.eclipse.swt.widgets.TableItem; >+ >+public class ProxyTestResultDialog extends StatusDialog { >+ >+ private List testResults; >+ >+ public ProxyTestResultDialog(Shell parent, List testResults) { >+ super(parent); >+ this.testResults = testResults; >+ this.setTitle(NetUIMessages.ProxyTestDialog_0); >+ this.setHelpAvailable(false); >+ } >+ >+ >+ protected Control createDialogArea(Composite parent) { >+ Composite composite = new Composite(parent, SWT.NONE); >+ FillLayout fillLayout = new FillLayout(); >+ fillLayout.marginHeight = 10; >+ fillLayout.marginWidth = 10; >+ composite.setLayout(fillLayout); >+ >+ Table resultsTable = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); >+ resultsTable.setHeaderVisible(true); >+ resultsTable.setLinesVisible(true); >+ >+ TableLayout tableLayout = new TableLayout(); >+ tableLayout.addColumnData(new ColumnWeightData(20, 120, true)); >+ tableLayout.addColumnData(new ColumnWeightData(20, 150, true)); >+ tableLayout.addColumnData(new ColumnWeightData(20, 150, true)); >+ tableLayout.addColumnData(new ColumnWeightData(20, 50, true)); >+ tableLayout.addColumnData(new ColumnWeightData(20, 50, true)); >+ resultsTable.setLayout(tableLayout); >+ >+ TableColumn providerColumn = new TableColumn(resultsTable, SWT.NONE); >+ providerColumn.setText(NetUIMessages.ProxyTestDialog_1); >+ TableColumn descColumn = new TableColumn(resultsTable, SWT.NONE); >+ descColumn.setText(NetUIMessages.ProxyTestDialog_2); >+ TableColumn hostColumn = new TableColumn(resultsTable, SWT.NONE); >+ hostColumn.setText(NetUIMessages.ProxyTestDialog_3); >+ TableColumn resultColumn = new TableColumn(resultsTable, SWT.NONE); >+ resultColumn.setText(NetUIMessages.ProxyTestDialog_4); >+ TableColumn errorColumn = new TableColumn(resultsTable, SWT.NONE); >+ errorColumn.setText(NetUIMessages.ProxyTestDialog_5); >+ >+ if (testResults != null) { >+ Iterator it = testResults.iterator(); >+ while(it.hasNext()) { >+ final IStatus s = (IStatus) it.next(); >+ TableItem item = new TableItem(resultsTable, SWT.NONE); >+ item.setText(0, s.getPlugin()); >+ item.setText(2, s.getMessage()); >+ if (s.getSeverity() == IStatus.OK) { >+ item.setText(3, NetUIMessages.ProxyTestDialog_6); >+ } else { >+ item.setText(3, NetUIMessages.ProxyTestDialog_7); >+ } >+ if (s.getException() != null) { >+ TableEditor editor = new TableEditor(resultsTable); >+ Button details = new Button(resultsTable, SWT.NONE); >+ editor.grabHorizontal = true; >+ details.setText(NetUIMessages.ProxyTestDialog_8); >+ editor.setEditor(details, item, 4); >+ details.addSelectionListener(new SelectionAdapter() { >+ public void widgetSelected(SelectionEvent e) { >+ MessageDialog.openInformation(getShell(), NetUIMessages.ProxyTestDialog_9, s.getException().getMessage()); >+ } >+ }); >+ } >+ } >+ } >+ resultsTable.pack(); >+ return composite; >+ } >+} >Index: src/org/eclipse/ui/internal/net/ProxyTester.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/net/ProxyTester.java >diff -N src/org/eclipse/ui/internal/net/ProxyTester.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/net/ProxyTester.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,105 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.internal.net; >+ >+import java.lang.reflect.InvocationTargetException; >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.internal.net.Activator; >+import org.eclipse.core.net.proxy.IProxyTestProvider; >+import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.jface.dialogs.ProgressMonitorDialog; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; >+ >+public class ProxyTester extends SelectionAdapter { >+ >+ private static final String EXTENSION_NAME = "org.eclipse.core.net.proxyTester"; //$NON-NLS-1$ >+ private static final String[] TEST_HOSTS = { "http://www.eclipse.org" }; //$NON-NLS-1$ >+ >+ private List testProviders = new ArrayList(); >+ >+ private List results; >+ >+ List getResults() { >+ return results; >+ } >+ >+ public void widgetSelected(SelectionEvent event) { >+ final Shell shell = event.display.getActiveShell(); >+ ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); >+ try { >+ progressDialog.run(true, true, new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) { >+ execute(monitor); >+ } >+ }); >+ } catch (InvocationTargetException e) { >+ Activator.logError("Exception during proxy testing", e); //$NON-NLS-1$ >+ } catch (InterruptedException e) { >+ Activator.logError("Exception during proxy testing", e); //$NON-NLS-1$ >+ } >+ if (results != null) { >+ Display.getDefault().asyncExec(new Runnable() { >+ public void run() { >+ Dialog dialog = new ProxyTestResultDialog(shell, getResults()); >+ dialog.open(); >+ } >+ }); >+ } >+ } >+ >+ public void execute(IProgressMonitor monitor) { >+ initialize(); >+ monitor.beginTask(NetUIMessages.ProxyTestDialog_10, testProviders.size() * TEST_HOSTS.length); >+ Iterator it = testProviders.iterator(); >+ List results = new ArrayList(); >+ while (it.hasNext()) { >+ if (monitor.isCanceled()) { >+ return; >+ } >+ IProxyTestProvider test = (IProxyTestProvider) it.next(); >+ for (int i = 0; i < TEST_HOSTS.length; i++) { >+ IStatus httpStatus = test.testConnection(TEST_HOSTS[i]); >+ results.add(httpStatus); >+ monitor.worked(1); >+ } >+ } >+ this.results = results; >+ monitor.done(); >+ } >+ >+ private void initialize() { >+ testProviders.clear(); >+ IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_NAME); >+ for (int i = 0; i < extensions.length; i++) { >+ try { >+ Object object = extensions[i].createExecutableExtension("class"); //$NON-NLS-1$ >+ if (object instanceof IProxyTestProvider) { >+ testProviders.add(object); >+ } >+ } catch (CoreException e) { >+ Activator.logError("Cannot initialize proxy testers", e); //$NON-NLS-1$ >+ } >+ } >+ } >+ >+} >Index: src/org/eclipse/ui/internal/net/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.net/src/org/eclipse/ui/internal/net/messages.properties,v >retrieving revision 1.8 >diff -u -r1.8 messages.properties >--- src/org/eclipse/ui/internal/net/messages.properties 17 Mar 2009 09:12:31 -0000 1.8 >+++ src/org/eclipse/ui/internal/net/messages.properties 1 Sep 2010 10:39:05 -0000 >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2009 IBM Corporation and others. >+# Copyright (c) 2000, 2010 IBM Corporation and others. > # All rights reserved. This program and the accompanying materials > # are made available under the terms of the Eclipse Public License v1.0 > # which accompanies this distribution, and is available at >@@ -34,6 +34,7 @@ > ProxyPreferencePage_16=Edi&t... > ProxyPreferencePage_17=Re&move > ProxyPreferencePage_18=Dynamic >+ProxyPreferencePage_19=Test > > ProxyEntryDialog_0=New Proxy Entry > ProxyEntryDialog_1=Edit Proxy Entry >@@ -58,3 +59,15 @@ > UserValidationDialog_1=Connect to: {0} > UserValidationDialog_2=&Password: > UserValidationDialog_3=&User name: >+ >+ProxyTestDialog_0=Proxy Test Results >+ProxyTestDialog_1=Provider >+ProxyTestDialog_2=Description >+ProxyTestDialog_3=Tested host >+ProxyTestDialog_4=Result >+ProxyTestDialog_5=Error >+ProxyTestDialog_6=Success >+ProxyTestDialog_7=Fail >+ProxyTestDialog_8=Details >+ProxyTestDialog_9=Error Details >+ProxyTestDialog_10=Testing proxy settings... >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 299020
:
155480
|
177936
|
183463