Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Preview for Composite Objects
Preview for Composite Objects [message #524636] Thu, 01 April 2010 16:20 Go to next message
Andre Kullmann is currently offline Andre KullmannFriend
Messages: 33
Registered: September 2009
Member
He,

it cost a lot of time to design composite elements.
Code the layout put the widgets in and start the application to see if it's alright.
In most cases it isn't alright, so you fix it and start the application again, and so on.
The startup of an RCP application and the clicks until you can see your composite took a lot of time.
And time is money Razz
So I created a small plugin to create an review of an composite at development time.
If edit an composite class in your java editor you can enable the preview and see live how the preview changed if you change the code ( and save ).
I created this plugin as part of my mirror project. If this sounds interessting for you so try it.
Here's the updatesite https://mirror.dev.java.net/updatesite
and a short documentation you can find here https://mirror.dev.java.net/ and a screencast under https://mirror.dev.java.net/flash/preview_first_step.htm
It's just a first alpha of this plugin, so please don't be angry if it doesn't work complete satisfaction.
If you try it, please let me know what do you thing.

Regards,
André
Re: Preview for Composite Objects [message #524714 is a reply to message #524636] Thu, 01 April 2010 19:34 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi André,

good to see you're still hacking along :)

Just watched the screencast, looks very cool. I just tried to replicate what you did in
the screencast. When I click the preview button, I end up with this exception:

java.lang.NoClassDefFoundError: org/eclipse/osgi/framework/internal/core/SystemBundle
at
net.java.mirror.eclipse.preview.internal.ClassPathBuilder.is SystemBundle(ClassPathBuilder.java:122)
at
net.java.mirror.eclipse.preview.internal.ClassPathBuilder.ap pendPlatform(ClassPathBuilder.java:93)
at
net.java.mirror.eclipse.preview.internal.ClassPathBuilder.bu ildClassPath(ClassPathBuilder.java:56)
at net.java.mirror.eclipse.preview.internal.Util.createPreviewI nput(Util.java:140)
at net.java.mirror.eclipse.preview.PreviewViewPart.setModel(Pre viewViewPart.java:72)
at net.java.mirror.eclipse.preview.internal.Util.showPreview(Ut il.java:95)
at
net.java.mirror.eclipse.preview.internal.EnablePreviewButton .widgetSelected(EnablePreviewButton.java:68)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)

Maybe it's because I'm using 3.6, your class referring an internal package looks
suspicious; I'll find out what's going wrong tomorrow.

Also nice to see that ResizableComposite found another home. I guess you didn't like the
part with the XML in SWT/XML. I have to admit, you might have a point here :)

btw, have you considered dual-licensing under the EPL to be license-compatible with other
Eclipse projects?

btw: One thing I use quite often is the 'update' command in the OSGi console to update my
bundles at runtime. It doesn't work in each and every case, but in most cases the RCP
workbench is capable to update the UI after a changed bundle was deployed without
restarting the whole application.

Greetings,

Ralf


--
http://www.ralfebert.de/blog/
http://twitter.com/ralfebert/
Re: Preview for Composite Objects [message #524754 is a reply to message #524714] Fri, 02 April 2010 10:12 Go to previous messageGo to next message
Andre Kullmann is currently offline Andre KullmannFriend
Messages: 33
Registered: September 2009
Member
Hello Ralf,

yes you are right, the ...internal/core/SystemBundle is missing in Eclipse 3.6. I fixed it, now i detect the SystemBundle using
private static boolean isSystemBundle( Bundle bundle ) {
    return bundle != null && bundle.getBundleId() == 0;
}


The license idea is interesting, I agree and changed the license to the EPL.

Your ResizableComposite is an nice Widget, great work !! So I used it in this usecase, too.

Thanks for replay.

greetings,
Andre

Re: Preview for Composite Objects [message #524758 is a reply to message #524754] Fri, 02 April 2010 05:50 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi André,

> yes you are right, the ...internal/core/SystemBundle is missing in
> Eclipse 3.6.

don't use internals :) 1.0.1 now works great in 3.6.

> The license idea is interesting, I agree and changed the license to the
> EPL.

Great! I already checked out the code and will help you with this wherever I can. The SWT
preview works great, it even resolves i18n Messages correctly. I always had a similar idea
dozing in the attic, but I never had the guts to actually code it :)

I paused my SWT/XML project somewhat because of the declarative UI work in e4:
http://wiki.eclipse.org/E4/XWT
http://wiki.eclipse.org/E4/UI/Toolkit_Model/org.eclipse.e4.t m.ui

But I also started to like the plain old java code approach when it comes to SWT UIs, so
your SWT Preview really hits a nerve for me :)

At first, I have a contribution to SWT/XML lying around that adds a very nice locale
switcher to the preview so you can preview other languages. I never had the time to
integrate this with the current code, I'll try to make it work with your SWT Preview plug-in.

Also, it would be cool if one could preview other kinds of UI base classes (like Dialogs,
Views, Editors).

For SWT/XML, I planned to add the Preview tab as a 2nd editor tab and have a special
editor, similar to Wicket Bench, maybe that would make a nice fit here as well:
http://www.laughingpanda.org/~inhuman/wicket-bench/docs/wick et_editor.jpg

Greetings,

Ralf


--
http://www.ralfebert.de/blog/
http://twitter.com/ralfebert/
Re: Preview for Composite Objects [message #524765 is a reply to message #524758] Fri, 02 April 2010 11:59 Go to previous messageGo to next message
Andre Kullmann is currently offline Andre KullmannFriend
Messages: 33
Registered: September 2009
Member
Hi Ralf,

I am very pleased to hear that you like the plugin and the idea behind.

In an previous version of this plugin I tried something you describe as 2nd Editor Tab. The benefit of the preview as view is that you can move the view to the second monitor.

Currently I think its not an good pattern to code your gui in the createDialogArea or createPartControl methods. Create own composites for the gui and just create instances of them in this method.

You can't use all eclipse features in the preview, because the preview use it's own
Classloader ( like an sandbox ) and in this Classloader no OSGI or Eclipse- Platform is running.
e.g.
PlatformUI.isWorkbenchRunning()

allways returns false.

If you want to change the locale on the fly it should be possible to patch the locale information in preview-classloader.

Regards,
André
Re: Preview for Composite Objects [message #524783 is a reply to message #524765] Fri, 02 April 2010 13:20 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi,

> In an previous version of this plugin I tried something you describe as
> 2nd Editor Tab. The benefit of the preview as view is that you can move
> the view to the second monitor.
good point. I was thinking about the tab merely as measure to get to the preview
conveniently. The global toolbar button is a bit too obtrusive for my taste. Maybe there
could be a context menu command "SWT Preview" only for Composite classes.

> Currently I think its not an good pattern to code your gui in the
> createDialogArea or createPartControl methods. Create own composites for
> the gui and just create instances of them in this method.
hmm, also a good point, but I was thinking about existing code here. Also it would be cool
if one would have a Button to show a dialog as real dialog as it would show up at runtime.
But sticking to the Composite-only has the advantage that one could keep the UI really
separated so one doesn't run into the issue of code that cannot be executed as part of the
preview.

Sometimes, when the code doesn't compile I get a pretty obtrusive modal error dialog.
Maybe something like the ErrorComposite (I copied the UI for showing the error messages as
in Eclipse editors, see [1], maybe there is public API for this now) would fit nice here?

Is there any practical use for the Refresh button? From my experience it refreshes
automatically as soon as the class is saved.

> If you want to change the locale on the fly it should be possible to
> patch the locale information in preview-classloader.
I guess so, I'll try to come up with a patch for you for this. I always regretted that I
never added this contribution to SWT/XML, so maybe it can be put to good use here :)

btw: do you mind if I create a git mirror at github? I really like versioning and
contributing via Git, git patches should be applicable without a problem to the SVN :)

Greetings,

Ralf


http://github.com/ralfebert/swtxml/tree/master/plugins/com.s wtxml.ide/src/com/swtxml/ide/

--
http://www.ralfebert.de/blog/
http://twitter.com/ralfebert/
Re: Preview for Composite Objects [message #524877 is a reply to message #524783] Sat, 03 April 2010 12:02 Go to previous messageGo to next message
Andre Kullmann is currently offline Andre KullmannFriend
Messages: 33
Registered: September 2009
Member
Hi Ralf,

today a add support for org.eclipse.jface.window.Window and java.awt.Container classes, so it should be possible also to preview jface dialogs and swing panels.
I add a simple i18n support, too. At this time translations based on org.eclipse.osgi.util.NLS and java.util.ResourceBundle are supported.
I changed the way of error reporting, as you described. ( That is better than my popup dialogs Razz )

On save only the classes in the current project will be reloaded for preview. The refresh button will reload all classes. You need this, if you changed something in the com.company.core and its effects the com.company.ui plugin.

If you like to create an github repository I support you. java.net is not the best platform for source repositories, I hope it changed after kenai and java.net will be merged.

I you like create an java.net account and join mirror.dev.java.net. I'll grant commit permissions to you.

Greetings,
André
Re: Preview for Composite Objects [message #524906 is a reply to message #524877] Sat, 03 April 2010 18:26 Go to previous message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi André,

> I you like create an java.net account and join
> https://mirror.dev.java.net/ I'll grant commit permissions to you.

cool, just did this. I also started to create issues for things I noticed / which I plan
to work on:
https://mirror.dev.java.net/issues/buglist.cgi

Greetings,

Ralf


--
http://www.ralfebert.de/blog/
http://twitter.com/ralfebert/
Previous Topic:How can RCP program receive a message from other process
Next Topic:Automatically Create Root JNLP files?
Goto Forum:
  


Current Time: Wed Apr 24 20:53:59 GMT 2024

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

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

Back to the top