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 96079 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]
Remove dependency on core.runtime
patch.txt (text/plain), 9.87 KB, created by
John Arthorne
on 2008-04-15 10:29:45 EDT
(
hide
)
Description:
Remove dependency on core.runtime
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2008-04-15 10:29:45 EDT
Size:
9.87 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.net >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 15 Apr 2008 14:27:26 -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 >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 15 Apr 2008 14:27:26 -0000 >@@ -21,15 +21,7 @@ > import org.eclipse.core.net.proxy.IProxyChangeListener; > import org.eclipse.core.net.proxy.IProxyData; > import org.eclipse.core.net.proxy.IProxyService; >-import org.eclipse.core.runtime.Assert; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IConfigurationElement; >-import org.eclipse.core.runtime.IExtension; >-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.SafeRunner; >+import org.eclipse.core.runtime.*; > import org.eclipse.core.runtime.preferences.ConfigurationScope; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; > import org.eclipse.core.runtime.preferences.InstanceScope; >@@ -351,7 +343,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 15 Apr 2008 14:27:26 -0000 >@@ -15,36 +15,56 @@ > > 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.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.BundleContext; >-import org.osgi.framework.Filter; >-import org.osgi.framework.InvalidSyntaxException; >-import org.osgi.framework.ServiceRegistration; >+import org.osgi.framework.*; > 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; >+ >+ /** >+ * 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)); >+ } > > /** > * Constructor for use by the Eclipse platform only. >@@ -55,69 +75,87 @@ > } > > /** >- * Returns the instance of this plugin. >- * @return the singleton instance of this plug-in class >+ * Copied from PlatformLogWriter in core runtime. > */ >- static public Activator getInstance() { >- return instance; >+ 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()); >+ } >+ >+ /* >+ * 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(); >+ } > } > > 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(); >- >- >+ instanceLocationTracker.open(); >+ > if (Boolean.valueOf(System.getProperty(PROP_REGISTER_SERVICE, "true")).booleanValue()) { //$NON-NLS-1$ >- ProxyManager proxyManager = (ProxyManager)ProxyManager.getProxyManager(); >+ ProxyManager proxyManager = (ProxyManager) ProxyManager.getProxyManager(); > proxyManager.initialize(); > 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()); > } > }
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