Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » TextObjectEditor - setMultiLine(true) not working as expected?
TextObjectEditor - setMultiLine(true) not working as expected? [message #1690062] Tue, 24 March 2015 22:08 Go to next message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 119
Registered: July 2009
Senior Member
Hi,

I have a question about the class org.eclipse.bpmn2.modeler.core.merrimac.dialogs.TextObjectEditor
It looks to me that the multi-line feature is not working as expected?

I try to create the editor widget like this:

 TextObjectEditor valueEditor = new TextObjectEditor(this, metaData, METADATA_VALUE);
 valueEditor.setMultiLine(true);
 valueEditor.createControl(this, "Value");


But in this case the editor will be displayed as a single line editor with a heightHint of 100 but with no multi-line and no scroll bar.

It only works if I create the editor like this:

 TextObjectEditor valueEditor = new TextObjectEditor(this, metaData, METADATA_VALUE);
 valueEditor.setMultiLine(true);
 valueEditor.setStyle( SWT.MULTI | SWT.V_SCROLL);
 valueEditor.createControl(this, "Value");


So I need to set the style 'SWT.MULTI' explicit.
If I look into the sources of the method setMultiLine() it seems to be logical that the call

 valueEditor.setMultiLine(true); 


is not enough and has no effect. Is this the desired behavior of that method?
Maybe this is a side effect of the CData model extension? But setting the style to SWT.MULTI | SWT.V_SCROLL everything woks perfect.

===
Ralph
Re: TextObjectEditor - setMultiLine(true) not working as expected? [message #1690175 is a reply to message #1690062] Wed, 25 March 2015 14:56 Go to previous messageGo to next message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hey Ralph,

Yep, looks like you're right (as usual Wink) I don't know what the heck I was thinking when I wrote that code. It looks like the test for multiline in createControl() is at fault:

	@Override
	protected Control createControl(Composite composite, String label, int style) {
		createLabel(composite,label);

		if (testMultiLine && super.isMultiLineText()) {
			multiLine = true;
			style |= SWT.MULTI | SWT.V_SCROLL;
		}


I think it should look more like this:

	@Override
	protected Control createControl(Composite composite, String label, int style) {
		createLabel(composite,label);

		if (multiLine || (testMultiLine && super.isMultiLineText())) {
			multiLine = true;
			style |= SWT.MULTI | SWT.V_SCROLL;
		}


because of the setMultiLine() method:

	public void setMultiLine(boolean multiLine) {
		testMultiLine = false;
		this.multiLine = multiLine;

	}


What I wanted to accomplish was to allow custom property tabs to override the multiline setting from the ExtendedPropertiesAdapter's isMultiLine(), hence the use of the "testMultiLine" flag here.

Please create a bugzilla to track this issue.

Thanks!
Bob
Re: TextObjectEditor - setMultiLine(true) not working as expected? [message #1690507 is a reply to message #1690175] Fri, 27 March 2015 16:37 Go to previous message
Ralph Soika is currently offline Ralph SoikaFriend
Messages: 119
Registered: July 2009
Senior Member
I have opened a bug report:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=463310

Previous Topic:GMF/EFM BPMN2 Modeler project
Next Topic:Replacing property tab did overwrite all model objects?
Goto Forum:
  


Current Time: Wed Jan 17 20:25:30 GMT 2018

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

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