Enterprise Architect: Automatically add dependencies in class diagram - uml

I imported my Java code in Enterprise Architect with the code engineering tool. If I add a class in the class diagram editor (UML) it automatically adds the associations and the generalizations but not the dependencies. Is it possible to setup EA that it also includes the existing dependencies from source code (local variables, parameters etc)?

There is one option you can set which controls this in EA 10: look at Tools -- Options -- Source Code Engineering. The last of the list of check boxes is called "Create dependencies for operation returns and parameter types."
This solves the problem as far as parameters are concerned (you'd have to reimport the code, of course), but I haven't tested it to see how it deals with local variables. I'm guessing it doesn't create dependencies for those.

Related

Sparx Enterprise Architect: Show programming language in component diagram

I am using Sparx Enterprise Architect and am somehow confused that I did not find any hint on the internet regarding the following question: How can I show the programming language of a component in the component diagram?
It is clear to me that I could use custom stereotypes but this is not a good idea as it prevents me from using "real" stereotypes later on.
The reason is simply that you can not show it using EA's GUI. You would need to stereotype the element and come up with a shape script to display the language with a
print("#language#");
somewhere.
To assign a shape script to a stereotype there are two ways, the quick and dirty and the difficult one. Here's the q&d one:
Under Configure/UML Types you can add a new 'wild' stereotype. That is one with no profile. EA will show that as <none> when applied. Think of a fitting name and choose Edit with the shape script:
Here can enter the new shape script (since this depends very much here's a simple one):
shape main {
Rectangle(0, 0, 100, 100);
println("#name#");
println("#language#");
}
Save the edit and close the dialog. Once you assign the stereotype to an element it will render like this:
I know this is not pretty and you need to dig into shape scripts to make it useful, but that can't be avoided.
So the difficult, but better and preferred, way is to create your own profile containing the stereotype along with the shape script. The above would just be a way of testing it but finally you would need to create your profile and put it in a MDG. Since this is a quite complex task it won't go here into this answer (no, I'm not Fermat, but you need quite some effort to get that far).
There is no standardized way to show the programming language of a component in UML. There are several ways you can do it, for example:
Stereotype. This will not prevent you from adding other stereotypes in the future. Multiple stereotypes are shown comma separated: «stereotype1, stereotype2»
Generalization. You can define a component called 'JavaComponent' and let all Java components inherit from this base component.
Note. You can attach a note to the component specifying the language.

What is the correct way to import an ADT

I have been following the steps outlined here: https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/importing-resources-with-your-themes
My custom structures and templates are being imported. The problem that I have is that I also want to define an ADT to be imported. Nothing happens when I create the directory structure outline here:https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/creating-plugins-to-share-structures-templates-and-more
Is the "templates-importer" standard deprecated? Can the "resources-importer" and "templates-importer" not be used at the same time?
I don't see any exceptions in the log and there's nothing to indicate why the ADT is not being imported. I have checked in the site template that is generated and in the global site.
Suggestions? Do I really need to create a hook to import the ADT?
You can use only one of those two, but they share common code and functionality (here are if...else statements responsible for chosing one of). If you use Resources Importer already, you can add your ADT's to resources-importer folder (in the same way it is done within templates-importer) and it will be imported as well.
I have a hook project which resources-importer which contains (among others) 4 ADTs. They are located in the following folders:
resources-importer/templates/application_display/asset_category
resources-importer/templates/application_display/asset_entry
First one is imported as ADT for Categories Navigation portlet and second for Asset Publisher portlet.

How to create custom extension point in ReSharper plugin

We are working on plugin for ReSharper and we want to make our plugin extensible. Seems, we should use ShellComponent attribute to do it but we can not find any examples. Could anybody enplane how to define custom extension point and how to manage extension. Example of code of extension point and extension implementation would be very helpful.
Thanks.
If you're looking to write a plugin that can extend ReSharper, you need to tell ReSharper about the classes in your plugin, by marking them with the [ShellComponent] or [SoutionComponent] attributes. These attributes have different lifetimes - a shell component lasts the lifetime of ReSharper itself, and a solution component is created when a solution is opened and disposed when the solution is closed.
To make ReSharper do something useful with your components, they typically have to implement an interface, such as ICodeCompletionItemsProvider, and sometimes have to use a different attribute, such as [CodeCleanupModule] (which itself derives from ShellComponentAttribute). There are many extension points in ReSharper, and the one that's appropriate for you depends on what you're trying to do - refactoring, unit test provider, code cleanup, code completion items, etc. The devguide provides a good introduction to the more common extension points.
But if you want to make your own plugin extensible, then your component needs to work with a kind of provider pattern, by deferring work to multiple provider instances. For example, code cleanup works by deferring to multiple code cleanup modules, each responsible for cleaning up a different aspect of your code (whitespace, ordering, etc). To do this, your component should take in a collection of providers in the constructor. ReSharper's component model will automatically create a collection of these types and pass them to. More specifically, you should have a constructor that takes an IEnumerable<T> or IViewable<T>, where T is the interface of the provider you're going to define and call. The IEnumerable<T> will give you a simple collection of providers, but IViewable<T> represents an observable collection, and allows you to subscribe to notifications of new providers being made available from the component model.

Is there a clever way how to share custom controls among Xpages applications?

For our Xpages application stack we have to create cca. 100 controls that will cover our new UI parts/helpers and some additional services. These controls are meant to be very general and have to be used by many Xpages applications. Now question is how to share these controls among applications(databases). Controls need some managed beans to work, also some CSS, JS and images. To copy the whole stuff into each application and maintain it somehow is not the way (even design inheritance doesnt help here). What's more ... mixing these 100 controls among application specific controls is real hell as controls doesn't support any namespaces or some packages grouping (like java in Package Explorer), so at the end we have very long list of controls in DDE which is nightmare to navigate and work with.
We tried to use Extension Library approach and followed this tutorial
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Master_Table_of_Contents_for_XPages_Extensibility_APIs_Developer_Guide
... but honestly I tried 3 times on my computer from scratch and even example project from tutorial didn't work properly and still caused some errors in update site project. My colleague also tried this on his computer with no luck. And entire process as described in the article above is set of many java classes, XML and configuration files even for small control (eclipse plugin project -> feature project -> updated site project and then you have to install this update site test it and when bug occurs you have to run another cycle ...). Comparing to e.g. this http://tapestry.apache.org/component-classes.html its extremely heavy weight approach in Xpages.
So my question is, is there any other approach that can help us in this area to share controls among applications? Or is there any update expected in this area for upcoming Notes release e.g. R9.1 ?
the most efficient way to share controls is an extension library. It does come with a learning curve. You could use Nathan's XSP Starter Kit to ease your pain. Alternatively you can use the import/export plug-in from OpenNTF to move controls (and their supporting files) around.
In any case: XPages custom controls do support name spaces and grouping -> just have a look at the property panel of a control. You can define:
the namespace (defaults to xc, but you are free to design your own)
the group it should appear in
icons
how it looks at design time (to hide the inner workings)
So step 1 is to group and clean and then think about the distribution. Extlib definitely would be best.
There is good ol' method for sharing design elements in NSF: templates. You can make your database a template, and then inherit just specific design elements by copy/pasting them at designer level. In design element's properties view, Design tab, look for "Inherit from the design template" property. It contains template name from which you copied the element. Watch out for the property "Prohibit design refresh or replace to modify", it should be off.
This has some consequences when deploying the application to production, though, so please, read the documentation/help about template inheritance. Especially combination with XPages/custom controls requires the template to be built and signed.
We use it to share custom controls like application layout and picklists with no problems.

Specifying attribute types in Papyrus

I recently installed Papyrus and attempted to follow the tutorial for creating a model and generating Java code off it.
Unfortunately, I'm pretty much stuck right at the beginning. In the class definition, I added a static operation for main, and I'm able to specify its argument as an array:
in args: <Undefined> [*]
Unfortunately, it does not allow me to specify the type to be String. That is, I would like to specify it as follows:
in args: String [*]
No matter how I enter the type (or any type for that matter), the type reverts back to <Undefined>. I suspect something is wrong or missing with a profile it is supposed to use. Unfortunately, the documentation for this tool is rather sparse, and I cannot find an answer or solution to this.
Anyone has run into this same problem as well???
Have you imported the UML Primitive types package? This should allow you to define the type of the argument to Integer, String or Boolean.
In the model explorer, right click on your model, then choose 'Import package from registered library'
In the window that pops up pick 'UMLPrimitiveTypes' (or the Java ones, if you prefer that).
After this, it should work.
In the latest version of Papyrus, you have to go to model explorer, right click on your model and then choose Import. After that select "Import Registered Package." That will bring up a dialog with a list of registered packages. From that you can select either "UMLPrimitiveTypes" or "JavaPrimitiveTypes"
Papyrus consider that modeling is independent of languages and therefore no java type are usually possible. This is fully logical in a MDA approach but not in the real life :-)
There is an accelero plugin which is supposed to generate code from a diagram but it doesn't work with the latest Helios build so.....
The best is to do you class diagram and then manually code the related code. I am sure that your code will be better than the one you could get from accelero :-)
It's very simple, you can do it by just clicking on the attribute properties, then select type option, In the menu bar select Tree, then Primitive Types.
The String class is not able to see in java primitive types, you need import a package from java core library.
There is a java profile and library/package in Papyrus Software Designer extention.
You may install it via the market place.
More details: https://wiki.eclipse.org/Java_Code_Generation

Resources