Project: Eclipse_Platform_UI
Bug 99602 [WorkingSets] unclear dependency between identity and name
Reported: 2005-06-13 06:45:39 | Status: verified fixed

3.1-RC2 test pass The identity of working sets seems to be defined strictly by its name (a UTF-8 string). However, AbstractWorkingSetManager stores working sets in a TreeSet using a comparator based on collation, which may deem two working sets equal if they have a similar name. Example: - in the package explorer, select 'Select Working Sets...' from the view menu - create a working set 'Foo' - create a working set 'Foo\ZWS', where ZWS is a zero-width space unicode control character (when using gnome, unicode control characters can be added from the text field's context menu) -> everything seems to work as expected (both sets get displayed in the pkg explorer etc.) -> but I get the following AssertionFailedException below in the log Sorting and storing of the working sets should probably be separated. Alternatively, the entry field could filter such collisions and not allow similar names (as it does already for working set names ending with spaces). org.eclipse.jface.util.Assert$AssertionFailedException: Assertion failed: working set already registered at org.eclipse.jface.util.Assert.isTrue(Assert.java:180) at org.eclipse.ui.internal.AbstractWorkingSetManager.addWorkingSet(AbstractWorkingSetManager.java:145) at org.eclipse.ui.internal.WorkingSetManager.addWorkingSet(WorkingSetManager.java:66) at org.eclipse.jdt.internal.ui.workingsets.WorkingSetConfigurationDialog.createWorkingSet(WorkingSetConfigurationDialog.java:354) at org.eclipse.jdt.internal.ui.workingsets.WorkingSetConfigurationDialog.access$1(WorkingSetConfigurationDialog.java:340) at org.eclipse.jdt.internal.ui.workingsets.WorkingSetConfigurationDialog$4.widgetSelected(WorkingSetConfigurationDialog.java:235) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1021) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2825) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2530) at org.eclipse.jface.window.Window.runEventLoop(Window.java:809) at org.eclipse.jface.window.Window.open(Window.java:787) at org.eclipse.jdt.internal.ui.workingsets.WorkingSetConfigurationDialog.open(WorkingSetConfigurationDialog.java:405) at org.eclipse.jdt.internal.ui.workingsets.ConfigureWorkingSetAction.run(ConfigureWorkingSetAction.java:46) at org.eclipse.jface.action.Action.runWithEvent(Action.java:996) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1021) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2825) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2530) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1716) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1680) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:365) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948) Assertion failed: working set already registered

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetComparator.java tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkingSetManagerTest.java