Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Workaround for TreeViewer bug
Workaround for TreeViewer bug [message #774334] Tue, 03 January 2012 18:12 Go to next message
g.z.white is currently offline g.z.whiteFriend
Messages: 5
Registered: May 2011
Junior Member
Hi,

I'm seeing the following exception when selecting tree items in my RAP application's View in Indigo on a Mac..
(It doesn't seem to happen in the RCP version)

Quote:
> 2011-12-20 15:15:31.365:WARN:/:ERROR: Failed to execute PhaseListener after phase 'PROCESS_ACTION'.
> java.lang.ClassCastException: org.eclipse.swt.layout.GridLayout cannot be cast to org.eclipse.swt.layout.FillData
> at org.eclipse.swt.layout.FillLayout.flushCache(FillLayout.java:165)
> at org.eclipse.swt.widgets.Composite.changed(Composite.java:610)
> at org.eclipse.rwt.internal.textsize.ClearLayoutBuffersVisitor.doVisit(ClearLayoutBuffersVisitor.java:22)
> at org.eclipse.swt.internal.widgets.WidgetTreeVisitor$AllWidgetTreeVisitor.visit(WidgetTreeVisitor.java:34)
> at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:48)
> at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:55)
> at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:55)
> at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:55)
> at org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:55)
> at org.eclipse.rwt.internal.textsize.TextSizeRecalculation.clearLayoutBuffers(TextSizeRecalculation.java:51)
> at org.eclipse.rwt.internal.textsize.TextSizeRecalculation.forceShellRecalculations(TextSizeRecalculation.java:36)
> at org.eclipse.rwt.internal.textsize.TextSizeRecalculation.execute(TextSizeRecalculation.java:29)
> at org.eclipse.rwt.internal.textsize.MeasurementListener.handleMeasurementResults(MeasurementListener.java:61)
> at org.eclipse.rwt.internal.textsize.MeasurementListener.afterPhase(MeasurementListener.java:33)
> at org.eclipse.rwt.internal.lifecycle.PhaseListenerManager.notifyAfterPhase(PhaseListenerManager.java:85)
> at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.continueLifeCycle(RWTLifeCycle.java:168)
> at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.sleep(RWTLifeCycle.java:253)
> at org.eclipse.swt.widgets.Display.sleep(Display.java:1174)
> at org.eclipse.ui.application.WorkbenchAdvisor.eventLoopIdle(WorkbenchAdvisor.java:361)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2734)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2694)
> at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2530)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:702)
> at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:685)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
> at com.inpses.read.rap.Application.start(Application.java:18)
> at org.eclipse.rap.ui.internal.application.EntrypointApplicationWrapper.createUI(EntrypointApplicationWrapper.java:25)
> at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:81)
> at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:204)
> at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:88)
> at java.lang.Thread.run(Thread.java:680)
> at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:101)



It looks like bug 325788 might be the cause..


..so, as suggested by the above bug report's workaround, I've tried wrapping the TreeViewer in a composite and setting the composite's layout to GridLayout, as detailed in the code below.


public void createPartControl(Composite parent) {

Composite c = new Composite(parent, SWT.DEFAULT);
c.setLayout(new GridLayout());
viewer = new TreeViewer(c, SWT.VIRTUAL | SWT.MULTI | SWT.H_SCROLL
| SWT.V_SCROLL);
viewer.getTree().setLayoutData(new GridData());



This has no effect. I am missing something, aren't I?
I often do.

Any help would be much appreciated.


G
Re: Workaround for TreeViewer bug [message #774447 is a reply to message #774334] Tue, 03 January 2012 23:46 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
Somewhere in your code you're setting the LayoutData for a widget to be a GridLayout.

If it were a bug due to code assuming it was under a GridLayout then you would get class cast exceptions between GridData and FillData, not GridLayout and FillData
Re: Workaround for TreeViewer bug [message #774450 is a reply to message #774334] Tue, 03 January 2012 23:46 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
Somewhere in your code you're setting the LayoutData for a widget to be a GridLayout.

If it were a bug due to code assuming it was under a GridLayout then you would get class cast exceptions between GridData and FillData, not GridLayout and FillData
Re: Workaround for TreeViewer bug [message #774683 is a reply to message #774447] Wed, 04 January 2012 11:59 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

right, mismatching layout and layoutData is a common mistake in SWT
code. Unfortunately, this kind of mistake leads to a ClassCastException
not before the layout is calculated, i.e. at a point in time that is
unrelated to the root cause. It's well possible that this error goes
unnoticed in RCP but shows up in RAP.

Regards, Ralf

--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Workaround for TreeViewer bug
Next Topic:Re: TableViewer Column resized event
Goto Forum:
  


Current Time: Sat Apr 20 01:56:49 GMT 2024

Powered by FUDForum. Page generated in 0.02721 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top