Creating parts [message #1731756] |
Mon, 09 May 2016 18:15  |
Eclipse User |
|
|
|
As I am using the Logo example to work out how to use GEF4, I get a bit stumped when I have a requirement that's not covered by the example. I have a couple of issues around creating parts that I could use some help with.
1. Using a palette to create parts - my model has around 40 different part types, so the cycling object creation menu in the example really isn't going to work for me. The parts are grouped in categories, so I guess at least my context menu could contain two toolbars, with categories in the top, and the parts available in the selected category in the bottom. However, I'd really prefer to have a separate palette in a splitpane beside the main viewer. I gather there was a request to create an example of a palette viewer - has this got anywhere? If not, where do I start? The thing I am not clear about is how you would change what the creation tool/policy would be doing when you select an item in the palette, given that tools seem to be very different in GEF4.
2. Most of my parts do not have a "default" shape, so it doesn't really make sense to have a click-to-drop-and-create style policy. For example, several shapes are based on Polyline, so what I really want is for the user to click to start creating, then click at intermediate points to build up the line, and then some gesture (e.g. double-click or ctrl+click) to indicate completion. The object would only actually get created and added to the model upon completion, so the visual would only be a feedback part during the drawing phase. This was pretty straightforward in GEF3 - just had a tool that extended TargetingTool, kept track of the state and executed the create command when it received the completion gesture. I'm really struggling to see what the equivalent in GEF4 would be.
|
|
|
|
|
Re: Creating parts [message #1732253 is a reply to message #1732223] |
Fri, 13 May 2016 19:48   |
Eclipse User |
|
|
|
Cool, I picked up the palette example this morning. Looks pretty good. In my case, I would prefer to have an always open palette, so I would probably have the editor in a BorderPane with the palette in the left slot and the content viewer in the center. I had a quick try of that layout in the example, but it didn't quite work - it looks like the drag gesture doesn't carry over between the two FXViewers, so the part immediately gets dropped on the canvas at the place where the mouse crosses over between the two viewers.
In any case, as I said above, I probably wouldn't want to drag from the palette anyway, it's more that the items in the palette would act as buttons that switch the content viewer into create mode, I guess by activating a particular interaction policy. How do I tell the content viewer to activate policy X?
|
|
|
|
Re: Creating parts [message #1732423 is a reply to message #1732288] |
Tue, 17 May 2016 03:57  |
Eclipse User |
|
|
|
That sounds just fine. However, the drag policy being interrupted is due to the CreationPolicy executing a ChangeFocusOperation to assign focus to the newly created part, which will in turn take focus from the palette viewer, which will then abort the currently running drag policy. Therefore, for a separate viewer setup you would need to exchange the CreationPolicy. For example, the method CreationPolicy#createFocusOperation() could be overridden to return null.
Best regards,
Matthias
|
|
|
Powered by
FUDForum. Page generated in 0.28508 seconds