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 25576 Details for
Bug 102866
Need API for updating the splash screen's progress bar
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]
patch to org.eclipse.core.runtime
patch.txt (text/plain), 8.25 KB, created by
Boris Bokowski
on 2005-08-02 14:06:28 EDT
(
hide
)
Description:
patch to org.eclipse.core.runtime
Filename:
MIME Type:
Creator:
Boris Bokowski
Created:
2005-08-02 14:06:28 EDT
Size:
8.25 KB
patch
obsolete
>Index: src/org/eclipse/core/internal/runtime/InternalPlatform.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java,v >retrieving revision 1.227 >diff -u -r1.227 InternalPlatform.java >--- src/org/eclipse/core/internal/runtime/InternalPlatform.java 5 Jul 2005 19:36:33 -0000 1.227 >+++ src/org/eclipse/core/internal/runtime/InternalPlatform.java 2 Aug 2005 18:05:25 -0000 >@@ -11,15 +11,50 @@ > *******************************************************************************/ > package org.eclipse.core.internal.runtime; > >-import java.io.*; >-import java.net.*; >-import java.util.*; >-import org.eclipse.core.internal.boot.*; >+import java.io.File; >+import java.io.IOException; >+import java.io.InputStream; >+import java.io.OutputStream; >+import java.io.PrintStream; >+import java.net.MalformedURLException; >+import java.net.URL; >+import java.net.URLConnection; >+import java.util.ArrayList; >+import java.util.Enumeration; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+import java.util.Properties; >+import java.util.ResourceBundle; >+import java.util.StringTokenizer; >+import java.util.Vector; >+ >+import org.eclipse.core.internal.boot.PlatformURLBaseConnection; >+import org.eclipse.core.internal.boot.PlatformURLConnection; >+import org.eclipse.core.internal.boot.PlatformURLHandler; > import org.eclipse.core.internal.content.ContentTypeManager; > import org.eclipse.core.internal.jobs.JobManager; > import org.eclipse.core.internal.preferences.PreferencesService; > import org.eclipse.core.internal.registry.ExtensionRegistry; >-import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IAdapterManager; >+import org.eclipse.core.runtime.IBundleGroupProvider; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtensionRegistry; >+import org.eclipse.core.runtime.ILog; >+import org.eclipse.core.runtime.ILogListener; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IProduct; >+import org.eclipse.core.runtime.IProductProvider; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.ISafeRunnable; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.MultiStatus; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.core.runtime.Plugin; >+import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.adaptor.FileManager; > import org.eclipse.core.runtime.content.IContentTypeManager; > import org.eclipse.core.runtime.jobs.IJobManager; >@@ -32,7 +67,11 @@ > import org.eclipse.osgi.service.resolver.PlatformAdmin; > import org.eclipse.osgi.service.urlconversion.URLConverter; > import org.eclipse.osgi.util.NLS; >-import org.osgi.framework.*; >+import org.osgi.framework.Bundle; >+import org.osgi.framework.BundleContext; >+import org.osgi.framework.Filter; >+import org.osgi.framework.InvalidSyntaxException; >+import org.osgi.framework.ServiceReference; > import org.osgi.service.packageadmin.PackageAdmin; > import org.osgi.util.tracker.ServiceTracker; > >@@ -249,6 +288,85 @@ > } > }); > } >+ >+ private static class StartupProgressMonitor implements IProgressMonitor { >+ private PrintStream printStream; >+ private double sumWorked = 0; >+ private int totalWork; >+ private int lastReportedWork = -1; >+ private StartupProgressMonitor(OutputStream os) { >+ printStream = new PrintStream(os); >+ } >+ private void reportWork(int value) { >+ if (lastReportedWork != value) { >+ printStream.print("value=" + value + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ >+ printStream.flush(); >+ lastReportedWork = value; >+ } >+ } >+ public void beginTask(String name, int total) { >+ this.totalWork = total; >+ String configString = System.getProperty("osgi.splashProgress.config"); //$NON-NLS-1$ >+ if (configString != null) { >+ StringTokenizer tokenizer = new StringTokenizer(configString, >+ ";"); //$NON-NLS-1$ >+ while (tokenizer.hasMoreTokens()) { >+ printStream.print(tokenizer.nextToken() + "\n"); //$NON-NLS-1$ >+ } >+ } >+ printStream.print("maximum=" + totalWork + "\n"); //$NON-NLS-1$//$NON-NLS-2$ >+ printStream.flush(); >+ } >+ public void done() { >+ if (lastReportedWork < totalWork) { >+ reportWork(totalWork); >+ } >+ } >+ public void internalWorked(double work) { >+ if (work == 0) { >+ return; >+ } >+ sumWorked += work; >+ if (sumWorked > totalWork) { >+ sumWorked = totalWork; >+ } >+ if (sumWorked < 0) { >+ sumWorked = 0; >+ } >+ reportWork((int) sumWorked); >+ } >+ public boolean isCanceled() { >+ return false; >+ } >+ public void setCanceled(boolean value) { >+ // cannot cancel >+ } >+ public void setTaskName(String name) { >+ // has no meaning >+ } >+ public void subTask(String name) { >+ printStream.print("message=" + name.replace('\n',' ') + "\n"); //$NON-NLS-1$//$NON-NLS-2$ >+ printStream.flush(); >+ } >+ public void worked(int work) { >+ internalWorked(work); >+ } >+ } >+ >+ private boolean progressMonitorReturned = false; >+ public IProgressMonitor getStartupProgressMonitor() { >+ Object handler = splashHandler; >+ if (handler != null && !progressMonitorReturned) { >+ synchronized (this) { >+ OutputStream outputStream = getSplashOutputStream(); >+ if (outputStream != null) { >+ progressMonitorReturned = true; >+ return new StartupProgressMonitor(outputStream); >+ } >+ } >+ } >+ return null; >+ } > > public URL find(Bundle b, IPath path) { > return FindSupport.find(b, path); >@@ -643,18 +761,28 @@ > } > > private Runnable getSplashHandler() { >+ // assumes the endInitializationHandler is available as a service >+ // see EclipseStarter.publishSplashScreen >+ return (Runnable) getSplashService(Runnable.class, "splashscreen"); //$NON-NLS-1$ >+ } >+ >+ private OutputStream getSplashOutputStream() { >+ // assumes the output stream is available as a service >+ // see EclipseStarter.publishSplashScreen >+ return (OutputStream) getSplashService(OutputStream.class, "splashstream"); //$NON-NLS-1$ >+ } >+ >+ private Object getSplashService(Class clazz, String serviceName) { > ServiceReference[] ref; > try { >- ref = context.getServiceReferences(Runnable.class.getName(), null); >+ ref = context.getServiceReferences(clazz.getName(), null); > } catch (InvalidSyntaxException e) { > return null; > } >- // assumes the endInitializationHandler is available as a service >- // see EclipseStarter.publishSplashScreen > for (int i = 0; i < ref.length; i++) { > String name = (String) ref[i].getProperty("name"); //$NON-NLS-1$ >- if (name != null && name.equals("splashscreen")) { //$NON-NLS-1$ >- Runnable result = (Runnable) context.getService(ref[i]); >+ if (name != null && name.equals(serviceName)) { >+ Object result = context.getService(ref[i]); > context.ungetService(ref[i]); > return result; > } >@@ -1124,4 +1252,5 @@ > public void unregisterBundleGroupProvider(IBundleGroupProvider provider) { > groupProviders.remove(provider); > } >+ > } >Index: src/org/eclipse/core/runtime/Platform.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.core.runtime/src/org/eclipse/core/runtime/Platform.java,v >retrieving revision 1.89 >diff -u -r1.89 Platform.java >--- src/org/eclipse/core/runtime/Platform.java 14 Jul 2005 18:45:59 -0000 1.89 >+++ src/org/eclipse/core/runtime/Platform.java 2 Aug 2005 18:05:25 -0000 >@@ -513,6 +513,16 @@ > public static void endSplash() { > InternalPlatform.getDefault().endSplash(); > } >+ >+ /** >+ * Returns a progress monitor for reporting startup progress, or <code>null</code> >+ * if startup progress cannot be reported. >+ * @return a progress monitor instance, or <code>null</code> >+ * @since 3.2 >+ */ >+ public static IProgressMonitor getStartupProgressMonitor() { >+ return InternalPlatform.getDefault().getStartupProgressMonitor(); >+ } > > /** > * Removes the authorization information for the specified protection
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 102866
:
25574
|
25575
| 25576