Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Plugins load broken by org.eclipse.ui.decorator(The decorator extension corrupts the order in which the plugins gets loaded)
Plugins load broken by org.eclipse.ui.decorator [message #1820857] Thu, 30 January 2020 14:50 Go to next message
M. J. is currently offline M. J.Friend
Messages: 4
Registered: September 2018
Junior Member

I'm facing quite strange problem with the RCP application. I'm having two old plugins, call them Configurator and Master. The only job of the Configurator is to do some configuration and preparation before the Master starts. Obviously, the Master is the main plugin doing all the desired work.

Since we migrated to Eclipse Oxygen, it arised problem with theese two plugins. For some reason(s), now the Master plugin starts before the Configurator plugin. What the Configurator plugin does, is then silently igored (note: to take it into account, you need to restart the eclipse).

I've inspected what's happening in there and found following. The Master plugin uses extension org.eclipse.ui.decorator :
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
            label="Master Resource Decorator"

where MasterResourceDecorator implements ILightweightLabelDecorator . It seems this tiny bit is the cause of the troubles. I put the breakpoint on the Master plugin startup. This the stack trace of the plugin start invocation:
Thread [Worker-5] (Suspended (breakpoint at line 109 in MasterPlugin))	
	MasterPlugin.start(BundleContext) line: 109	
	BundleContextImpl$ line: 779	
	BundleContextImpl$ line: 1	
	AccessController.doPrivileged(PrivilegedExceptionAction<T>) line: not available [native method]	
	BundleContextImpl.startActivator(BundleActivator) line: 772	
	BundleContextImpl.start() line: 729	
	EquinoxBundle.startWorker0() line: 933	
	EquinoxBundle$EquinoxModule.startWorker() line: 309	
	EquinoxBundle$EquinoxModule(Module).doStart(Module$StartOptions...) line: 581	
	EquinoxBundle$EquinoxModule(Module).start(Module$StartOptions...) line: 449	
	SecureAction.start(Module, Module$StartOptions...) line: 468	
	EclipseLazyStarter.postFindLocalClass(String, Class<?>, ClasspathManager) line: 103	
	ClasspathManager.findLocalClass(String) line: 529	
	EquinoxClassLoader(ModuleClassLoader).findLocalClass(String) line: 328	
	BundleLoader.findLocalClass(String) line: 368	
	BundleLoader.findClassInternal(String, boolean) line: 446	
	BundleLoader.findClass(String, boolean) line: 395	
	BundleLoader.findClass(String) line: 387	
	EquinoxClassLoader(ModuleClassLoader).loadClass(String, boolean) line: 150	
	EquinoxClassLoader(ClassLoader).loadClass(String) line: 357	
	EquinoxBundle.loadClass(String) line: 564	
	EquinoxRegistryStrategy(RegistryStrategyOSGI).createExecutableExtension(RegistryContributor, String, String) line: 174	
	ExtensionRegistry.createExecutableExtension(RegistryContributor, String, String) line: 905	
	ConfigurationElement.createExecutableExtension(String) line: 243	
	ConfigurationElementHandle.createExecutableExtension(String) line: 55	
	WorkbenchPlugin.lambda$0(Object[], IConfigurationElement, String, CoreException[]) line: 288 line: not available	
	BusyIndicator.showWhile(Display, Runnable) line: 52	
	WorkbenchPlugin.createExtension(IConfigurationElement, String) line: 285	
	LightweightDecoratorDefinition$ line: 125 line: 42	
	LightweightDecoratorDefinition.internalGetDecorator() line: 120	
	LightweightDecoratorDefinition.decorate(Object, IDecoration) line: 242	
	LightweightDecoratorManager$ line: 104 line: 42	
	LightweightDecoratorManager.decorate(Object, DecorationBuilder, LightweightDecoratorDefinition) line: 377	
	LightweightDecoratorManager.getDecorations(Object, DecorationBuilder) line: 359	
	DecorationScheduler$1.ensureResultCached(Object, boolean, IDecorationContext) line: 347	
	DecorationScheduler$ line: 311 line: 56	

(the MasterPlugin extends AbstractUIPlugin )

As far I understand that, that means that the Master plugin get loaded because of the workbench wants to create and run the decorator, which requires the plugin to be loaded. So it prematurely loads the plugin Master. Later, when the eclipse platform "core" is completelly up, it starts the user plugins, including the Configurator plugin. But that's too late, the Master plugin is already up at that time.

Do I understand it right? Is there any way how to avoid this behaviour? Like, to change anything inside of the decorator (like to make it lazy)?

Thanks in advice

Re: Plugins load broken by org.eclipse.ui.decorator [message #1820866 is a reply to message #1820857] Thu, 30 January 2020 19:21 Go to previous messageGo to next message
Rolf Theunissen is currently offline Rolf TheunissenFriend
Messages: 179
Registered: April 2012
Senior Member
I am no expert on the topic, but you can exclude some classes from the lazy activation in the Manifest.

Bundle-ActivationPolicy: lazy; exclude:="cz.mycompany.master"
Re: Plugins load broken by org.eclipse.ui.decorator [message #1820918 is a reply to message #1820866] Fri, 31 January 2020 16:57 Go to previous message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 876
Registered: January 2012
Senior Member

TIL: I didn't know B-AP had an exclude directive!

But I don't think his problem is the lazy activation policy. That means that the bundle will be automatically activated when a bundle's resource is accessed. If not lazy, then the bundle must be explicitly started.

It sounds like your configuration bundle does some work in its activator class. So one approach is to somehow explicitly tie your master plugin to your configuration bundles such that your master requests a service or resource from the configuration bundle and so activates it.

It's not clear to me what your configurator is doing, but I'm guessing it must write some files to disk, etc. One approach is to have your configuration bundle export an `IConfiguration` type object as an OSGi Declarative Service. Your master plugin would then request that service, which would lead to the activation of the configuration bundle.

There's some information here:

Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Previous Topic:Debug configuration - HELP
Next Topic:Eclipse - Wizard Page
Goto Forum:

Current Time: Fri Oct 30 23:41:05 GMT 2020

Powered by FUDForum. Page generated in 0.01381 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top