|
Lines 11-25
Link Here
|
| 11 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 12 |
package org.eclipse.core.internal.runtime; |
12 |
package org.eclipse.core.internal.runtime; |
| 13 |
|
13 |
|
| 14 |
import java.io.*; |
14 |
import java.io.File; |
| 15 |
import java.net.*; |
15 |
import java.io.IOException; |
| 16 |
import java.util.*; |
16 |
import java.io.InputStream; |
| 17 |
import org.eclipse.core.internal.boot.*; |
17 |
import java.io.OutputStream; |
|
|
18 |
import java.io.PrintStream; |
| 19 |
import java.net.MalformedURLException; |
| 20 |
import java.net.URL; |
| 21 |
import java.net.URLConnection; |
| 22 |
import java.util.ArrayList; |
| 23 |
import java.util.Enumeration; |
| 24 |
import java.util.HashMap; |
| 25 |
import java.util.List; |
| 26 |
import java.util.Map; |
| 27 |
import java.util.Properties; |
| 28 |
import java.util.ResourceBundle; |
| 29 |
import java.util.StringTokenizer; |
| 30 |
import java.util.Vector; |
| 31 |
|
| 32 |
import org.eclipse.core.internal.boot.PlatformURLBaseConnection; |
| 33 |
import org.eclipse.core.internal.boot.PlatformURLConnection; |
| 34 |
import org.eclipse.core.internal.boot.PlatformURLHandler; |
| 18 |
import org.eclipse.core.internal.content.ContentTypeManager; |
35 |
import org.eclipse.core.internal.content.ContentTypeManager; |
| 19 |
import org.eclipse.core.internal.jobs.JobManager; |
36 |
import org.eclipse.core.internal.jobs.JobManager; |
| 20 |
import org.eclipse.core.internal.preferences.PreferencesService; |
37 |
import org.eclipse.core.internal.preferences.PreferencesService; |
| 21 |
import org.eclipse.core.internal.registry.ExtensionRegistry; |
38 |
import org.eclipse.core.internal.registry.ExtensionRegistry; |
| 22 |
import org.eclipse.core.runtime.*; |
39 |
import org.eclipse.core.runtime.CoreException; |
|
|
40 |
import org.eclipse.core.runtime.IAdapterManager; |
| 41 |
import org.eclipse.core.runtime.IBundleGroupProvider; |
| 42 |
import org.eclipse.core.runtime.IConfigurationElement; |
| 43 |
import org.eclipse.core.runtime.IExtensionRegistry; |
| 44 |
import org.eclipse.core.runtime.ILog; |
| 45 |
import org.eclipse.core.runtime.ILogListener; |
| 46 |
import org.eclipse.core.runtime.IPath; |
| 47 |
import org.eclipse.core.runtime.IProduct; |
| 48 |
import org.eclipse.core.runtime.IProductProvider; |
| 49 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 50 |
import org.eclipse.core.runtime.ISafeRunnable; |
| 51 |
import org.eclipse.core.runtime.IStatus; |
| 52 |
import org.eclipse.core.runtime.MultiStatus; |
| 53 |
import org.eclipse.core.runtime.OperationCanceledException; |
| 54 |
import org.eclipse.core.runtime.Path; |
| 55 |
import org.eclipse.core.runtime.Platform; |
| 56 |
import org.eclipse.core.runtime.Plugin; |
| 57 |
import org.eclipse.core.runtime.Status; |
| 23 |
import org.eclipse.core.runtime.adaptor.FileManager; |
58 |
import org.eclipse.core.runtime.adaptor.FileManager; |
| 24 |
import org.eclipse.core.runtime.content.IContentTypeManager; |
59 |
import org.eclipse.core.runtime.content.IContentTypeManager; |
| 25 |
import org.eclipse.core.runtime.jobs.IJobManager; |
60 |
import org.eclipse.core.runtime.jobs.IJobManager; |
|
Lines 32-38
Link Here
|
| 32 |
import org.eclipse.osgi.service.resolver.PlatformAdmin; |
67 |
import org.eclipse.osgi.service.resolver.PlatformAdmin; |
| 33 |
import org.eclipse.osgi.service.urlconversion.URLConverter; |
68 |
import org.eclipse.osgi.service.urlconversion.URLConverter; |
| 34 |
import org.eclipse.osgi.util.NLS; |
69 |
import org.eclipse.osgi.util.NLS; |
| 35 |
import org.osgi.framework.*; |
70 |
import org.osgi.framework.Bundle; |
|
|
71 |
import org.osgi.framework.BundleContext; |
| 72 |
import org.osgi.framework.Filter; |
| 73 |
import org.osgi.framework.InvalidSyntaxException; |
| 74 |
import org.osgi.framework.ServiceReference; |
| 36 |
import org.osgi.service.packageadmin.PackageAdmin; |
75 |
import org.osgi.service.packageadmin.PackageAdmin; |
| 37 |
import org.osgi.util.tracker.ServiceTracker; |
76 |
import org.osgi.util.tracker.ServiceTracker; |
| 38 |
|
77 |
|
|
Lines 249-254
Link Here
|
| 249 |
} |
288 |
} |
| 250 |
}); |
289 |
}); |
| 251 |
} |
290 |
} |
|
|
291 |
|
| 292 |
private static class StartupProgressMonitor implements IProgressMonitor { |
| 293 |
private PrintStream printStream; |
| 294 |
private double sumWorked = 0; |
| 295 |
private int totalWork; |
| 296 |
private int lastReportedWork = -1; |
| 297 |
private StartupProgressMonitor(OutputStream os) { |
| 298 |
printStream = new PrintStream(os); |
| 299 |
} |
| 300 |
private void reportWork(int value) { |
| 301 |
if (lastReportedWork != value) { |
| 302 |
printStream.print("value=" + value + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
| 303 |
printStream.flush(); |
| 304 |
lastReportedWork = value; |
| 305 |
} |
| 306 |
} |
| 307 |
public void beginTask(String name, int total) { |
| 308 |
this.totalWork = total; |
| 309 |
String configString = System.getProperty("osgi.splashProgress.config"); //$NON-NLS-1$ |
| 310 |
if (configString != null) { |
| 311 |
StringTokenizer tokenizer = new StringTokenizer(configString, |
| 312 |
";"); //$NON-NLS-1$ |
| 313 |
while (tokenizer.hasMoreTokens()) { |
| 314 |
printStream.print(tokenizer.nextToken() + "\n"); //$NON-NLS-1$ |
| 315 |
} |
| 316 |
} |
| 317 |
printStream.print("maximum=" + totalWork + "\n"); //$NON-NLS-1$//$NON-NLS-2$ |
| 318 |
printStream.flush(); |
| 319 |
} |
| 320 |
public void done() { |
| 321 |
if (lastReportedWork < totalWork) { |
| 322 |
reportWork(totalWork); |
| 323 |
} |
| 324 |
} |
| 325 |
public void internalWorked(double work) { |
| 326 |
if (work == 0) { |
| 327 |
return; |
| 328 |
} |
| 329 |
sumWorked += work; |
| 330 |
if (sumWorked > totalWork) { |
| 331 |
sumWorked = totalWork; |
| 332 |
} |
| 333 |
if (sumWorked < 0) { |
| 334 |
sumWorked = 0; |
| 335 |
} |
| 336 |
reportWork((int) sumWorked); |
| 337 |
} |
| 338 |
public boolean isCanceled() { |
| 339 |
return false; |
| 340 |
} |
| 341 |
public void setCanceled(boolean value) { |
| 342 |
// cannot cancel |
| 343 |
} |
| 344 |
public void setTaskName(String name) { |
| 345 |
// has no meaning |
| 346 |
} |
| 347 |
public void subTask(String name) { |
| 348 |
printStream.print("message=" + name.replace('\n',' ') + "\n"); //$NON-NLS-1$//$NON-NLS-2$ |
| 349 |
printStream.flush(); |
| 350 |
} |
| 351 |
public void worked(int work) { |
| 352 |
internalWorked(work); |
| 353 |
} |
| 354 |
} |
| 355 |
|
| 356 |
private boolean progressMonitorReturned = false; |
| 357 |
public IProgressMonitor getStartupProgressMonitor() { |
| 358 |
Object handler = splashHandler; |
| 359 |
if (handler != null && !progressMonitorReturned) { |
| 360 |
synchronized (this) { |
| 361 |
OutputStream outputStream = getSplashOutputStream(); |
| 362 |
if (outputStream != null) { |
| 363 |
progressMonitorReturned = true; |
| 364 |
return new StartupProgressMonitor(outputStream); |
| 365 |
} |
| 366 |
} |
| 367 |
} |
| 368 |
return null; |
| 369 |
} |
| 252 |
|
370 |
|
| 253 |
public URL find(Bundle b, IPath path) { |
371 |
public URL find(Bundle b, IPath path) { |
| 254 |
return FindSupport.find(b, path); |
372 |
return FindSupport.find(b, path); |
|
Lines 643-660
Link Here
|
| 643 |
} |
761 |
} |
| 644 |
|
762 |
|
| 645 |
private Runnable getSplashHandler() { |
763 |
private Runnable getSplashHandler() { |
|
|
764 |
// assumes the endInitializationHandler is available as a service |
| 765 |
// see EclipseStarter.publishSplashScreen |
| 766 |
return (Runnable) getSplashService(Runnable.class, "splashscreen"); //$NON-NLS-1$ |
| 767 |
} |
| 768 |
|
| 769 |
private OutputStream getSplashOutputStream() { |
| 770 |
// assumes the output stream is available as a service |
| 771 |
// see EclipseStarter.publishSplashScreen |
| 772 |
return (OutputStream) getSplashService(OutputStream.class, "splashstream"); //$NON-NLS-1$ |
| 773 |
} |
| 774 |
|
| 775 |
private Object getSplashService(Class clazz, String serviceName) { |
| 646 |
ServiceReference[] ref; |
776 |
ServiceReference[] ref; |
| 647 |
try { |
777 |
try { |
| 648 |
ref = context.getServiceReferences(Runnable.class.getName(), null); |
778 |
ref = context.getServiceReferences(clazz.getName(), null); |
| 649 |
} catch (InvalidSyntaxException e) { |
779 |
} catch (InvalidSyntaxException e) { |
| 650 |
return null; |
780 |
return null; |
| 651 |
} |
781 |
} |
| 652 |
// assumes the endInitializationHandler is available as a service |
|
|
| 653 |
// see EclipseStarter.publishSplashScreen |
| 654 |
for (int i = 0; i < ref.length; i++) { |
782 |
for (int i = 0; i < ref.length; i++) { |
| 655 |
String name = (String) ref[i].getProperty("name"); //$NON-NLS-1$ |
783 |
String name = (String) ref[i].getProperty("name"); //$NON-NLS-1$ |
| 656 |
if (name != null && name.equals("splashscreen")) { //$NON-NLS-1$ |
784 |
if (name != null && name.equals(serviceName)) { |
| 657 |
Runnable result = (Runnable) context.getService(ref[i]); |
785 |
Object result = context.getService(ref[i]); |
| 658 |
context.ungetService(ref[i]); |
786 |
context.ungetService(ref[i]); |
| 659 |
return result; |
787 |
return result; |
| 660 |
} |
788 |
} |
|
Lines 1124-1127
Link Here
|
| 1124 |
public void unregisterBundleGroupProvider(IBundleGroupProvider provider) { |
1252 |
public void unregisterBundleGroupProvider(IBundleGroupProvider provider) { |
| 1125 |
groupProviders.remove(provider); |
1253 |
groupProviders.remove(provider); |
| 1126 |
} |
1254 |
} |
|
|
1255 |
|
| 1127 |
} |
1256 |
} |