osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
39 stars 8 forks source link

Inverse Feature Group Source Format #1026

Closed RyanMcilnay closed 6 years ago

RyanMcilnay commented 6 years ago

Using the graphical editor to set a Feature Group to inverse and then non-inverse creates a missing space in the source.

Right click on Feature Group -> Set Inverse. Right click on Feature Group -> Set Non-Inverse.

Result in source:


fg: feature groupfg_classifier;
philip-alldredge commented 6 years ago

This is presumably something related to the AADL source formatter.

joeseibel commented 6 years ago

I was not able to reproduce this since I could not find "Set Inverse" and "Set Non-Inverse" in the context menu. Are those commands on a branch other than develop?

I also tried testing the formatter by programmatically creating an AADL model, then serializing it. The model contained two feature groups, both referring to feature group types, one inverse and one not. It serialized and formatted correctly, so I'm not convinced that it is a problem with the formatter.

philip-alldredge commented 6 years ago

The functionality was recently moved into the "Properties" view. This can be accessed by double-clicking on the feature group in the graphical editor. An inverse checkbox will be available from the AADL tab if the feature group has a classifier set.

philip-alldredge commented 6 years ago

@lwrage and @joeseibel Please see the following code as a way of reproducing the issue. It seems to occur when the model is loaded and then modified. The code assumes there is a project "feature_group_test" in the OSATE workspace.

https://gist.github.com/philip-alldredge/40f99da42e4a56a8be406ba28dac1b69

It produces the following result:

package feature_group_test
public
    feature group test_fgt
    end test_fgt;

    system test_system
        features
            test: feature grouptest_fgt;
    end test_system;
end feature_group_test;
lwrage commented 6 years ago

@philip-alldredge If you save the resource directly, you need to turn on the formatter somehow. I don't remember exactly how the internals work, though. @joeseibel Can you explain what needs to be done?

philip-alldredge commented 6 years ago

@joeseibel @lwrage I've pushed a change to the GE that enables the formatter in such cases. See https://github.com/osate/osate-ge/commit/bd4fe816068c2981b5b9454fd041ccece0f9dcfa

In this circumstance, modifying the feature group works as expected. However, I find it odd that the formatter has to run for the serialization not to produce invalid source.

lwrage commented 6 years ago

I assume there's an underlying xtext bug in the serialization of grammar rules representing keyword sequences.