| Summary: | Sapphire expression EL should support instanceof operation | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Shenxue Zhou <shenxue.zhou> |
| Component: | Sapphire | Assignee: | Konstantin Komissarchik <konstantin> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Implemented InstanceOf function (not operator). From the docs:
Determines if an object is of specified type. The object to be checked is the first operand and the type is the second operand. The type must be a fully-qualified Java class name.
Example
${ InstanceOf( 12345, "java.lang.Number" ) }
${ InstanceOf( SampleProperty, "org.eclipse.sapphire.samples.ISampleModelElement" ) }
Unit test TestExpr0008 covers the new functionality.
Please verify.
I've verified the new instanceof function using the following expression:
${InstanceOf(TaskFlowReference, "oracle.eclipse.tools.adf.controller.model.IStaticTaskFlowReference") ? (TaskFlowReference.Id != null ? "taskFlowCallIcon" : "tfCallIncompleteIcon") : "tfCallIncompleteIcon"}
It works great. Thanks!
|
I have a use case where I need to use different images for a diagram node depending on the model element type. Here is my property that I intend to reference in my node image expression: // *** TaskFlowReference *** @Type ( base = ITaskFlowReference.class, possible = { IStaticTaskFlowReference.class, IDynamicTaskFlowReference.class } ) @Label( standard = "task flow reference" ) @XmlElementBinding ( mappings = { @XmlElementBinding.Mapping( element = "task-flow-reference", type = IStaticTaskFlowReference.class ), @XmlElementBinding.Mapping( element = "dynamic-task-flow-reference", type = IDynamicTaskFlowReference.class ) } ) ElementProperty PROP_TASK_FLOW_REFERENCE = new ElementProperty( TYPE, "TaskFlowReference" ); I need to write my node image expression like the following: ${TaskFlowReference instanceof IStaticTaskFlowReference ? (((IStaticTaskFlowReference)TaskFlowReference).Id != null ? completeTFCallIcon : incompleteTFCallIcon) : incompleteTFCallIcon} Currently there is no instanceof or function in the EL. It'd be great to support them.