Registering a template into eclipse plugins (Capella Studio)

Hello
In another post, the ability to register a template into eclipse plugins was mentioned, I prefered to make a separate post for it.

The instruction are described here: Reference Documentation - M2Doc

Sorry if this looks like a very noob’ish question for the eclipse dev enthousiasts, I just did not find the time to dwell into eclipse dev compared to Python or Capella Studio Specifier which don’t need much plugin or manifest file configurations, so first question is about the plugin.xmli.
First step was indeed to write something in the plugin.xml file:
First step is to add an extension

I am not sure if a “path” value need to be added inside the xml tag <template…> or if the uri name is important.

So what I did here was to keep the content of “point” just copy pasted it, and change uri into the path of the place where I added my template (red square in the top)
I am probably making some major mistake here.

Second step was to import the registered template, using Right click > import > M2DOC > import template > select the registered template

Except I can’t find that template, so I am probably making a mistake somewhere, if you see it anywhere please inform me. Thanks

The URI needs to be in the following form:

platform:/plugin/plugin_name/path_in_plugin/template.docx

The plugin needs to be declared as a singleton in the MANIFEST.MF and a dependency to org.obeonetwork.m2doc.ide is also needed.
You can have a look at this post for example projects.

Done, tried both:

  • platform:/plugin/test1000/org.polarsys.capella.vp.test1000.design/template.docx
  • and : platform:/plugin/org.polarsys.capella.vp.test1000.design/template.docx

Done:

Done:
(previous picture) +
image

I can alreay observe that this m2doc ide is 3.2.0 and my template is 3.1.0, I wonder if that the source of the following problem:

Still no template in the import menu:
image

Yes you probably need to lower the lower bound to 3.1.0 in the dependency.

Done in the manifest file manually with no apparent effect:
image
But inside the dependencies menu “add button” we can only find 3.2.0 with CS 5.1 it seems…
I checked again, the installed extension has no impact on the available dependencies items it seems:


Either use a lower version of Capella Studio I guess or really create a 3.2.0 template to see if it finally recognized.
Edit:
I might have mixed things,
the “import template” phase, comes AFTER packaging/creating the update it and testing my package in Capella or in a runtime. Okay

1 Like

Great number of errors, trying to reproduce this with a Capella Studio DSL project (rather than a simple Eclipse java that incorporate Capella libraries such as yours), and encountered and insane number of errors, I retried several times with different configurations, maybe the problem comes from the name of extension that contains the term ‘M2DOC’,

Few examples (click if you wish to see) →

Installing 5.0.1m2doc_3.2.1


After re opening Capella later, I found it was successfully installed apparently, however no trace of the template in the import menu

In this Trial, I found the doc in the import menu however confirming importation lead to:

image

Desactivating an old extension and installing a new version

  • Do you know if the features chosen while creating the update site:
    image
    should include M2DOC ones? And if any create a conflict? What about installing Original M2DOC in Capella and Capella Studio, and about the order? (Installing My extension before/after M2DOC or opposite)

I will continue experimenting, there should be a way to make it work.

The easiest way to install M2Doc on Capella is via the extension:

If you are installing directly from the M2Doc update site:

You will need to add at least the Eclipse update site corresponding to your Capella version. You can find this information in the target platform definitions here.

To install your addon you will need to add the M2Doc update site since you now have a dependency to M2Doc. P2 will resolve dependencies across all available update sites. You can also include your dependencies inside your update site by adding corresponding features/plugins.

In the screenshot I can see that org.eclipse.amalgam.explorer.contextual.core is missing. This dependency comes from one of your plugins.

Thanks, Yes I am used to M2DOC, installed it so many times, but it makes sens to install it in CS (to be able to CREATE a template), and in Capella (to be able to IMPORT a template)

I followed this order:

  • CS + M2DOC 3.2.0 (I upgraded as you have suggested)
  • C + M2DOC 3.2.0
  • CS-> Add Template wherever inside of the plugins → configure plugin.xml with the right uri → add dependency to the first m2doc.ide (and ignore .jdt or .ie)
    → CS → create the update site with only the 4 features you see in scteen shot.
    → C → install the update site
    → import the template

Where do you see the missing (org.eclipse.amalgam.explorer.contextual.core) ? I have 4 screenshots.

Note I have 5.1 for both softwares and made sure i take 3.2.0 for 5.1 (not the one destined to 5.2)


Extra Info:
When installing the update site into Capella (just after having installed official M2DOC) I encounter this message:

and the error is:


About the pluxing.xml here is it:


Final Note:
The template appears inside the import M2Doc menu, however “confirming the import” leads to this error:

This is true WHETHER the extension is referenced OR NOT (through the viewpoint manager (kitalpha)) → Same behaviour, the template appears in the menu in both cases:
image
yet confirming its import fail (could that ever be related to my protected network I am working in or some admin/ user thing? I doubt it but I must take all possibilites in account)

Could there be a bug related to this aswell?
The quickest fix I see, is to do exaclty what you did: create a simple class, with no kitalpha plugins, preferably within Capella Studio to be able to import all Capella libraries, and using the eclipse perspective
That’s the method you have used and that worked I believe?

Is there a more straightworward way to add Capella libraries into a java project than sing the add external jars and go pick them all? (You can’t even pick them all at once, I had to it by chunks or dozens of libraries (3 times))

The update site method does not seem be the way to package java projects:


Indeed I realized this is not a plugin, it cannot be made into a feature therefore cannot be made into an update site.

Edit: Anyway I tried to work out with a plug in project instead of a Capella Studio common kitalpha DSL projects (that seems to be having a bug related to M2DOC when importing templates in Capella) and noticed I did not have the plugin.xml file to configure the template extension point? What do you think?


I guess I should create it: 12.2. Creating plugin.xml - Eclipse Cookbook [Book] (oreilly.com)
Edit:
Made it through all that, and when installing the update site into Capella here is the result →

I am kinda stuck.


Edit: tried to resolve this error by adding more features into the feature I made from my plug-in project, it seemed that some features related to osgi and equinox.p2 were missing, so I went and I added ANY feature related to this 2 terms:
image

→ updated and installed into a fresh Capella installation: Same result! Same error.
Althought testing again, made it clear that google.inject was missing from the feature and not from the update site.

To summerize:

  1. I tried the Capella Studio DSL project → Update Site → Install it in Capella → Template appears in the import M2DOC menu but an error appears when confirming the import!
  2. I tried Java project → added ALL CAPELLA LIBRARIES → Could not make a plugin from it
  3. I tried a Plug in project → Added ALL CAPELLA LIBRARIES-> Added a plugin.xml file → made a feature and added the missing "Google.inject"t thing → Made an update site → Installed in Capella → but the template would not appear in the import M2DOC menu.

This screen shot:

For the template not found You need to add the template to the plugin resources in the build.properties:

I’ll replace the test.zip file above.

The install error you have seems related to M2Doc 3.2.0 not being installed. You can either install M2Doc 3.2.0 or lower the dependency in your MANIFEST.MF from 3.2.0 to 3.1.0 (if you installed M2Doc 3.1.0).

1 Like

Thanks, however I think I am not having this error anymore, I was able to install the right M2DOC versions in all softwares, I even got the M2DOC import template menu and saw my template available in that menu, however an error could prevent me from completing the import:

I went out and tried to drop the “vientpoint” extensions, and try just simple java projects/plug ins → was not successful though. (No template in the template menu)


image

The plug in was successfully instaled as you cas see:

Yes not result.
I wrote a summary of my action at the end of my previous post, you can check it if you wish to.
What do you think? Am I in the right path?

I had to try to make the extension in a different way that the usual viewpoint construction style, I had to try making a plug in from scratch, indeed I am having an error with the first method. (Although second method is not working yet)

Just saw this message, like that?

The second method with the plug-in project is the way to go.
The URI you used in the extension point seems ok.
Can you check if your template is present in the installed jar file ?
If not present try to add it to the build.properties.

Interesting, before I advance, is there a difference between “installed jar files” and the resulting folder made after building thourgh an “update site method”?

I am assuming you are talking about the update site folder, and indeed there are no template to be found in any of my 20+ trials I have done.

This is the build.properties config (The view of this file changed from earlier, from text to this, nothing was checked in the right menu (source build) I checked the template just in case.

After saving, i produced a new feature, added the google inject plug in and then produced an update site with this feature.
The Manifest.MF contains ALL capella libraries (don’t know if that’s a mistake or not, so it contains also the m2doc.ide you mentioned earlier)

manifest

And of course I declared the plug in as singleton (done automatically if working with a DSL viewpoint)

Singleton

image

The plugin.xml is as you have seen.


image
No Template.

Your JS_1 is a plugin project ? You should have a JS_1*.jar in the plugin folder of your update site. It’s a zip file, check if the template is present in the jar file.

I admit it, in my 20+ trials, since I started adding the google.inject plugin to the feature I started to forgot to add my plugin project (Yes it is JS_1),
Added it again and retried → I found the Template indeed now, inside the jar plugin of the update site, I extracted the jar to see it:
image

When installing it, I am encountering the same error message as the one telling me about the google plugin, now it is asking for 'github.classgraph"
image

It seems it is going to ask about missing plugins one at a time, because now capella installation window is asking me yet another plugin:

Should I just add all 2417 plugins or de we know the needed plugins prior so I can check that and add only the one needed?

Edit:
I tried to add ALL 2000+ plugins, starte building the update site → it did not go well!

Hum… you should not need all of this. Dependencies from Capella are already installed and you probably only added a dependency to M2Doc so installing M2Doc should be enough.

  • unzip a Capella
  • install M2Doc
  • install your addon

That should be it.

That would be great, I can’t wait to announce it when it works, However it is not working yet. (I see it as a distant dream right now)

I had M2DOC installed prior to my extensions, proof:


(Note: Rereading my own comment, I am realizing that all these extension gave message errors yet they are appearing as being “available”/installed, so strange)

I made DOZENS (Yep Dozens) of experiments today and I came to the conclusion that EVEN IF you have installed the M2DOC extension correctly, the first update site will go okay with no error, but installing a second update site will produce that error about missing contextual explorer, I assure you it happens if you have installed M2DOC prior correctly. I suppose that my first update site is “altering” M2DOC plugins/contextual explorer plugin/ somehow?


Back to the point about Features and other plugins:
Just to be clear, when making a plug in project in CS, the capella libraries are not included I had to add them through dependencies menu button:
image
Although I should have added them with another method maybe?

Anyway, then I made a feature where I simply included the plug in project as a whole nothing else → Then the update site takes That Feature simply → Then produced the update site.

The following errors appear, they are relative to these “missing” plugins:

  • Google.inject
  • github classgraph
  • lpg.runtime…

  • (These can be added during the feature creation step, but the error message indicates a missing plugin only ONE at a time. )
    → I think I did not get this error only once and I am unable to know how or why it did not appear that time.

Another note to know: This “making a feature” does not exist when working with the capella studio perspective (working on viewpoints), you can directly make the update site,
It’s as if, the “feature” was made preemptively, and this “virtual feature” already contains all the necessary plugins. So when I am making my own feature (because the plug in perspective and plug in projects needs one), well I don’t have all the necessary plugins preemptively it seems (In any case installing the update site first time does not show these problems so IDK)

I went back to the feature making step, and instead of adding the mentioned missing plugins (google.inject etc) I went ahead and only added M2DOC plugins:
Still cant install the plugin:


→ This time it skipped the first three missing usual plugins (Google.inject etc) and directly asked me about some lpg.runtime.java plugin.


I will try in inside a new fresh capella instllation (unzip it, install M2DoC, install addon) yet again, in order to be sure there is no conflict between new plugins and old ones (I will also use a new CS).

Here are the followed steps:

  1. New Capella:
    image
  2. Install M2DOC 3.2.0
    image
"Install ok

  1. New CS:
  2. Install M2DOC 3.2.0
Install OK

  1. Add every plugin available to dependencies
  2. Set singleton to true
  3. Create my Class and add the Template, and configure it:
Template77

  1. Add the template to build.properties
    → Shall I check all the boxes for all elements (src, .settings, .bin…)?

  2. Create a feature with ONLY my plugin:
    image

  3. Create an Update site that contains simply: the feature created and nothing else I believe:
    image

  4. Install in Capella

No Error this time!

  1. No Template

  2. Went back to Build properties:
    image
    And checked everything,
    → The new extention can’t be installed, the explorer plugin thing missing → Need to make a new Capella installation.

This is so exhausting, Spent 5H straight with no break trying to solve this.
(Also I am suspecting my features/builds configs to be sticking in CS, so I am probably needing a new CS installation a new fresh plug in project.)


Finally I retried again with new fresh C and CS installations (and this time)…
Instead of having 0 error (first update site) as I did the other time, I just got the usual errors “missing plugins”:


After several hours, I am less and less sure what I shall do.

  1. First, I dont know why the capella Studio Viewpoint method (DSL), produce that error when confirming the import of the template (did you guys inverstigate and found some bug?). At least with the viewpoint method the extention can be installed to Capella.
  2. Secondly, When using the plug in project, there are some considerations to have in terms of libraries
  • Capella libraries to add to dependencies (Shoul I have used the build path instead (only available through proprties of the project))
  • Considerations for plugin.xml (which is not existing in the beginning) and in term of build.properties
  • Creating a correct feature (does it need any more plugins other than the current plug in project?)
  • Creating the Update site (does it need any more features other than the previous feature?)
  1. Installing M2DOC 3.2.0 FIRST in C and CS THEN making the update site and installing it → Seems to not be working,
    I made it work like 1/30 times?

I am even considering whether cpy pasting .zip files into dorpings of freshly unzipped capella installation could be affecting the software and could somebhow preventing me from achieving this. Indeed I noticed that “available softwares” for some capella installations were richer sometimes depending on factors I have no control over (cf. my other post asking about capella first available softwares)

M2Doc doesn’t depend on lpg.runtime.java nor com.google.inject. Can you try with the two projects I provided as example and start a runtime. This way you will at least be able to develop your services and templates.

  1. You don’t need to import the template. You can reference it from the template registry in your .genconf file. And there are M2Doc tests for both referencing the template and importing it that works fine.
  2. You just need dependencies declared in the test project aka Capella metamodel and the M2Doc IDE plugin. So since both are already installed when you install your update site p2 should not complain about missing plugins.
  • All dependencies are declared via the MANIFEST.MF like in the test project.
  • when you use the template registry extension point, PDE will make your plugin a singleton and add the newly create plugin.xml file to the build.properties
  • I don’t know what you put in your feature but as long as the plugin with the service class and the template is in the feature you should be good.
  • you should not need any thing else since you already have the Capella metamodel installed and M2Doc installed.

I add here the feature and update site for the test project. You can build and install the update site no missing dependencies. I’m able to generate the document and import the template.

feature.zip (895 Bytes)

updatesite.zip (621 Bytes)

1 Like

Alright thank you, I am bit upset for not finding the reason for the errors. But maybe tweaking with your feature and updatesite and comparing things will help me find the reasons for my multiple and numerious various errors. I love finding keys and resolve problems.

I will check them later, but just a quick test gave me this result:

  1. Fresh Cap
  2. Fresh M2DOC extension
  3. Tying to install the update site to Capella (without opening the test (plugin project) nor the feature) just the update site:

It does not want to be installed.

Maybe my problem is wanting it to work as an extension (same as other extensions like Capella Requirement and such). I will experiment again for sure, but this is a first observation that is a bit puzzling. I think we are not having the same methods of testing update sites? Will keep you informed in any case and thanks again.