Custom property editor

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

Custom property editor

Postby domfe » Fri Dec 03, 2010 1:22 am

I'm trying to add a custom property editor.
The property stores an instance of a widget present in the designer,
like "control" property in LayoutData.left.
How can I provide such a list? Can I make it with an innerClass editor?
Can I reuse an existing editor?

Thank you.
domfe
 
Posts: 46
Joined: Mon Oct 04, 2010 6:42 am

Re: Custom property editor

Postby Eric Clayberg » Fri Dec 03, 2010 4:05 pm

SWT Designer has built in support for properties with widget data types, so you just need to have an accessor pair for the property.

Object properties like that are considered "advanced" so you should also turn off the advanced property filter in the property pane.
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: Custom property editor

Postby domfe » Mon Dec 06, 2010 12:36 am

The property work like expected with an SWT source but I'm using an XWT file
and the property is not shown.
Do I have to write something in the *.wbp-component.xml?

Thank you.
domfe
 
Posts: 46
Joined: Mon Oct 04, 2010 6:42 am

Re: Custom property editor

Postby Eric Clayberg » Mon Dec 06, 2010 5:10 am

We have not seen general support for custom properties like this in XWT.

The support in FormLayout for attachments is very specific to that layout.

Please provide a compete, working XWT example that illustrates how this should look.
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: Custom property editor

Postby domfe » Mon Dec 06, 2010 5:34 am

Code: Select all
<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt" x:Class="test.Example2" text="XWT Application" layout="{x:Null}">
   <MyText control="{Binding ElementName=label} bounds="10, 10, 76, 19"/>
   <Label text="New Label" bounds="10, 76, 49, 13"/>
</Shell>


I want that the text of the Label is the same as the MyText control.
I will be able to add a Listener in MyText that get "control" property and
set text on it. The Label is not known at the time of implementation of MyText.

Thank you for your answers.
domfe
 
Posts: 46
Joined: Mon Oct 04, 2010 6:42 am

Re: Custom property editor

Postby Konstantin.Scheglov » Mon Dec 06, 2010 7:55 am

Can you confirm that this code really works?
There are problems in XWT (not Designer) with using forward references to the controls in the FormLayout attachments.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=316815

Code: Select all
<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt" x:Class="test.Application_3" text="XWT Application" layout="{x:Null}" xmlns:p1="clr-namespace:test">
   <Label text="New Label" x:Name="label" bounds="10, 76, 49, 13"/>
   <p1:MyText control="{Binding ElementName=label}" bounds="10, 10, 142, 44"/>
</Shell>
Konstantin.Scheglov
Moderator
 
Posts: 186
Joined: Tue Oct 18, 2005 8:11 pm
Location: Russian Federation, Lipetsk

Re: Custom property editor

Postby domfe » Mon Dec 06, 2010 8:31 am

I'm not using FormLayout but anyway...
This works:

Code: Select all
<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt" x:Class="it.test.Example2" text="XWT Application" layout="{x:Null}" xmlns:p1="clr-namespace:mydesign">
   <Label text="New Label" x:Name="label" bounds="10, 76, 49, 13"/>
   <p1:MyText myProperty="{Binding ElementName=label}" bounds="10, 10, 76, 19"/>
</Shell>


This don't works because the object Label isn't in memory when XWT calls setMyProperty.

Code: Select all
<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt" x:Class="it.test.Example2" text="XWT Application" layout="{x:Null}" xmlns:p1="clr-namespace:mydesign">
   <p1:MyText myProperty="{Binding ElementName=label}" bounds="10, 10, 76, 19"/>
   <Label text="New Label" x:Name="label" bounds="10, 76, 49, 13"/>
</Shell>


But I don't see why you have disabled a features already present in the editor.

Bye.
domfe
 
Posts: 46
Joined: Mon Oct 04, 2010 6:42 am

Re: Custom property editor

Postby Eric Clayberg » Mon Dec 06, 2010 9:02 am

domfe wrote:This don't works because the object Label isn't in memory when XWT calls setMyProperty.

Doesn't that strike you as a serious problem? Or do you only intend to reference controls defined prior to the current control?

domfe wrote:I don't see why you have disabled a features already present in the editor.

I don't know what you mean. We haven't "disabled" anything. The Java parser/editor and the XML parser/editor are not the same thing. They have some similarities, bu there are also considerable differences. SWT and XWT also do not overlap 100% in capabilities, so you should not assume that because a feature/functions exists in the Java UI editor that we can or will add it to the XML UI editor. We have already seen many cases where XWT offers only a subset of SWT's full capabilities. If you choose to live in the XWT world which is far from mature (unlike SWT), you are choosing to live with those limitations.

Also, to be brutally honest, XWT support is very low on our priority list (relative to SWT support, for example). Until XWT matures a bit and we see more than a couple of actual users, I don't see that changing much.
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: Custom property editor

Postby domfe » Mon Dec 06, 2010 10:29 am

Thank you Eric for your reply.

Or do you only intend to reference controls defined prior to the current control?


Yes!

I know that SWT is better but my work is focused on XWT. So, there's something I can do (innerClass
or other) to have a choice from the controls already present in my XWT file?

Thank for your time.
domfe
 
Posts: 46
Joined: Mon Oct 04, 2010 6:42 am

Re: Custom property editor

Postby Eric Clayberg » Thu Dec 09, 2010 4:15 pm

We have added support for object properties like this in the latest 8.1 build...

http://code.google.com/javadevtools/dow ... -beta.html

Keep in mind that object properties like that are considered "advanced" so you should also turn off the advanced property filter in the property pane
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: Custom property editor

Postby domfe » Fri Dec 10, 2010 12:57 am

Hi Eric and thank you for your time.
My component works well with SWT but still doesn't work with XWT.
Here's a snippet of my component.

Code: Select all
   private Label myProperty;

   ...

   public void setMyProperty(Label myProperty) {
      this.myProperty = myProperty;
   }

   public Label getMyProperty() {
      return myProperty;
   }


Also, the Advanced properties button is pressed.
Thank you again.
domfe
 
Posts: 46
Joined: Mon Oct 04, 2010 6:42 am

Re: Custom property editor

Postby Eric Clayberg » Fri Dec 10, 2010 8:41 am

What exact build are you using?

Can you provide a complete teest case?
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: Custom property editor

Postby domfe » Mon Dec 13, 2010 2:56 am

Product Info
Product: WindowBuilder
Product Version: 8.1.0.r36x201012090854[201012090854]
For Eclipse Version: Eclipse 3.6

I've attached the java source. I put the xwt code inline because the forum web interface doesn't load my file (Example2.xwt).

Code: Select all
<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt" x:Class="test.Example2" text="XWT Application" xmlns:p1="clr-namespace:test">
   <Shell.layout>
      <RowLayout/>
   </Shell.layout>
   <p1:MyComponent/>
   <Button text="Double click me!"/>
</Shell>



Regards.
Attachments
Example2.java
(963 Bytes) Downloaded 16 times
MyComponent.java
(603 Bytes) Downloaded 15 times
domfe
 
Posts: 46
Joined: Mon Oct 04, 2010 6:42 am

Re: Custom property editor

Postby Eric Clayberg » Tue Dec 14, 2010 3:35 pm

Give this a try using the latest build...

http://code.google.com/javadevtools/dow ... -beta.html
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: Custom property editor

Postby domfe » Wed Dec 15, 2010 1:48 am

Nice work! The latest build shows my property correctly.

Many thanks.
domfe
 
Posts: 46
Joined: Mon Oct 04, 2010 6:42 am

Next

Return to SWT Designer

Who is online

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

cron