Bug 324964 - Allow derived properties
Summary: Allow derived properties
Status: NEW
Alias: None
Product: EMFT
Classification: Modeling
Component: MWE (show other bugs)
Version: 1.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-10 09:17 EDT by Moritz Eysholdt CLA
Modified: 2010-09-11 05:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Eysholdt CLA 2010-09-10 09:17:52 EDT
In the forum, an interesting problem has come up:
1. in an MWE workflow, a property containing backslashes (\) was declared.
2. This property was handed on to a component which evaluates an Xtend expression.

Example:

------
var src_gen = "c:\\var\\foo"

org.eclipse.xtend.typesystem.xsd.XMLWriter {
	uriExpression = {
		expression = "\'${src_gen}\' + extension::getFileName()"
	}
}
------
http://www.openarchitectureware.org/forum/viewtopic.php?showtopic=15205

This can not work because either MWE needs to be able to escape the backshashes or Xtend need to have a string-token that can contain unescaped backslashes.

If the propertie's original value is seen as untouchable, one solution might be to allow derived attributes:

------
var src_gen = "c:\\var\\foo"
var src_gen_esacepd = replaceBacksashWithForwarndSlash(src_gen)

org.eclipse.xtend.typesystem.xsd.XMLWriter {
	uriExpression = {
		expression = "\'${src_gen_esacepd}\' + extension::getFileName()"
	}
}
------

with replaceBacksashWithForwarndSlash() being a Java method.
Comment 1 Sven Efftinge CLA 2010-09-11 05:15:37 EDT
If you have four backslashes it should work.
In case you want to reuse the information and only make it xtend compatible for the one situation (i.e. you can't use four backslashes), you should create a small subclass of the component, where you do the escaping.

For instance :

org.eclipse.xtend.typesystem.xsd.XMLWriter {
    uriExpression = MyEscapingUriExpression {
        expression = "\'${src_gen_esacepd}\' + extension::getFileName()"
    }
}


Where MyEscapingUriExpression replaces single backslashes by double backslashes.
Also as suggested simple forward slashes should also solve the issue.

I think such rare situations are solvable with this approach. Therefore I wouldn't want to add the proposed feature. Did I miss something?