SWTResourceManager issue

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

SWTResourceManager issue

Postby kgregg » Fri Mar 25, 2011 9:24 am

I had to reload Eclipse (and WB). After doing so, I opened an existing SWT project and it ran fine. However, I noticed that if I changed a font on one of my screens, what used to say:
Code: Select all
lbl1.setFont(SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));

now says:
Code: Select all
lbl1.setFont(org.eclipse.wb.swt.SWTResourceManager.getFont("Arial", 11, SWT.NORMAL));


Also, when I look in Eclipse Package Explorer for the project, I see 'org.eclipse.wb.swt' on the tree and it has SWTResourceManager.java under it - didn't see this before my reload. (I also see com.swtdesigner with SWTResourceManager.java under it, which is the same as it was before my reload.)

The real problem this is causing is that one of my team members is working on the same project and his configuration is the same as what mine was before I had to reload mine. So when I make a change and the syntax changes as in the second code example above, when he loads the code he gets an error because his config apparently doesn't know about org.eclipse.wb.swt. I had him update to the latest WB, but that apparently left the old WB version and added the new WB version, and he still gets the error.

I'm guessing he can manually add org.eclipse.wb.swt.SWTResourceManager.java and maybe get rid of the error condition, but am confused about why he would have to do that, as I didn't do so.

Help, please!
Thanks
kgregg
 
Posts: 14
Joined: Thu Aug 19, 2010 9:22 am

Re: SWTResourceManager issue

Postby Eric Clayberg » Fri Mar 25, 2011 9:58 am

WindowBuilder is now an official Eclipse open source project. Its entire namespace has changed to org.eclipse.wb.*. You should completely unload the old version (v8x or earler) before installing the new Eclipse.org version (v0.9.0).
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: SWTResourceManager issue

Postby kgregg » Fri Mar 25, 2011 12:16 pm

I think my confusion was because my existing project had com.swtdesigner in the tree and the code had imports for com.swtdesigner.SWTResourceManager. After my reload, when I changed a font something decided SWTResourceManager needed to be prefixed with org.eclipse.wb.swt to distinguish it from com.swtdesigner.SWTResourceManager. After I deleted com.swtdesigner and changed all of my imports to org.eclipse.wb.swt.SWTResourceManager it seems to be working correctly now. Was that the correct way to fix this? Seems like a tedious thing to have to do for any 'old' projects that still reference com.swtdesigner. It was also tedious having to change all of the library names in the project to their new names from the update. Is there an automated way to do that?

Although that has fixed my original issue, my team member is still having problems even after unloading and loading the Eclipse.org version. He now sees an org.eclipse.wb.swt package in the package explorer, but it is empty. So all code referencing SWTResourceManager is failing because it is not in org.eclipse.wb.swt. Did we miss a step somehow?

Thanks
kgregg
 
Posts: 14
Joined: Thu Aug 19, 2010 9:22 am

Re: SWTResourceManager issue

Postby Eric Clayberg » Fri Mar 25, 2011 8:32 pm

kgregg wrote:Was that the correct way to fix this?

That seems like a fine approach.

kgregg wrote:Is there an automated way to do that?

Maybe the Eclipse refactoring tools could do something like this.

A global text search/replace would probably do this quickly.

kgregg wrote:Although that has fixed my original issue, my team member is still having problems even after unloading and loading the Eclipse.org version. He now sees an org.eclipse.wb.swt package in the package explorer, but it is empty. So all code referencing SWTResourceManager is failing because it is not in org.eclipse.wb.swt. Did we miss a step somehow?

No idea. Maybe he inadvertently deleted the contents of that package. A re-install would likely fix it.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: SWTResourceManager issue

Postby kgregg » Sun Mar 27, 2011 9:51 am

Eric, as always, thanks for the info.

Just to clarify, because WB's entire namespace changed, updating WB within Eclipse requires manual changes to force consistency in projects which were built prior to the update? This is because it appears that com.swtdesigner still exists, although any code changes with the newer version seem to insist on using org.eclipse.wb.swt instead. So, as long as I don't touch the code, the references to com.swtdesigner continue to exist and work as they did, but changes introduce references to the new org.eclipse.wb.swt. So I could easily have a mixture of references within the code base because of this change, which makes maintenance tedious.

And, as a related issue, besides changing the com.swtdesigner references to org.eclipse.wb.swt, it appears that you have to also 'fix' the library names in .classpath to the new names because otherwise .classpath continues to reference the pre-update libraries. (I realize this doesn't apply just to WB, but am wondering if there is a way to automatically update the library names in all existing .classpath's when an Eclipse update is applied.

Thanks again!
Ken
kgregg
 
Posts: 14
Joined: Thu Aug 19, 2010 9:22 am

Re: SWTResourceManager issue

Postby Eric Clayberg » Sun Mar 27, 2011 1:34 pm

kgregg wrote:updating WB within Eclipse requires manual changes to force consistency in projects which were built prior to the update?

If you want to force consistency to the new namespace, you would need to make those changes by hand (I would expect the code to still work, if you do nothing). I am not aware of any automated approaches to this beyond a global text search/replace.

kgregg wrote:am wondering if there is a way to automatically update the library names in all existing .classpath's when an Eclipse update is applied.

I am not aware of any way to do this automatically (other than a one-time global text search/replace).
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest

cron