Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » HowTo realize something like a multiline textfield in GMF?
HowTo realize something like a multiline textfield in GMF? [message #235605] Wed, 08 July 2009 09:51 Go to next message
Ralf Buschermoehle is currently offline Ralf BuschermoehleFriend
Messages: 81
Registered: July 2009
Member
Hello,

I would like to have a multiline textfield (preferably reziseable with
line breaks) in my GMF editor - like the notes I can attach in every GMF
editor. How can I realize something like this?

Greetings,

Ralf
Re: HowTo realize something like a multiline textfield in GMF? [message #235618 is a reply to message #235605] Wed, 08 July 2009 10:31 Go to previous messageGo to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
Hello,

i found a TextCompartmentEditPart, which your compartment should extend.
But i don't know how to get the TextCompartmentEditPart automatically
generated. Does somebody know how to do this?

Greetings

Ralf Buschermoehle schrieb:
> Hello,
>
> I would like to have a multiline textfield (preferably reziseable with
> line breaks) in my GMF editor - like the notes I can attach in every GMF
> editor. How can I realize something like this?
>
> Greetings,
>
> Ralf
Re: HowTo realize something like a multiline textfield in GMF? [message #235624 is a reply to message #235605] Wed, 08 July 2009 11:46 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Ralf,

Can you please file bugzilla request asking to add multiline labels support
to gmf code generation?
For now to make a label multiline you have to:
1. Modify code creating new WrappingLabel and call labelFigure.setTextWrap(true);
2. Modify generated label EditPart.getManager() to call

setManager(new TextDirectEditManager(this, WrapTextCellEditor.class, ???EditPartFactory.getTextCellEditorLocator(this)));


instead of generated:

setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this),
???EditPartFactory.getTextCellEditorLocator(this)));

-----------------
Alex Shatalin
Re: HowTo realize something like a multiline textfield in GMF? [message #235631 is a reply to message #235624] Wed, 08 July 2009 12:15 Go to previous messageGo to next message
Oelerink is currently offline OelerinkFriend
Messages: 129
Registered: July 2009
Senior Member
Thanks, that helped. :)

Do your know how to enable text formating(like alignment right) in gmf?

And additionally if it is possible to color/underline/etc. parts of the
label text?

Greetings,

Joerg

Alex Shatalin schrieb:
> Hello Ralf,
>
> Can you please file bugzilla request asking to add multiline labels
> support to gmf code generation?
> For now to make a label multiline you have to:
> 1. Modify code creating new WrappingLabel and call
> labelFigure.setTextWrap(true);
> 2. Modify generated label EditPart.getManager() to call
> setManager(new TextDirectEditManager(this, WrapTextCellEditor.class,
> ???EditPartFactory.getTextCellEditorLocator(this)));
>
> instead of generated:
>
> setManager(new TextDirectEditManager(this,
> TextDirectEditManager.getTextCellEditorClass(this),
> ???EditPartFactory.getTextCellEditorLocator(this)));
>
> -----------------
> Alex Shatalin
>
>
Re: HowTo realize something like a multiline textfield in GMF? [message #235638 is a reply to message #235624] Wed, 08 July 2009 12:41 Go to previous messageGo to next message
Ralf Buschermoehle is currently offline Ralf BuschermoehleFriend
Messages: 81
Registered: July 2009
Member
Hi Alex,

Alex Shatalin wrote:

> Can you please file bugzilla request asking to add multiline labels
> support to gmf code generation?

Joerg was faster ... ;)

> For now to make a label multiline you have to:
[...]

Thanks - this works ... but the additional questions from Joerg are very
interesting, too :)

> Do your know how to enable text formating(like alignment right) in gmf?

> And additionally if it is possible to color/underline/etc. parts of
the label text?

Greetings,

Ralf
Re: HowTo realize something like a multiline textfield in GMF? [message #235714 is a reply to message #235631] Thu, 09 July 2009 09:42 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jörg,

> Do your know how to enable text formating(like alignment right) in
> gmf?
There is an operation "setAlignment()" in WrappingLabel class, but is doesn't
work for my diagram.
Concerning rich text formatting in label - there is no such a control in
GEF/GMF AFAIK.

-----------------
Alex Shatalin
Re: HowTo realize something like a multiline textfield in GMF? [message #235749 is a reply to message #235714] Thu, 09 July 2009 11:01 Go to previous messageGo to next message
Ralf Buschermoehle is currently offline Ralf BuschermoehleFriend
Messages: 81
Registered: July 2009
Member
Hi Alex,

Alex Shatalin wrote:

> Concerning rich text formatting in label - there is no such a control in
> GEF/GMF AFAIK.

I tried using StyledText (instead of Text) in

/**
* A cell editor that manages a text entry field.
* The cell editor's value is the text string itself.
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
* @noextend This class is not intended to be subclassed by clients.
*/
public class (now: Styled) TextCellEditor extends CellEditor {

/**
* The text control; initially <code>null</code>.
*/
protected StyledText text; <--

private ModifyListener modifyListener;

.... with corresponding changes is TextCellEditorEx.java and
WrapTextCellEditor.java. Unfortunately a can't edit the created
StyledTextControl.

Any Hints?

Greetings,

Ralf
Re: HowTo realize something like a multiline textfield in GMF? [message #235834 is a reply to message #235749] Thu, 09 July 2009 15:26 Go to previous message
Ralf Buschermoehle is currently offline Ralf BuschermoehleFriend
Messages: 81
Registered: July 2009
Member
Hi,

after some additional changes I am stuck at the point where GMF takes
over control ... and tries to cast to

org.eclipse.swt.custom.StyledText cannot be cast to
org.eclipse.swt.widgets.Text at
org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManag er.setEditText(TextDirectEditManager.java:468)
[...]

Maybe it is a good idea to support directly StyledText instead of Text
for labels?

Greetings,

Ralf

Ralf Buschermoehle wrote:
> Hi Alex,
>
> Alex Shatalin wrote:
>
>> Concerning rich text formatting in label - there is no such a control
>> in GEF/GMF AFAIK.
>
> I tried using StyledText (instead of Text) in
>
> /**
> * A cell editor that manages a text entry field.
> * The cell editor's value is the text string itself.
> * <p>
> * This class may be instantiated; it is not intended to be subclassed.
> * </p>
> * @noextend This class is not intended to be subclassed by clients.
> */
> public class (now: Styled) TextCellEditor extends CellEditor {
>
> /**
> * The text control; initially <code>null</code>.
> */
> protected StyledText text; <--
>
> private ModifyListener modifyListener;
>
> .... with corresponding changes is TextCellEditorEx.java and
> WrapTextCellEditor.java. Unfortunately a can't edit the created
> StyledTextControl.
>
> Any Hints?
>
> Greetings,
>
> Ralf
Previous Topic:Open diagram impractical with new WrappingLabel
Next Topic:"Invalid view - remove from diagram" on diagrams created with older GMF opened in latest G
Goto Forum:
  


Current Time: Thu Apr 25 19:26:53 GMT 2024

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

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

Back to the top