|Re: Using a custom layout manager [message #681729 is a reply to message #678806]
||Thu, 09 June 2011 18:17
| Dan Hentschel
Registered: April 2011
Yes, thank you for that. I suspected that something like this was what was happening, but my initial attempts at making it a plugin didn't show any promising results.|
I have now made some progress, though. I now have a plugin project that seems to have no problem with the SomeLayoutInfo model specified in the meta file. However, it still doesn't work correctly. I can add my layout to a shell, but once my layout is active, the designer won't allow me to add any widgets to the shell. I can add widgets to the shell if I set the layout to Absolute layout, and then the widgets are positioned correctly if I set the layout to SomeLayout after the widgets are placed.
I don't completely understand the interactions with the SomeLayoutInfo class yet, so I put some breakpoints in each of the three methods (including the constructor). None of my breakpoints were hit. I see no evidence that the model class is even being constructed.
Another thing I didn't understand was the "Code generation" section of the ToolkitDescription. For now, I'm just returning null from getGenerationSettings(), on the assumption that it is unrelated to anything that I am doing right now. I'm not sure if that is a valid assumption, though.
I will continue to look into it, but please let me know if I am doing anything obviously wrong. I have posted two projects this time. One is the plugin project, and the second is the project that I test with when I launch Eclipse from within the plugin project.
|Re: Using a custom layout manager [message #681746 is a reply to message #681729]
||Thu, 09 June 2011 18:36
| Konstantin Scheglov
Registered: July 2009
1. You don't need ToolkitDescription and ToolkitProvider, you work just in normal RCP toolkit.|
2. I think that SomeLayout itself should not be in plugin, because in this case you will have to add this plugin into project classpath to use it in this project. While this will work, this will pollute classpath with design-time classes. Create separate project and jar it.
3. So, in <extension point="org.eclipse.wb.core.toolkits"> contribute to <toolkit id="org.eclipse.wb.rcp"> not to your toolkit (which is not used in any case). By doing this you will tell WindowBuilder that this plugin has models for components, so your SomeLayoutInfo.java will be used and constructor hit.
4. If you contribute component (layout in your case) to palette using plugin.xml, then you don't need org.eclipse.wb.rcp.wbp-palette.xml in project. In same way, it is better to have SomeLayout.wbp-component.xml in plugin.
5. Yes, you will not able to drop new widgets because WindowBuilder does not know what feedback to show. In general you should also contribute to <extension point="org.eclipse.wb.core.editPolicyFactories"> (and org.eclipse.wb.core.treeEditPolicyFactories for components tree) and provide LayoutEditPolicy. If your layout is simple flow-based layout, you can use just descriptions is wbp-component.xml file. See RowLayout.wbp-component.xml as example.
<!-- PARAMETERS -->
<!-- flow container -->
At same time rendering after absolute layout works because WindowBuilder just interprets code.
[Updated on: Thu, 09 June 2011 18:37]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02661 seconds