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 96575 Details for
Bug 214796
[Proxy] org.eclipse.core.net bundle should not require org.eclipse.core.runtime
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
John's patch tidied up
214796_20080418.txt (text/plain), 10.17 KB, created by
Szymon Brandys
on 2008-04-18 05:17:43 EDT
(
hide
)
Description:
John's patch tidied up
Filename:
MIME Type:
Creator:
Szymon Brandys
Created:
2008-04-18 05:17:43 EDT
Size:
10.17 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.net >Index: src/org/eclipse/core/internal/net/ProxyManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java,v >retrieving revision 1.13 >diff -u -r1.13 ProxyManager.java >--- src/org/eclipse/core/internal/net/ProxyManager.java 14 Apr 2008 13:18:16 -0000 1.13 >+++ src/org/eclipse/core/internal/net/ProxyManager.java 18 Apr 2008 09:16:28 -0000 >@@ -28,7 +28,7 @@ > import org.eclipse.core.runtime.ISafeRunnable; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.ListenerList; >-import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.RegistryFactory; > import org.eclipse.core.runtime.SafeRunner; > import org.eclipse.core.runtime.preferences.ConfigurationScope; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; >@@ -351,7 +351,7 @@ > } > > private Authenticator getPluggedInAuthenticator() { >- IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(Activator.ID, Activator.PT_AUTHENTICATOR).getExtensions(); >+ IExtension[] extensions = RegistryFactory.getRegistry().getExtensionPoint(Activator.ID, Activator.PT_AUTHENTICATOR).getExtensions(); > if (extensions.length == 0) > return null; > IExtension extension = extensions[0]; >Index: src/org/eclipse/core/internal/net/Activator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/src/org/eclipse/core/internal/net/Activator.java,v >retrieving revision 1.4 >diff -u -r1.4 Activator.java >--- src/org/eclipse/core/internal/net/Activator.java 19 Feb 2008 21:06:25 -0000 1.4 >+++ src/org/eclipse/core/internal/net/Activator.java 18 Apr 2008 09:16:28 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -15,37 +15,47 @@ > > package org.eclipse.core.internal.net; > >+import java.util.ArrayList; > import java.util.Hashtable; > > import org.eclipse.core.net.proxy.IProxyService; >-import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.preferences.ConfigurationScope; >+import org.eclipse.osgi.framework.log.FrameworkLog; >+import org.eclipse.osgi.framework.log.FrameworkLogEntry; > import org.eclipse.osgi.service.datalocation.Location; >+import org.osgi.framework.BundleActivator; > import org.osgi.framework.BundleContext; > import org.osgi.framework.Filter; > import org.osgi.framework.InvalidSyntaxException; > import org.osgi.framework.ServiceRegistration; > import org.osgi.util.tracker.ServiceTracker; > >-public class Activator extends Plugin { >+public class Activator implements BundleActivator { > /** > * The identifier of the descriptor of this plugin in plugin.xml. > */ > public static final String ID = "org.eclipse.core.net"; //$NON-NLS-1$ >- >- public static final String PT_AUTHENTICATOR = "authenticator"; //$NON-NLS-1$ >- >- private static final String PROP_REGISTER_SERVICE = "org.eclipse.net.core.enableProxyService"; //$NON-NLS-1$ > > /** > * The instance of this plugin. > */ > private static Activator instance; > >- private ServiceRegistration proxyService; >+ private static ServiceTracker logTracker; >+ >+ private static final String PROP_REGISTER_SERVICE = "org.eclipse.net.core.enableProxyService"; //$NON-NLS-1$ >+ >+ public static final String PT_AUTHENTICATOR = "authenticator"; //$NON-NLS-1$ >+ >+ private BundleContext bundleContext; > > private ServiceTracker instanceLocationTracker; > >+ private ServiceRegistration proxyService; >+ > /** > * Constructor for use by the Eclipse platform only. > */ >@@ -56,68 +66,116 @@ > > /** > * Returns the instance of this plugin. >+ * > * @return the singleton instance of this plug-in class > */ > static public Activator getInstance() { > return instance; > } > >+ public static void log(int severity, String message, Throwable throwable) { >+ getInstance().log(new Status(severity, ID, 0, message, throwable)); >+ } >+ >+ public static void logError(String message, Throwable exc) { >+ getInstance().log(new Status(IStatus.ERROR, ID, 0, message, exc)); >+ } >+ >+ public static void logInfo(String message, Throwable exc) { >+ getInstance().log(new Status(IStatus.INFO, ID, 0, message, exc)); >+ } >+ >+ /* >+ * Log the given status to the log file. If the log is not available, log >+ * the status to the console. >+ */ >+ private void log(IStatus status) { >+ if (logTracker == null) { >+ logTracker = new ServiceTracker(bundleContext, FrameworkLog.class >+ .getName(), null); >+ logTracker.open(); >+ } >+ FrameworkLog log = (FrameworkLog) logTracker.getService(); >+ if (log != null) { >+ log.log(getLog(status)); >+ } else { >+ System.out.println(status.getMessage()); >+ if (status.getException() != null) >+ status.getException().printStackTrace(); >+ } >+ } >+ >+ /** >+ * Copied from PlatformLogWriter in core runtime. >+ */ >+ private FrameworkLogEntry getLog(IStatus status) { >+ Throwable t = status.getException(); >+ ArrayList childlist = new ArrayList(); >+ >+ int stackCode = t instanceof CoreException ? 1 : 0; >+ // ensure a substatus inside a CoreException is properly logged >+ if (stackCode == 1) { >+ IStatus coreStatus = ((CoreException) t).getStatus(); >+ if (coreStatus != null) { >+ childlist.add(getLog(coreStatus)); >+ } >+ } >+ >+ if (status.isMultiStatus()) { >+ IStatus[] children = status.getChildren(); >+ for (int i = 0; i < children.length; i++) { >+ childlist.add(getLog(children[i])); >+ } >+ } >+ >+ FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null >+ : childlist.toArray(new FrameworkLogEntry[childlist.size()])); >+ >+ return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), >+ status.getCode(), status.getMessage(), stackCode, t, children); >+ } >+ >+ public org.osgi.service.prefs.Preferences getPreferences() { >+ return new ConfigurationScope().getNode(ID); >+ } >+ >+ public boolean instanceLocationAvailable() { >+ Location instanceLocation = (Location) instanceLocationTracker >+ .getService(); >+ return (instanceLocation != null && instanceLocation.isSet()); >+ } >+ > public void start(BundleContext context) throws Exception { >- super.start(context); >- >+ this.bundleContext = context; > Filter filter = null; > try { >- filter = context.createFilter(Location.INSTANCE_FILTER); >- } catch (InvalidSyntaxException e) { >- // ignore this. It should never happen as we have tested the above format. >- } >+ filter = context.createFilter(Location.INSTANCE_FILTER); >+ } catch (InvalidSyntaxException e) { >+ // ignore this. It should never happen as we have tested the above >+ // format. >+ } > instanceLocationTracker = new ServiceTracker(context, filter, null); >- instanceLocationTracker.open(); >- >- >- if (Boolean.valueOf(System.getProperty(PROP_REGISTER_SERVICE, "true")).booleanValue()) { //$NON-NLS-1$ >- ProxyManager proxyManager = (ProxyManager)ProxyManager.getProxyManager(); >+ instanceLocationTracker.open(); >+ >+ if (Boolean >+ .valueOf(System.getProperty(PROP_REGISTER_SERVICE, "true")).booleanValue()) { //$NON-NLS-1$ >+ ProxyManager proxyManager = (ProxyManager) ProxyManager >+ .getProxyManager(); > proxyManager.initialize(); >- proxyService = context.registerService(IProxyService.class.getName(), proxyManager, new Hashtable()); >+ proxyService = context.registerService(IProxyService.class >+ .getName(), proxyManager, new Hashtable()); > } > } >- >+ > public void stop(BundleContext context) throws Exception { > if (proxyService != null) { > proxyService.unregister(); > proxyService = null; > } >- >+ > if (instanceLocationTracker != null) { > instanceLocationTracker.close(); > instanceLocationTracker = null; > } >- >- super.stop(context); >- } >- >- public static void logError(String message, Throwable exc) { >- IStatus status = new Status(IStatus.ERROR, ID, 0, message, exc); >- >- getInstance().getLog().log(status); >- } >- >- public static void logInfo(String message, Throwable exc) { >- IStatus status = new Status(IStatus.INFO, ID, 0, message, exc); >- >- getInstance().getLog().log(status); >- } >- >- public org.osgi.service.prefs.Preferences getPreferences() { >- return new ConfigurationScope().getNode(getBundle().getSymbolicName()); >- } >- >- public static void log(int severity, String message, Throwable throwable) { >- getInstance().getLog().log(new Status(severity, ID, 0, message, throwable)); >- } >- >- public boolean instanceLocationAvailable() { >- Location instanceLocation = (Location) instanceLocationTracker.getService(); >- return (instanceLocation != null && instanceLocation.isSet()); > } > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.net/META-INF/MANIFEST.MF,v >retrieving revision 1.8 >diff -u -r1.8 MANIFEST.MF >--- META-INF/MANIFEST.MF 15 Apr 2008 11:53:25 -0000 1.8 >+++ META-INF/MANIFEST.MF 18 Apr 2008 09:16:28 -0000 >@@ -6,8 +6,11 @@ > Bundle-Activator: org.eclipse.core.internal.net.Activator > Bundle-Vendor: %PLUGIN_PROVIDER > Bundle-Localization: plugin >-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)", >- org.eclipse.equinox.security;bundle-version="[1.0.0,2.0.0)" >+Require-Bundle: org.eclipse.equinox.security;bundle-version="[1.0.0,2.0.0)", >+ org.eclipse.equinox.common;bundle-version="3.4.0", >+ org.eclipse.equinox.preferences;bundle-version="3.2.200", >+ org.eclipse.osgi;bundle-version="3.4.0", >+ org.eclipse.equinox.registry;bundle-version="3.4.0" > Bundle-ActivationPolicy: lazy > Export-Package: org.eclipse.core.internal.net;x-internal:=true, > org.eclipse.core.net.proxy
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 214796
:
86498
|
93623
|
93624
|
94562
|
96057
|
96079
| 96575