How to set minimum size of column for GEF-Paletteviewer with ColumnsLayout? [message #1746907] |
Mon, 07 November 2016 10:14  |
Eclipse User |
|
|
|
Hi you all,
i'm working with an older version of GEF (3.7.2.v20111106-2020, Indigo SR2).
I use the GEF PaletteViewer as a view to open different perspectives for my RCP.
All these Perspectives have an icon (32x32) and an internationalized title. The title should always be below the icon so i'm using the ColumnsLayout.
It all works fine for me except the fact that in some cases the ColumnsLayout shows my icons in more than one column. I do only need one Column!
I found the discussion about the palette using columns in https://www.eclipse.org/forums/index.php?t=msg&th=38060&goto=123758&#msg_123758 but there was no solution and the thread is more than old (2004).
I tried to set the default constaint of the ColumnsLayout (which is "Dimension(55, 55)") to another value but I found no API to do so. While debugging I changed the width to "100" which would be perfect for me.
Could anyone please help me?
Would it help to use larger icons? for example 100x32 to force the column size?
Kind regards
Alex
|
|
|
Re: How to set minimum size of column for GEF-Paletteviewer with ColumnsLayout? [message #1747113 is a reply to message #1746907] |
Wed, 09 November 2016 09:57   |
Eclipse User |
|
|
|
Hi Alexander,
there is a workaround described in the thread from 2004 that you referenced:
Quote:Meanwhile, if you must have it, you can change ColumnsLayout so that its
default width (defaultConstraint.width) is the same as the palette width.
This workaround refers to the customization of the palette, where four different settings are available for the layout of the palette, of which you seem to be using the COLUMNS layout. This setting is respected within GroupEditPart, which creates a ColumnsLayout and manages its default constraints. Therefore, you can use paletteViewer#setEditPartFactory() to set a CustomPaletteEditPartFactory. Within the CustomPaletteEditPartFactory, you can create a CustomGroupEditPart instead of GroupEditPart. Finally, within CustomGroupEditPart, you can influence the ColumnsLayout that is created as well as its default constraints.
As all parts of the PaletteViewer can be customized via the MVC approach, you have full control over the palette. For an overview of the possible layouts within Draw2d, you can take a look at the Draw2d Examples [1].
[1] http://nyssen.blogspot.de/2010/12/draw2d-examples-hidden-treasure.html
Best regards,
Matthias
|
|
|
Re: How to set minimum size of column for GEF-Paletteviewer with ColumnsLayout? [message #1747146 is a reply to message #1747113] |
Thu, 10 November 2016 03:27  |
Eclipse User |
|
|
|
Hi Matthias,
thanks for the reply. I just tried your proposal and it works well, allthough i needed to subclass the DrawerEditPart and not the GroupEditPart that you mentioned.
In addition i'm getting a lot of "Discouraged access: The type ... is not accessible due to restriction on required library org.eclipse.gef_3.7.2.v20111106-2020.jar", which is not good but will work for me as we will not update to another version of gef in the very next future.
Summary for other interested:
I needed to subclass :
- org.eclipse.gef.ui.palette.PaletteEditPartFactory to be able to return special DrawerEditPart in "createDrawerEditPart(EditPart pParentEditPart, Object pModel)"
- org.eclipse.gef.internal.ui.palette.editparts.DrawerEditPart to be able to return special DrawerFigure in "createFigure()"
- org.eclipse.gef.internal.ui.palette.editparts.DrawerFigure to be able to override the "setLayoutMode(int)" in order to set the default constraints to the ColumnsLayout created there.
Thanks for the fast help
Alex
|
|
|
Powered by
FUDForum. Page generated in 0.05669 seconds