Home » Modeling » Papyrus » How to edit myHelloWorld class code from example in C/C++ editor?
| |
Re: How to edit myHelloWorld class code from example in C/C++ editor? [message #1834896 is a reply to message #1834874] |
Fri, 20 November 2020 01:49 |
Manuel Malagon Messages: 81 Registered: December 2011 |
Member |
|
|
Thank you very much for helping!
Ansgar Radermacher wrote on Thu, 19 November 2020 08:29
Open a synchronizing Papyrus CDT editor. In order to do so, right click on the class and choose Designer->open a CDT editor from the context menu.
I'm on the papyrus perspective and when I execute that what you say no other window is opened. Actually, nothing seems to happen.
When I right-click on the class and choose Designer->open a CDT editor from the context menu I get a popup box asking to select a code generator. It has two options, Standard C and Standard C++, and nothing happens regardless of what I select.
Do you know what this could be?
[Updated on: Fri, 20 November 2020 03:06] Report message to a moderator
|
|
|
Re: How to edit myHelloWorld class code from example in C/C++ editor? [message #1834919 is a reply to message #1834896] |
Fri, 20 November 2020 14:16 |
|
Did you use a nightly build of Designer? (probably yes, since you had the option to generate C code which is not part of the build). Which Eclipse version?
The C/C++ view appears in the same area where the property view is, it can easily be overlooked.
Assuming that you used a nightly build: did you see the C/C++ tab in the property view when you select a class already having the "Include" stereotype? The appearance of the tab depends on the selected element and is currently only supported for some elements already having the stereotype (such as "Include").
Concerning the CDT integration. The idea is that the tool generates code and then opening the editor on the generated code. In order to do so, it needs to know which generator to use, as both the C and C++ generator are eligible for models applying the C/C++ profile. Therefore, the tool uses a hint (in form of a stereotype of a common code-generation profile) in order to store the generator choice. If the hint is not present, the popup is invoked. Normally, you should choose Standard C++ (you'll be asked only once) and a CDT editor should open. As this is apparently not the case, can you please observe the error-log for eventual exceptions (empty the log before invoking the CDT editor).
|
|
|
Re: How to edit myHelloWorld class code from example in C/C++ editor? [message #1834924 is a reply to message #1834919] |
Fri, 20 November 2020 17:49 |
Manuel Malagon Messages: 81 Registered: December 2011 |
Member |
|
|
Ansgar Radermacher wrote on Fri, 20 November 2020 09:16Did you use a nightly build of Designer? (probably yes, since you had the option to generate C code which is not part of the build). Which Eclipse version?
Version: 2020-09 (4.17.0)
Ansgar Radermacher wrote on Fri, 20 November 2020 09:16The C/C++ view appears in the same area where the property view is, it can easily be overlooked.
Assuming that you used a nightly build: did you see the C/C++ tab in the property view when you select a class already having the "Include" stereotype? The appearance of the tab depends on the selected element and is currently only supported for some elements already having the stereotype (such as "Include").
Yes, I can see the C/C++ tab showing up when selecting a class with the <<Include>> stereotype.
Ansgar Radermacher wrote on Fri, 20 November 2020 09:16Concerning the CDT integration. The idea is that the tool generates code and then opening the editor on the generated code. In order to do so, it needs to know which generator to use, as both the C and C++ generator are eligible for models applying the C/C++ profile. Therefore, the tool uses a hint (in form of a stereotype of a common code-generation profile) in order to store the generator choice. If the hint is not present, the popup is invoked. Normally, you should choose Standard C++ (you'll be asked only once) and a CDT editor should open. As this is apparently not the case, can you please observe the error-log for eventual exceptions (empty the log before invoking the CDT editor).
Well, now that you mention this. in order to use CDT editor I had to generate the code first which in turn creates a CDT project. After generating the CDT project, right-clicking on the class and selecting Designer and Open a CDT Editor causes the C/C++ editor to open the CDT project cpp file created by the code generation step.
But I thought that when creating a diagram I could edit code using the normal C/C++ editor within the papyrus project, without having to create the CDT project first, and not using the C/C++ tab. The tab is fine for a couple of lines of code, but as code grows that becomes a big problem, especially with the plain text editing and lack of code navigation in the tab that the C/C++ CDT editor provides.
[Updated on: Fri, 20 November 2020 18:38] Report message to a moderator
|
|
|
Re: How to edit myHelloWorld class code from example in C/C++ editor? [message #1834989 is a reply to message #1834924] |
Mon, 23 November 2020 07:42 |
|
Hi,
> But I thought that when creating a diagram I could edit code using the normal C/C++ editor within the papyrus project, without having to create the CDT project first, and not using the C/C++ tab. The tab is fine for a couple of lines of code, but as code grows that becomes a big problem, especially with the plain text editing and lack of code navigation in the tab that the C/C++ CDT editor provides.
when I said that you have to generate code first, I described what happens internally. The end user should not have to care about it. However, the project into which the generated code will be stored, needs to exist. This is a bug, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=569052 (as the project already existed in my tests, I did not notice that). It will be corrected as soon as possible.
But code synchronization should work, see how it's done for the Robotics customization in this video: https://www.youtube.com/watch?v=P61COtOuUm0 (even if used in a different context, the approach is based on the same synchronizing CDT editor as in base SW designer)
|
|
| |
Re: How to edit myHelloWorld class code from example in C/C++ editor? [message #1835144 is a reply to message #1835036] |
Wed, 25 November 2020 15:30 |
|
It seems that you did not open a synchronizing editor, but a "normal" CDT editor. The synchronizing editor has a green bar on the left, if synchronization is active (it will turn orange, if you close for instance the model).
Do not open the CDT editor on the generated file using the project or package editor, use the context menu in the model to open the editor.
|
|
| |
Goto Forum:
Current Time: Tue Sep 24 08:33:35 GMT 2024
Powered by FUDForum. Page generated in 0.04260 seconds
|