Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366355

Summary: WindowBuilder does not call Beans.setDesignTime() early enough
Product: z_Archived Reporter: Richard Kennard <richard>
Component: WindowBuilderAssignee: Konstantin Scheglov <Konstantin.Scheglov>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: clayberg, richard, xado2010
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Test widget that fails because isDesignTime() == true within Windows Builder
none
Works for me in WindowBuilder
none
Bug report (including example project) none

Description Richard Kennard CLA 2011-12-12 02:01:21 EST
Created attachment 208242 [details]
Test widget that fails because isDesignTime() == true within Windows Builder

Hi guys,

I am trying to upgrade Metawidget to support your excellent Windows Builder. I followed your documentation and added checks to 'Beans.isDesignTime()' to my code. However I have encountered a problem whereby Beans.setDesignTime() doesn't seem to have been set early enough?

I attach some example code that demonstrates the problem. Basically, if I try and listen to 'controlMoved' or 'controlResized' then I find Beans.isDesignTime() == false. But if I remove those methods then I find during 'paintControl' that Beans.isDesignTime is true.

This behaviour also seems to happen after hitting 'refresh preview'. It appears Window Builder has a custom ClassLoader or something, and this is picking up a different java.beans.Beans instance, which has not had Beans.setDesignTime() called?

Regards,

Richard.
Comment 1 Konstantin Scheglov CLA 2011-12-15 09:33:20 EST
Created attachment 208440 [details]
Works for me in WindowBuilder
Comment 2 Konstantin Scheglov CLA 2011-12-15 09:37:06 EST
I don't see any exceptions in WindowBuilder, when I open TestWidget itself or Application class which uses TestWidget.

Beans is class from JDK, so even while we are using custom ClassLoader, we use same class.

I don't see any change after "preview".
Comment 3 Eric Clayberg CLA 2011-12-15 10:09:43 EST
I also tried your TestWidget and did not see any problems. It rendered correctly and no exceptions appeared in the log. You did not provide any info about which version/build of WB you are using, so all I can suggest is making sure that it is the latest. If you can provide a more detailed test case or set of instructions to reproduce this problem, feel free to reopen this case.
Comment 4 Richard Kennard CLA 2011-12-15 15:30:21 EST
Thank you for trying to reproduce my problem. Apologies for not providing enough detail.

I attach a bug report using your (quite awesome!) built-in bug reporter.

I am using:

* Windows 7 64-bit, version 6.1 (Build 7601: Service Pack 1)
* Eclipse Indigo (Indigo Service Release 1 Build id: 20110916-0149)
* WindowBuilder Core 1.2.0.r36x201109270310

Steps to reproduce:

1. Run Eclipse, open the 'designtimetest' project
2. Double click on TestForm.xwt (XML Source tab displays okay)
3. Click on the 'Design' tab

WindowBuilder crashes with error (see attached)
Comment 5 Richard Kennard CLA 2011-12-15 15:31:16 EST
Created attachment 208469 [details]
Bug report (including example project)
Comment 6 Konstantin Scheglov CLA 2011-12-15 16:17:49 EST
Thank you for example.
Fixed in trunk.
Problem was that  we render with "isDesignTime == true", but for XWT parsing was without this flag.
Relation with "Preview" can be explained by the fact that it turns "designTime" on/off on show/hide preview window.
Comment 7 Richard Kennard CLA 2011-12-15 16:24:34 EST
Brilliant. Thanks guys. I look forward to next release!