Community
Participate
Working Groups
The name filter of the object contributions calls toString on the selection. This is problematic since toString should be used for debug purposes only. In particular the IJavaElement serializes the object hierarchy. This is expensive. Changing the toString implementation of the IJavaElements is not an option since the test suites depend on the current implementation. see 19115 for a trace.
problem looks like an oversight. toString is always called first even when the element implements the WorkbenchAdapter. private boolean testName(Object object) { String nameFilter = config.getAttribute(ATT_NAME_FILTER); if (nameFilter == null) return true; String objectName = object.toString(); if (object instanceof IAdaptable) {
We'll fix it.
*** Bug 19115 has been marked as a duplicate of this bug. ***
Made the following change. Old code: private boolean testName(Object object) { String nameFilter = config.getAttribute(ATT_NAME_FILTER); if (nameFilter == null) return true; String objectName = object.toString(); if (object instanceof IAdaptable) { IAdaptable element = (IAdaptable) object; IWorkbenchAdapter de = (IWorkbenchAdapter)element.getAdapter (IWorkbenchAdapter.class); if (de != null) objectName = de.getLabel(element); } return SelectionEnabler.verifyNameMatch(objectName, nameFilter); } New code: private boolean testName(Object object) { String nameFilter = config.getAttribute(ATT_NAME_FILTER); if (nameFilter == null) return true; String objectName = null; if (object instanceof IAdaptable) { IAdaptable element = (IAdaptable) object; IWorkbenchAdapter de = (IWorkbenchAdapter)element.getAdapter (IWorkbenchAdapter.class); if (de != null) objectName = de.getLabel(element); } if (objectName == null) { objectName = object.toString(); } return SelectionEnabler.verifyNameMatch(objectName, nameFilter); }
Fixed in I-20020607.