Bug 480981 - Removed '\n' and '\t' in expression code
Summary: Removed '\n' and '\t' in expression code
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard: backport
Keywords: triaged
: 496196 562664 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-29 07:55 EDT by Yariv Amar CLA
Modified: 2020-04-30 10:25 EDT (History)
5 users (show)

See Also:


Attachments
Folded state (32.84 KB, image/png)
2017-01-09 07:21 EST, Pierre-Charles David CLA
no flags Details
Expanded state (33.12 KB, image/png)
2017-01-09 07:22 EST, Pierre-Charles David CLA
no flags Details
Embedded Unicode chars when displaying multi-line expressions with the second patch (3.50 KB, image/png)
2017-01-09 07:32 EST, Pierre-Charles David CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yariv Amar CLA 2015-10-29 07:55:06 EDT
I have table with Feature Column that has the following label expression:
 [if self.oclIsTypeOf(myDsl::SomeType) then self.name else '' endif /]

when changing the expression to have multiple lines 
 [if self.oclIsTypeOf(myDsl::SomeType) 
    then self.name else '' 
  endif /]


Then the above code is replaced with the following (bad) code.

 [if self.oclIsTypeOf(myDsl::SomeType) ...


as you can see everything after the first new line (\n) is truncated and replaced with "..."


(see also https://www.eclipse.org/forums/index.php?t=msg&th=1071450&goto=1712258 )
Comment 1 Esteban DUGUEPEROUX CLA 2015-11-06 04:18:52 EST
Now there is no more "..." but the text is formatted to be on a single line.
This come from TextWithContentProposalDialog.okPressed() which remove '\n' and '\t'.
Comment 2 Esteban DUGUEPEROUX CLA 2015-11-06 05:11:22 EST
A fix would be to have TextWithContentProposalDialog called with getDefaultFeatureAsText() instead of text and not have TextWithContentProposalDialog.okPressed() remove '\n' and '\t'. But there remains the issue that the Text is editable with the "...".
Comment 3 Pierre-Charles David CLA 2016-06-15 11:42:10 EDT
*** Bug 496196 has been marked as a duplicate of this bug. ***
Comment 4 Pierre-Charles David CLA 2017-01-09 07:21:49 EST
Created attachment 266184 [details]
Folded state
Comment 5 Pierre-Charles David CLA 2017-01-09 07:22:14 EST
Created attachment 266185 [details]
Expanded state
Comment 6 Pierre-Charles David CLA 2017-01-09 07:25:42 EST
The draft patch at https://git.eclipse.org/r/88264, while not really a solution to this issue, is an attempt to replace the dialog box (modal dialogs tend to break the workflow) with a toggle to switch the interpreted expressions text fields between single or multi-line states. See the attached screenshots for what it looks like. I'm not completely convinced this would be the right approach, just posting it here as one possible approach.
Comment 7 Eclipse Genie CLA 2017-01-09 07:28:08 EST
New Gerrit change created: https://git.eclipse.org/r/88266
Comment 8 Pierre-Charles David CLA 2017-01-09 07:32:41 EST
Created attachment 266186 [details]
Embedded Unicode chars when displaying multi-line expressions with the second patch

(In reply to Eclipse Genie from comment #7)
> New Gerrit change created: https://git.eclipse.org/r/88266

This second patch is independant of the first one, but still a draft. It's only purpose is to clearly identify the offdending code which alters the value of the epxression entered by the specifier.

By itself, if an expression has "\n" chars in it, it will be displayed on a single line with embedded Unicode placeholders (see attached screenshot).
Comment 9 Pierre-Charles David CLA 2017-04-24 09:31:52 EDT
Just noticed we didn't backport the temporary fix made on the maintanance branch. We should at least do that for 5.0.
Comment 10 Pierre-Charles David CLA 2017-05-02 05:36:27 EDT
I've pushed ca0caa99753116848bd0deb387dd15982c6d9999 on master, which disables the broken button. It's the same change that was made on the maintenance branch. Moving to 5.1 to re-evaluate if we can find a better solution to get the "multi-line editing" feature back, and if it's worth it.
Comment 11 Pierre-Charles David CLA 2020-04-30 10:25:11 EDT
*** Bug 562664 has been marked as a duplicate of this bug. ***