Auto-change comments in java classes - autocomplete

Do you know any utility to change comments in java classes automatically? Also it's about updating copyright date in java classes.
Thanks.

You can use ANT Task to update source's text
https://ant.apache.org/manual/Tasks/replaceregexp.html

Related

Call an Inherited Operation in a Sequence Diagram using the Obeo Uml-Designer Eclipse Plugin

My employer recently adopted the Obeo Uml-Designer plugin for Eclipse as the new UML diagram tool.
I'm having some trouble with Sequence diagrams. When you call an Operation on an existing class a dialog comes up that lets you select the operation. Unfortunately it only contains those that are owned by the object directly, and not inherited operations. I created a class diagram previously and added a reference to the parent class but that doesn't make a difference.
Does anyone know how to do this?
Thanks!
Rob
This is a known bug : https://github.com/ObeoNetwork/UML-Designer/issues/416
I will try to fix it for the next 5.0.0 version which will be available at the end of this month.
Thanks for your feedback,
Mélanie

How to generate code by Papyrus on Eclipse?

I install Papyrus at here. So how to generate code using Papyrus ?
To generate the java code from UML you can follow the below steps.
New Project->EMF Project Press Next
give the project name
In Model Importer page select UML model and press Next
Select UML model which is created by using Papyrus.Press next
In Package selection page select all the root packages
click finish, it will generate genmodel.
Use the genmodel to generate Java code.
I hope this information helps.
In order to generate any text artifacts from UML models in the Eclipse Modelling Environment (i.e. Papyrus, TopCased, etc.) you should use Acceleo which is an eclipse implementation of the MOF models to text transformation language, the OMG standard language for models to text transformations.
It is a very well made technology but it could take some time to become familiar with it especially if you do not know MOF and the Model Driven Architecture.
QVT is another OMG language but its aim is models to models transformations (not models to text). It is therefore not the right answer to your question.
These can help you.
Papyrus Tutorials
Papyrus is an Eclipse lugin for modeling, you need to use additional Eclipse plugin to do model transformations. In the other answer you can find link to tutorials. First of them indicates you should use QVTo.
Resources:
http://wiki.eclipse.org/M2M/Operational_QVT_Language_%28QVTO%29
http://www.eclipse.org/m2m/qvto/doc
http://www.eclipse.org/modeling/m2m/downloads/index.php?project=qvtoml
To generate code from a UML diagram created with Papyrus must create a run configuration for Papyrus.
More information and a demo video at the following links.
http://www.papyrusuml.org/scripts/home/publigen/content/templates/show.asp?P=140&L=EN
http://www.papyrusuml.org/home/liblocal/docs/Documentation/Java-Code-Gen/Papyrus-GenJava-GenerateCode.swf
You need to install Papyrus Java Classes Generator.
Help --> install new software
work with : http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/mars
Check group items by category
Check show only the latest version of available software
Check Papyrus Java
Next --> accept terms and conditions
finish
Now, in your model.di : right click on your class --> Java --> Generate java code.
And you're done !
It doesn't work with Java because even if you get a code from a class diagram then this code is so dirty that it is totally unusable.
It seems that this tool has been written by modelers who have never done any java codding :-)

Can I write Eclipse plugins using Groovy?

Groovy seems to fix a lot of the things I dislike about Java, and I was wondering if it would be possible to actually write an Eclipse plugin in Groovy instead of Java.
Does anyone know if this is possible, and if so how to go about it?
I've just found a blog entry which says it's not officially supported but is actually possible.
Not yet tested to see if it works, but it seems promising:
Writing Eclipse plugins with Groovy, by Jörn Dinkla
#Peter, I do not think that the blog post you linked to is complete or if it will really work. It is pointing to the old version of Groovy-Eclipse, which is no longer supported and is out of date.
Yes. It is possible to create your own plugins in Groovy.
First, install the Groovy-Eclipse plugin from here:
http://dist.codehaus.org/groovy/distributions/greclipse/snapshot/e3.7/
Then you can create a new plugin project and add the Groovy Nature.
Remove the Groovy Libraries classpath container
Instead, add the org.codehause.groovy as a required bundle
Create your Groovy code as normal
Now, the tricky part is exporting the plugin using PDE. See this blog post for how to do that: http://contraptionsforprogramming.blogspot.com/2010/08/groovy-pde-redux.html
One important thing to note is that you will need at least one Java file in your project for PDE to compile anything, It can be a dummy, empty file (this is a bug that has not yet been fixed).
Rejoice!
As an example, here is the codenarc Eclipse plugin that was written completely in Groovy:
http://sourceforge.net/projects/codenarceclipse/
You can also use JRuby, or Javascript ...
JAM Circle is a great example showing how to make great use of a scripting language in an Eclipse plugin, by allowing the end user to write his own actions and load them at runtime.
There's a proxy-like plugin that allows you to implement the plugin virtually in any language that supports JSR223 (javax.scripting)

How to add copyright to Eclipse Helios?

The title says everything. If I want to add copyright comment in code files in Eclipse Helios, how can I do it? Manually copy-paste or is there any other way?
Go to preferences Java/CodeStyle/Code Templates
then expand Code, and New Java Files, edit that, and put in whatever text you want. Now whenever you create a class, that will be automatically injected.
Was looking into doing this for my project and found this plugin quite useful
http://www.wdev91.com/?p=cpw_ug
You can also install the Eclipse Releng tools (from the eclipse 3.6 update site included in Helios). I can add copyright headers to existing files and update existing copyright headers to include the current year.
See http://market.eclipsesource.com/yoxos/node/org.eclipse.releng.tools.feature.group for more information.
The procedure is similar for C++ code in Eclipse CDT:
Window:Preferences:C/C++:Code Style:Code Templates:Comments:Files:Edit
The resulting dialog has a button for inserting variables such as time, date, year, file name, etc.

Java NetBeans Comments Class Diagram Helper

i am starting to learn Java using Netbeans 6.8 IDE.
i am wondering if there is a utility in NetBeans similar to VS2008 that facilitates commenting code and later display these comments in class diagrams?
thanks.
EDIT: i found the Javadoc feature. it is some help but not that great.
The NetBeans UML Plugin is not supported in NetBeans 6.8 (according to this thread, it may come back in 6.9). The recommended alternative is to use SDE for NetBeans from Visual Paradigm (they do offer a free, community edition of their UML tool that works with NetBeans).
Some alternatives (based on Javadoc style annotations that will generate diagrams in javadoc):
APIviz - APIviz is a JavaDoc doclet which extends the Java standard doclet. It generates comprehensive UML-like class and package diagrams for quick understanding of the overall API structure. (Check the samples!)
UMLGraph - (...) In addition, the UMLGraphDoc doclet included in this distribution automatically adds UML diagrams to javadoc documentation. (Example in this article).
yDoc (commercial) - Example in the statsvn project.
Doxygen - an alternative to javadoc
Personally, I would consider APIviz (that you can call from build tools like Ant or Maven). Really, check this sample to get an idea of the result.
NetBeans used to have a UML module, however it's been discontinued since version 6.7. What you can do as a workaround is install an older version of NetBeans alonside your current version, and use the older version to generate the UML diagrams from your code.
Other tools you might look at are Doxygen, which will auto-generate documentation like Javadoc. Paired with graphviz, it can generate visual call graphs, which Javadoc does not do.