| 
| TextObjectEditor - setMultiLine(true) not working as expected? [message #1690062] | Tue, 24 March 2015 18:08  |  | 
| Eclipse User  |  |  |  |  | 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 10:56   |  | 
| Eclipse User  |  |  |  |  | Hey Ralph, 
 Yep, looks like you're right (as usual
  ) 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
 |  |  |  | 
|  | 
Powered by 
FUDForum. Page generated in 0.39107 seconds