Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 310073 - [Dialogs] FilteredTree sets it's own layout data
Summary: [Dialogs] FilteredTree sets it's own layout data
Status: CLOSED DUPLICATE of bug 226155
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-22 05:23 EDT by Adrian Wilkins CLA
Modified: 2015-05-01 07:09 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Wilkins CLA 2010-04-22 05:23:25 EDT
Build Identifier: 20100218-1602

The FilteredTree control sets it's own layoutData in it's createControl() routine.

If this isn't compatible with the layout on the parent composite, this causes ClassCastException to occur when it tries to compute it's size. When you run into this it's not immediately obvious why, without debugging the code.

Workaround : filteredTree.setLayout(null); immediately after creating it allows you to put the FilteredTree in e.g. a FillLayout without causing the exception.

Reproducible: Always

Steps to Reproduce:
Construct a layout that has a GridLayout at the top, a composite with a FillLayout nested inside that, and the FilteredTree inside that.
Comment 1 Adrian Wilkins CLA 2010-04-22 05:24:11 EDT
Stack trace typical of this 

java.lang.ClassCastException: org.eclipse.swt.layout.GridData cannot be cast to org.eclipse.swt.layout.FillData
at org.eclipse.swt.layout.FillLayout.computeChildSize(FillLayout.java:144)
at org.eclipse.swt.layout.FillLayout.computeSize(FillLayout.java:122)
at org.eclipse.swt.widgets.Composite.computeSize(Composite.java:219)
at org.eclipse.swt.widgets.TabFolder.minimumSize(TabFolder.java:511)
at org.eclipse.swt.widgets.Composite.computeSize(Composite.java:225)
at org.eclipse.swt.widgets.TabFolder.computeSize(TabFolder.java:152)
at org.eclipse.swt.custom.SashFormLayout.computeSize(SashFormLayout.java:39)
at org.eclipse.swt.widgets.Composite.computeSize(Composite.java:219)
at org.eclipse.swt.layout.FillData.computeSize(FillData.java:26)
at org.eclipse.swt.layout.FillLayout.computeChildSize(FillLayout.java:151)
at org.eclipse.swt.layout.FillLayout.computeSize(FillLayout.java:122)
at org.eclipse.swt.widgets.Composite.computeSize(Composite.java:219)
at org.eclipse.swt.layout.GridData.computeSize(GridData.java:483)
at org.eclipse.swt.layout.GridLayout.layout(GridLayout.java:217)
at org.eclipse.swt.layout.GridLayout.layout(GridLayout.java:193)
at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1428)
at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1243)
at org.eclipse.swt.widgets.Control.setBounds(Control.java:715)
at org.eclipse.swt.layout.FillLayout.layout(FillLayout.java:201)
at org.eclipse.swt.widgets.Composite.updateLayout(Composite.java:1428)
at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1243)
at org.eclipse.swt.widgets.Control.setBounds(Control.java:687)
at org.eclipse.ui.internal.LayoutPart.setBounds(LayoutPart.java:300)
at org.eclipse.ui.internal.presentations.PresentablePart.setBounds(PresentablePart.java:170)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.layoutContent(PresentablePartFolder.java:131)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.layout(PresentablePartFolder.java:412)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:292)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1256)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1209)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1608)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:499)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:485)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:778)
at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:677)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:638)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2854)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:651)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:610)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:361)
at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:168)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:229)
at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:208)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:274)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250)
at org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(OpenAndExpand.java:49)
at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:221)
at org.eclipse.ui.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:202)
at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:842)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:840)
at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1101)
at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:467)
at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1205)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
Comment 2 Remy Suen CLA 2010-04-22 07:41:22 EDT
(In reply to comment #0)
> The FilteredTree control sets it's own layoutData in it's createControl()
> routine.

For future reference, FilteredTree is owned by JFace. JFace code is owned by UI, not SWT.
Comment 4 Adrian Wilkins CLA 2015-05-01 07:09:47 EDT
Agree, marking as such.

*** This bug has been marked as a duplicate of bug 226155 ***