| Summary: | [WorkingSets] WorkingSetManager allows addition of WorkingSet with same name but different labels. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Hitesh <hsoliwal> | ||||
| Component: | UI | Assignee: | Hitesh <hsoliwal> | ||||
| Status: | RESOLVED DUPLICATE | QA Contact: | Eric Moffatt <emoffatt> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | emoffatt | ||||
| Version: | 3.5 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 212583 | ||||||
| Attachments: |
|
||||||
Should I assign this one to you ? Eric, please assign this to me. Created attachment 125201 [details]
patch
Eric, Bug 212583, depending on the solution, either depends on this or may even fix this. Hitesh, if this defect were fixed would it fix the other one(s)? (In reply to comment #5) > Hitesh, if this defect were fixed would it fix the other one(s)? > Eric ,no, the other way around.A possible fix for Bug 212583 could also fix this bug. Hitesh, if this has been fixed by the changes made in bug 212583 you might want to mark this one as a DUP. *** This bug has been marked as a duplicate of bug 212583 *** |
The spec for IWorkingSet.setName(String) says "Sets the name of the working set. The working set name should be unique. The working set name must not have leading or trailing whitespace." Steps To Reproduce: Goto Eclipse Unit Tests. Class - org.eclipse.ui.tests.api.IWorkingSetTest. Add the following test just BEFORE the "testSetName()" and execute. public void testNoDuplicateWorkingSetNamesDifferentLabels() throws Throwable { /* get workingSetManager */ IWorkingSetManager workingSetManager = fWorkbench .getWorkingSetManager(); /* * check that initially workingSetManager contains "fWorkingSet" */ assertTrue(ArrayUtil.equals(new IWorkingSet[] { fWorkingSet }, workingSetManager.getWorkingSets())); String sameName = fWorkingSet.getName(); IWorkingSet wSet = workingSetManager.createWorkingSet(sameName, new IAdaptable[] {}); wSet.setLabel(WORKING_SET_NAME_2); /* * Expected to throw an error as the wSet has the same name as * fWorkingSet */ boolean exceptionThrown = false; try { workingSetManager.addWorkingSet(wSet); /* Test failed, restore state */ workingSetManager.removeWorkingSet(wSet); } catch (RuntimeException exception) { exceptionThrown = true; } assertTrue(exceptionThrown); } More information: The AbstractWorkingSetManager uses a SortedSet in conjunction with a Comparator that compares labels and then names to determine equality.