Bug 5868

Summary: Define working set does too much work in the UI thread
Product: [Eclipse Project] JDT Reporter: John Arthorne <john.arthorne>
Component: UIAssignee: Dani Megert <daniel_megert>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2    
Version: 2.0   
Target Milestone: 2.0 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description John Arthorne CLA 2001-11-13 14:56:03 EST
Trying out the "Working set filter" in the packages view.  Really nice feature!  
The problem I've encountered is that it does too much work in the UI thread.  
This example is a bit extreme because I was tracking down another problem, but 
it illustrates the problem:

1) Workspace with a single folder, containing 2000 java files
2) In the packages view, select "Filter working sets"
3) Click "New"
4) Expand the folder -- 2 minute pause
5) Select a single file (add a checkmark)
6) Click OK-- another 2 minute pause.

During both pauses, the UI thread is completely unresponsive.  If it's doing 
alot of work, it should minimally be done in a non UI thread with some form of 
progress indication.  Below is a sample stack during the pause of step 6:

    "main" (TID:0x8e87e0, sys_thread_t:0x235500, state:R, native ID:0xc4) prio=5

        at org.eclipse.swt.internal.win32.OS.GetWindowLongW(Native Method)
        at org.eclipse.swt.internal.win32.OS.GetWindowLong(OS.java(Compiled Code
))
        at org.eclipse.swt.widgets.WidgetTable.get(WidgetTable.java(Compiled Cod
e))
        at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code
))
        at org.eclipse.swt.internal.win32.OS.SendMessageW(Native Method)
        at org.eclipse.swt.internal.win32.OS.SendMessage(OS.java(Compiled Code))

        at org.eclipse.swt.widgets.TreeItem.getItems(TreeItem.java(Compiled Code
))
        at org.eclipse.jface.viewers.TreeViewer.getChildren(TreeViewer.java(Comp
iled Code))
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalFindItem(Abstrac
tTreeViewer.java(Compiled Code))
        at org.eclipse.jface.viewers.AbstractTreeViewer.internalFindItem(Abstrac
tTreeViewer.java(Compiled Code))
        at org.eclipse.jface.viewers.AbstractTreeViewer.doFindItem(AbstractTreeV
iewer.java(Compiled Code))
        at org.eclipse.jface.viewers.StructuredViewer.findItem(StructuredViewer.
java(Compiled Code))
        at org.eclipse.jface.viewers.CheckboxTreeViewer.getChecked(CheckboxTreeV
iewer.java(Compiled Code))
        at org.eclipse.search.internal.workingsets.WorkingSetDialog.findCheckedR
esources(WorkingSetDialog.java(Compiled Code))
        at org.eclipse.search.internal.workingsets.WorkingSetDialog.findCheckedR
esources(WorkingSetDialog.java(Compiled Code))
        at org.eclipse.search.internal.workingsets.WorkingSetDialog.findCheckedR
esources(WorkingSetDialog.java(Compiled Code))
        at org.eclipse.search.internal.workingsets.WorkingSetDialog.okPressed(Wo
rkingSetDialog.java:136)
        at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:106)
        at org.eclipse.jface.dialogs.InputDialog.buttonPressed(InputDialog.java:
92)
        at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:211)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:
85)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled
 Code))
        at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compil
ed Code))
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled
 Code))
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:536)
        at org.eclipse.jface.window.Window.open(Window.java:523)
        at org.eclipse.search.internal.workingsets.WorkingSetSelectionDialog$1.w
idgetSelected(WorkingSetSelectionDialog.java:107)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:
85)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled
 Code))
        at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compil
ed Code))
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled
 Code))
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:536)
        at org.eclipse.jface.window.Window.open(Window.java:523)
        at org.eclipse.jdt.internal.ui.packageview.FilterWorkingSetAction.run(Fi
lterWorkingSetAction.java:46)
        at org.eclipse.jface.action.Action.runWithEvent(Action.java:453)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(Act
ionContributionItem.java:361)
        at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContri
butionItem.java:352)
        at org.eclipse.jface.action.ActionContributionItem$ActionListener.handle
Event(ActionContributionItem.java:47)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled
 Code))
        at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compil
ed Code))
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled
 Code))
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:727)
        at org.eclipse.ui.internal.Workbench.run(Workbench.java:710)
        at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa
der.java:820)
        at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
        at org.eclipse.core.launcher.Main.run(Main.java:502)
        at org.eclipse.core.launcher.Main.main(Main.java:362)
Comment 1 Erich Gamma CLA 2001-11-13 15:53:07 EST
Looks like the grey check mark logic is the culprit. May be we should cheat as 
the import dialog does.
Comment 2 Dani Megert CLA 2001-12-04 10:41:51 EST
Yep. Has to be fixed.
Comment 3 Dani Megert CLA 2001-12-10 09:38:51 EST
Fixed
Available in builds > 20011210