Accessing source line number from Java Model [message #1326573] |
Thu, 01 May 2014 20:35 |
Dániel Stein Messages: 2 Registered: May 2014 |
Junior Member |
|
|
Hello,
I'd like to create a model from my java code, update it incrementally, find elements in the model and get the relating line number in the source code.
After I've discovered a Java Project into a Java and Inventory Model, I'm able to find the source file, the source class (and method for some elments), but not the exact line number.
If I use the KDM, I could find the SourceRegion, but the attributes (startLine, startPosition, ...) do not contain any information, only the file reference is set.
So my question is: is it possible to create a model (preferably) incrementally, that has the exact number to the source line? Or is it possible to find the particular line in the file, based on the information in the model?
Thank you.
|
|
|
|
|
Re: Accessing source line number from Java Model [message #1334155 is a reply to message #1328257] |
Mon, 05 May 2014 12:24 |
Fabien Giquel Messages: 147 Registered: July 2009 |
Senior Member |
|
|
Hi Daniel,
these "fragments" can be accessed from code. From the "JavaApplication" top level element, you must follow "java2DirectoryChildren" and "java2FileChildren" links -> "Java2File" elements own the SourceRegion.
You may have a look at source for "org.eclipse.modisco.java.composition.javaapplication.queries.GetASTNodeSourceRegion" .It defines the code to retrieve the SourceRegion from a ASTNode java element.
Regards,
Fabien.
----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
rue Nina Simone
44000 NANTES
----------------------------------------------------
|
|
|
Powered by
FUDForum. Page generated in 0.03816 seconds