Problem with multiline Label, the setTextWrap(true); does not work [message #482178] |
Tue, 25 August 2009 15:13 |
Bo Liu Messages: 9 Registered: July 2009 |
Junior Member |
|
|
Hi everyone,
I want to implement a multiline label, as far as I read from previous
threads, it's
1. set the wappinglabel's setTextWrap(true);
2. then make the method annotated by @generated NOT
here is my code
/**
* @generated NOT
*/
private void createContents() {
fFigurePFMachineNameFigure = new WrappingLabel();
fFigurePFMachineNameFigure.setText("<...>");
fFigurePFMachineNameFigure.setTextWrap(true);
...
}
but the label still is only one line, The rectangle's defautlt size is
(100,62), and it resizes(longer) by the length of the label!!
I tried to set the maximunSize of the label but it also did not work.
I current use newest Eclipse Moddeling, and my GMF version is 2.2.0, any
idea about this?
BTW, how can I constrain the length of a label? the setMaximumSize()
function does not seem to be useful on label.
Kind Regards
Liu Bo
|
|
|
Re: Problem with multiline Label, the setTextWrap(true); does not work [message #482192 is a reply to message #482178] |
Tue, 25 August 2009 16:28 |
Ivo Petkov Messages: 14 Registered: August 2009 |
Junior Member |
|
|
Hi Lui,
Try this:
in the EditPart of the label change the getManager like this:
/**
* @generated NOT
*/
protected DirectEditManager getManager() {
if (manager == null) {
setManager(new TextDirectEditManager(this,
WrapTextCellEditor.class, TTTEditPartFactory
.getTextCellEditorLocator(this)));
}
return manager;
}
The essential is passing directly WrapTextCellEditor.class
To have a new line when you edit the text, press Ctrl + Enter
Regards,
Ivo
[Updated on: Tue, 25 August 2009 16:29] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03426 seconds