| Summary: | [Viewers] [Provider] ClassCastException happened at jface when selecting tree with using picture-capture software. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | KAM <kazuaki.matsuba> | ||||||
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Hitesh <hsoliwal> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | bokowski, hidenobu.shinozuka, kazuaki.matsuba, soichiro.yoshimura, youhei.hina | ||||||
| Version: | 4.0 | ||||||||
| Target Milestone: | 3.7 M1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
KAM
We should fix this for 3.6.1. KAM, would you be able to attach a small snippet that shows how the JFace viewer is set up? Created attachment 170906 [details]
Snippets for causing Jface bug
This attachment file is a simple snippets making a simple tree structure, which cause ClassCastException.
Please unzip this attachment file and import.
Created attachment 170916 [details] Patch V01 (In reply to comment #1) > We should fix this for 3.6.1. > > KAM, would you be able to attach a small snippet that shows how the JFace > viewer is set up? CellLabelProvider labelProvider = viewPart.getLabelProvider(); if (labelProvider instanceof ILabelProvider) event.result = ((ILabelProvider) labelProvider).getText(element); The above should fix the CCE. Boris, do we not need to take care of IStyledLabelProvider ? Yes, we should test for IStyledLabelProvider as well. However, there are other cases that would still be unaccounted for, for example org.eclipse.ui.internal.ide.dialogs.PathVariablesGroup.ValueLabelProvider. Another approach would be to create a ViewerCell object and call CellLabelProvider.update(viewerCell), and then only using whatever was passed to viewerCell.setText(). (In reply to comment #4) > Yes, we should test for IStyledLabelProvider as well. > > However, there are other cases that would still be unaccounted for, for example > org.eclipse.ui.internal.ide.dialogs.PathVariablesGroup.ValueLabelProvider. > > Another approach would be to create a ViewerCell object and call > CellLabelProvider.update(viewerCell), and then only using whatever was passed > to viewerCell.setText(). Something along the lines of labelProvider.update(cell); event.result = cell.getText(); Why create a new viewercell? and this may have some additional cost although a small one . (In reply to comment #5) > Why create a new viewercell? and this may have some additional cost although a > small one . Do we already have a ViewerCell object? (sorry, don't have the code in front of me right now) The reason for going with update(ViewerCell) and then calling viewerCell.getText() would be that we would be out of the business of doing instanceof checks against the label provider and instead use the existing logic in the framework. (In reply to comment #6) > The reason for going with update(ViewerCell) and then calling > viewerCell.getText() would be that we would be out of the business of doing > instanceof checks against the label provider and instead use the existing logic > in the framework. > > labelProvider.update(cell); > event.result = cell.getText(); > Changes released to HEAD. Thanks Boris. See Bug 290461. Just wondering if we need to run any performance tests ? (In reply to comment #7) > See Bug 290461. Just wondering if we need to run any performance tests ? The change is only in the method getName(AccessibleEvent), isn't it? I don't think we have any performance tests for this, nor do I foresee any potential performance probelms since I don't think this method is going to be called in bulk on many tree items. (In reply to comment #7) > Changes released to HEAD. Thanks Boris. This bug is targeted for 3.6.1 but you said you released to HEAD. Could you please update the target milestone accordingly, and create another bugzilla for putting this fix in R3_6_maintenance as well? Thanks! (In reply to comment #9) > (In reply to comment #7) > > Changes released to HEAD. Thanks Boris. > > This bug is targeted for 3.6.1 but you said you released to HEAD. Could you > please update the target milestone accordingly, and create another bugzilla for > putting this fix in R3_6_maintenance as well? Thanks! Thanks Boris. From some reason this slipped from my mind . I have create a clone of this ,Bug 318862 , for fix in 3.6.1. Marking this as fixed and updating the target milestone. |