Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 81322

Summary: [plug-in registry] Plugin registry view does not behave well in the case of dynamic changes
Product: [Eclipse Project] PDE Reporter: Rafael Chaves <eclipse>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: caniszczyk, eclipse, jacek.pospychala, mike.haller, patmc, wassim.melhem
Version: 3.1   
Target Milestone: 3.5 M3   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on: 248924    
Bug Blocks:    

Description Rafael Chaves CLA 2004-12-15 16:15:42 EST
i200412142000

(see related bug 81201)

I don't know what is the intended behavior for the plugin registry view in face
of dynamic changes to the set of installed plug-ins.

With the current implementation, the PDE/UI view might choke trying to process
change events as they come. The root of the problem here is the fact that change
events are not batched, and they are sent after the fact. So listeners need to
be careful and not make any assumptions about the state of the extension
registry/framework when they are handling a single event. 

In the case of the plugin registry, the safest thing to do would be to just to
discard all the information kept about the plug-in registry when an event comes
and to schedule a job to rebuild it asynchronously. If another event comes, that
job should be cancelled and rescheduled for later on. At some point, bundle
events/registry change events will stop to come and the job will be able to
rebuild the model.

Or, as suggested by Pascal, PDE UI could stop using the IPluginRegistry API and
provide the same information by processing the extension registry and the set of
bundles available through its BundleContext. I believe this is in the plan for
PDE to become a BDE sometime in the future.
Comment 1 Rafael Chaves CLA 2004-12-15 16:23:01 EST
I got this NPE after uninstalling a plug-in required by others and refreshing.

!ENTRY org.eclipse.core.runtime 4 2 2004-12-15 15:32:01.23
!MESSAGE Problems occurred when invoking code from plug-in:
"org.eclipse.core.runtime".
!STACK 0
java.lang.NullPointerException
	at
org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider.getFolderChildren(RegistryBrowserContentProvider.java:208)
	at
org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider.access$0(RegistryBrowserContentProvider.java:192)
	at
org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider$PluginFolder.getChildren(RegistryBrowserContentProvider.java:42)
	at
org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider.getChildren(RegistryBrowserContentProvider.java:129)
	at
org.eclipse.pde.internal.runtime.registry.RegistryBrowserContentProvider.hasChildren(RegistryBrowserContentProvider.java:228)
	at
org.eclipse.jface.viewers.AbstractTreeViewer.isExpandable(AbstractTreeViewer.java:1208)
	at org.eclipse.ui.part.DrillDownAdapter.canExpand(DrillDownAdapter.java:107)
	at org.eclipse.ui.part.DrillDownAdapter.canGoInto(DrillDownAdapter.java:142)
	at
org.eclipse.ui.part.DrillDownAdapter.updateNavigationButtons(DrillDownAdapter.java:338)
	at org.eclipse.ui.part.DrillDownAdapter.selectionChanged(DrillDownAdapter.java:328)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:163)
	at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1044)
	at org.eclipse.core.runtime.Platform.run(Platform.java:747)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:161)
	at
org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:1667)
	at
org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:935)
	at
org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:961)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:209)
	at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:204)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:364)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:710)
	at org.eclipse.core.launcher.Main.main(Main.java:694)
Comment 2 Wassim Melhem CLA 2006-02-28 22:05:03 EST
*** Bug 88068 has been marked as a duplicate of this bug. ***
Comment 3 Janek Lasocki-Biczysko CLA 2006-04-10 16:23:42 EDT
Fixed
Comment 4 Mike Haller CLA 2007-08-31 07:36:19 EDT
If you uninstall a bundle, e.g. using the console "uninstall" command, the View still shows the bundle and throws Exceptions when user tries to expand the bundle folder in the view.

!ENTRY org.eclipse.jface 4 2 2007-08-31 09:24:31.000
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.IllegalStateException: Bundle "update@plugins/com.example.ch.settlement.ui_1.0.68.jar" has been uninstalled
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.checkValid(AbstractBundle.java:1199)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.getEntry(AbstractBundle.java:1279)
        at org.eclipse.pde.internal.runtime.registry.RegistryBrowserLabelProvider.getText(RegistryBrowserLabelProvider.java:177)
        at org.eclipse.jface.viewers.StructuredViewer.buildLabel(StructuredViewer.java:2102)
        at org.eclipse.jface.viewers.TreeViewer.doUpdateItem(TreeViewer.java:258)
        at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:95)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)


The View should handle this appropriately, e.g. do not allow the TreeItem to be expanded.
Comment 5 Janek Lasocki-Biczysko CLA 2007-08-31 13:26:55 EDT
I'd like to revisit this one.
However, instead of removing the uninstalled bundle's children (and disallowing expansion) it would make sense to remove the bundle itself (from the browser tree).  Any thoughts?

Note: the Registry Browser still needs more work to adapt to all of the possible dynamics - although we are being slightly held back by the (lack of) information provided in IExtensionDelta (see bug 130655)

As far as I can tell, stopped bundles aren't displaying properly either...

Reopening for now and adding Chris in for discussion.
Comment 6 Janek Lasocki-Biczysko CLA 2007-09-02 12:38:36 EDT
Addressed the most recent issue, but leaving open for the IExtensionDelta bug (see previous comment)
Comment 7 Janek Lasocki-Biczysko CLA 2007-11-15 12:51:46 EST
Update:
Requested APIs have been added, (bug 206936)
A stable upgraded RegistryBrowser has been committed although still requires more work (especially to handle the changes made by bug 200570)
Comment 8 Janek Lasocki-Biczysko CLA 2007-11-30 10:58:24 EST
Unfortunately I do not have time to continue this at the moment.
It is in a good state, although more features are required to mark this as complete. Specifically better behaviour in the registry view when extensions/extension points are added/removed.

Re-assigning back to inbox. Who ever picks up this bug, feel free to contact me I _may_ be able to give a hand.
Comment 9 Jacek Pospychala CLA 2008-01-26 16:01:15 EST
czesc Janek
do you still have any hands to give? ;)
Comment 10 Jacek Pospychala CLA 2008-02-24 16:06:32 EST
after a bit of playing with view, things that need addressing:
1. RegistryBrowserListener should not navigate tree using TreeItem widgets like it happens to do now, but should use model.
2. There are some cache maps in RegistryBrowserContentProvider that make it hard to update model directly. I'll ideally move them to respective nodes.

I'll need to work out some reasonable testing tool to simulate all dynamic events that can happen...
Comment 11 Jacek Pospychala CLA 2008-10-21 06:27:25 EDT
This should be fixed with new notification mechanism in plug-in registry view implemented in bug 243441.
So far I've been testing manually and to some extent with unit tests.
Let's wait for bug 248924 to be sure.
Comment 12 Chris Aniszczyk CLA 2008-10-24 16:25:29 EDT
I think we're good here now.