Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to create multiline messages in GMF?(How to create multiline messages in GMF?)
How to create multiline messages in GMF? [message #632537] Wed, 13 October 2010 11:00 Go to next message
Milind is currently offline MilindFriend
Messages: 31
Registered: April 2010
Member
Hi, How to create multiline messages in GMF?
Re: How to create multiline messages in GMF? [message #632550 is a reply to message #632537] Wed, 13 October 2010 11:49 Go to previous messageGo to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Am 13.10.10 13:00, schrieb Milind:
> Hi, How to create multiline messages in GMF?

You have to edit the EMF Generator model, e.g. mymodel.genmodel

There in the properties for you label you can set "multiline" to true.
Then you get a "..." button in the properties section for your editor
that will open a multiline dialog for editing. I think, GMF will use
that property also. Usually you should be able to enter newline with
ctrl+Enter in the in-place-editor.

Hauke
Re: How to create multiline messages in GMF? [message #632742 is a reply to message #632550] Thu, 14 October 2010 06:59 Go to previous messageGo to next message
Milind is currently offline MilindFriend
Messages: 31
Registered: April 2010
Member
Hi Hauke,

Actually,We need to display the Validation Message(Batch validation) in Multiline when the length crosses certain limit..

could you provide us any suggestion on how to proceed.

Re: How to create multiline messages in GMF? [message #633105 is a reply to message #632742] Fri, 15 October 2010 11:44 Go to previous messageGo to next message
Hauke Fuhrmann is currently offline Hauke FuhrmannFriend
Messages: 333
Registered: July 2009
Senior Member
Am 14.10.10 08:59, schrieb Milind:
> Actually,We need to display the Validation Message(Batch validation) in
> Multiline when the length crosses certain limit..
>
> could you provide us any suggestion on how to proceed.

Sorry, I don't exactly understand what you mean. What message where do
you want to have multiline? Directly in the diagram or where else?

Unfortunately I fear I cannot help you with that.

Hauke
Re: How to create multiline messages in GMF? [message #633110 is a reply to message #632742] Fri, 15 October 2010 12:02 Go to previous message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi Milind,

you should try the solution bellow, its worked for me.

1-you have to go to your *.gmfgen model and navigate to the Property Sheet element. Create a new Custom Property Tab element and populate it this way:

Human Readable Label : Validation
Identifier: validation
Implementation Class : ModelDescriptionPropertySection

then you create a child Typed selection filter :
Generated types : abstractNavigatorItem
Typed in selection : .... *.Application
....digaram.edit.parts.ApplicationEditPart
the regenearte your diagram.
you should have in your diagram something like this :

Quote:

<extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs" id="proptabs">
.........................
<propertyTab
category="visual"
id="property.tab.DiagramPropertySection"
label="%tab.diagram"/>
<propertyTab
category="domain"
id="property.tab.domain"
label="%tab.domain"/>
<propertyTab
category="extra"
id="property.tab.description"
label="%tab.description"/>
</propertyTabs>
</extension>



2- you edit the generated class ModelDescriptionPropertySection to be like this :
Quote:

public class ModelDescriptionPropertySection extends AbstractBasicTextPropertySection
{


@Override
protected String getPropertyChangeCommandName() {
return "ApplicationDescriptionChangeCommand";
}

@Override
protected String getPropertyNameLabel() {
return "";
}

@Override
protected String getPropertyValueString() {
String description = ((Application) getEObject()).getName();
return description == null ? "" : description;
}

@Override
protected void setPropertyValue(EObject object, Object value) {
((Application) getEObject()).setName((String) value);
}

protected Text createTextWidget(Composite parent) {
Text text = getWidgetFactory().createText(parent, StringStatics.BLANK,
SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP);
FormData data = new FormData();

data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(100, 0);
data.height = 100;
data.width = 100;

text.setLayoutData(data);
if (isReadOnly()) {
text.setEditable(false);
}
return text;
}

@Override
protected EObject unwrap(Object object) {
if (object instanceof Application) {
return (EObject) object;
}
if (object instanceof EditPart) {
Object model = ((EditPart) object).getModel();
return model instanceof View ? ((View) model).getElement() : null;
}
if (object instanceof View) {
return ((View) object).getElement();
}
if (object instanceof IAdaptable) {
View view = (View) ((IAdaptable) object).getAdapter(View.class);
if (view != null) {
return view.getElement();
}
}
return null;
}
}



thats all, you should see than your multiline message of validation.
Good luck
Mahmoud
Previous Topic:How to determine selected element on a node
Next Topic:Custom Creation Tool
Goto Forum:
  


Current Time: Thu Apr 25 23:51:35 GMT 2024

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

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

Back to the top