Plugins load broken by org.eclipse.ui.decorator [message #1820857] |
Thu, 30 January 2020 14:50 |
M. J. Messages: 6 Registered: September 2018 |
Junior Member |
|
|
Hello,
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"?>
<plugin>
<extension
point="org.eclipse.ui.decorators">
<decorator
adaptable="true"
class="cz.mycompany.master.MasterResourceDecorator"
id="cz.mycompany.master.MasterResourceDecorator"
label="Master Resource Decorator"
lightweight="true"
state="true">
<enablement>
<and>
<objectClass
name="org.eclipse.core.resources.IResource"/>
<or>
<objectClass
name="org.eclipse.core.resources.IFolder"/>
<objectClass
name="org.eclipse.core.resources.IFile"/>
</or>
</and>
</enablement>
</decorator>
</extension>
</plugin>
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$3.run() line: 779
BundleContextImpl$3.run() 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
1935180225.run() line: not available
BusyIndicator.showWhile(Display, Runnable) line: 52
WorkbenchPlugin.createExtension(IConfigurationElement, String) line: 285
LightweightDecoratorDefinition$1.run() line: 125
SafeRunner.run(ISafeRunnable) line: 42
LightweightDecoratorDefinition.internalGetDecorator() line: 120
LightweightDecoratorDefinition.decorate(Object, IDecoration) line: 242
LightweightDecoratorManager$LightweightRunnable.run() line: 104
SafeRunner.run(ISafeRunnable) line: 42
LightweightDecoratorManager.decorate(Object, DecorationBuilder, LightweightDecoratorDefinition) line: 377
LightweightDecoratorManager.getDecorations(Object, DecorationBuilder) line: 359
DecorationScheduler$1.ensureResultCached(Object, boolean, IDecorationContext) line: 347
DecorationScheduler$1.run(IProgressMonitor) line: 311
Worker.run() 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 #1820918 is a reply to message #1820866] |
Fri, 31 January 2020 16:57 |
Eclipse User |
|
|
|
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: https://developer.ibm.com/cics/2019/01/29/osgi-declarative-service-tutorial/
|
|
|
Powered by
FUDForum. Page generated in 0.02923 seconds