Bug 27355 - [Editor Mgmt] Restoring editor history item activates plugins
Summary: [Editor Mgmt] Restoring editor history item activates plugins
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Lynne Kues CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 27308 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-11-28 16:11 EST by Nick Edgar CLA
Modified: 2002-12-17 17:07 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2002-11-28 16:11:19 EST
build I20021127

- using the core spy tools, I restarted a workbench containing just the 
resource perspective (and spy tools perspective) with no editors open, 
although I had previously opened some Java files
- the tools showed org.eclipse.jdt.ui and related plugins getting activated

Here is the stack at the point of activation:
Activating plugin: org.eclipse.jdt.ui
Plugin activation stack:
	org.eclipse.jdt.ui
Class loading stack:
Stack trace:
java.lang.Throwable
	at org.eclipse.core.internal.runtime.PluginStats.traceActivate
(PluginStats.java:89)
	at org.eclipse.core.internal.runtime.PluginStats.startActivation
(PluginStats.java:71)
	at 
org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation
(PluginDescriptor.java:187)
	at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin
(PluginClassLoader.java:59)
	at 
org.eclipse.core.internal.plugins.PluginClassLoader.internalFindClassParentsSel
f(PluginClassLoader.java:137)
	at 
org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassParentsSelf
(DelegatingURLClassLoader.java(Compiled Code))
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass
(DelegatingURLClassLoader.java:880)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass
(DelegatingURLClassLoader.java:860)
	at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
	at 
org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension
(PluginDescriptor.java:130)
	at 
org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension
(PluginDescriptor.java:167)
	at 
org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtensio
n(ConfigurationElement.java:103)
	at org.eclipse.ui.internal.WorkbenchPlugin$1.run
(WorkbenchPlugin.java:116)
	at org.eclipse.swt.custom.BusyIndicator.showWhile
(BusyIndicator.java:65)
	at org.eclipse.ui.internal.WorkbenchPlugin.createExtension
(WorkbenchPlugin.java:113)
	at org.eclipse.ui.internal.WorkbenchPlugin.getElementFactory
(WorkbenchPlugin.java:229)
	at org.eclipse.ui.internal.EditorHistoryItem.restoreState
(EditorHistoryItem.java:61)
	at org.eclipse.ui.internal.EditorHistory.restoreState
(EditorHistory.java:122)
	at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1214)
	at org.eclipse.ui.internal.Workbench.access$7(Workbench.java:1200)
	at org.eclipse.ui.internal.Workbench$8.run(Workbench.java:838)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:843)
	at org.eclipse.core.runtime.Platform.run(Platform.java:413)
	at org.eclipse.ui.internal.Workbench.openPreviousWorkbenchState
(Workbench.java:790)
	at org.eclipse.ui.internal.Workbench.init(Workbench.java:603)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1346)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:841)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
	at org.eclipse.core.launcher.Main.run(Main.java:703)
	at org.eclipse.core.launcher.Main.main(Main.java:539)


We need to avoid activating plugins simply to present the editor history.
The plugin should only be activated if an editor history item is chosen.
We should persist the name of the item separately if needed.
Comment 1 Nick Edgar CLA 2002-11-28 16:15:03 EST
This can be worked around, allowing one to look at other plugin activation 
problems, by setting the history length to 0 in the Editors preference page.
Comment 2 Lynne Kues CLA 2002-12-06 16:08:09 EST
A test for whether or not the IEditorInput exists is used to determine whether 
or not an item is stale - if it is stale it is removed from the MRU list.  
Similarly, when an item is added to the history, any other instance of the item 
is removed from the list.  Whether or not there is another item instance is 
determined by comparing the editor inputs to see if they are equal.  For these 
two cases, since editor input may not be restored, need to compare IEditorInput 
name, tooltiptext, and factoryId and these items should be stored separately so 
that the comparison can take place without restoring the whole editor input.

Need to use IResourceChangedListener to track when to remove stale items. 
Need to change refreshItems to only look at restored editor inputs.
Comment 3 Eduardo Pereira CLA 2002-12-06 16:36:56 EST
I think we should use the same idea we used for NavigationHistorEntry. We save 
enough information to restore the item. If the resource is deleted if fails to 
open when/if the user selects that item and at that moment we can remove the 
item from the menu. Remember that it is a list of editors not resources. And 
editors do not map to resources.
Comment 4 Nick Edgar CLA 2002-12-09 10:23:17 EST
*** Bug 27308 has been marked as a duplicate of this bug. ***
Comment 5 Nick Edgar CLA 2002-12-13 00:34:10 EST
Made the changes to avoid creating the editor input eagerly (only when item is 
selected).  It compares (name, toolTipText, factoryId) when trying to match 
items.  I did not add a workspace listener to eagerly prune items.
It still prunes when shown, but only checks those items that have been 
restored.
Also made a couple of tweaks to the name display (don't consider toolTipText 
as a path if it matches the name -- a common case, e.g. for repository files).
Tested with workspace files, repository files, external class files, and 
combinations thereof, both when restored and not restored (except for 
repository files, which aren't persisted).

Comment 6 Knut Radloff CLA 2002-12-17 13:21:50 EST
I can't even reproduce this in 20021127 much less verify that it's fixed.
I have three .java files in the editor history but the jdt.ui plug-in is not 
activated on startup.
Comment 7 Nick Edgar CLA 2002-12-17 14:55:38 EST
.java files use FileEditorInput.  To reproduce the original problem, you need 
to open a .class file in an external jar.
Comment 8 Knut Radloff CLA 2002-12-17 17:07:30 EST
Verified fixed in build 20021216