Hi Marc-André, 
  
git status core/org.eclipse.cdt.core.native 
On branch master 
Your branch is up-to-date with 'origin/master'. 
nothing to commit, working tree clean 
  
So it could be my env factor. 
  
We may leave the compilation error first if I can get all needed jars. I am not sure I understood Jonah completely correct but my understanding is that I can get all needed jars under <ecplise installation folder>/plugins. For example org.eclipse.cdt.core_5.2.1.201102110609.jar,
 org.eclipse.cdt.ui_5.2.2.201102110609.jar. 
  
Now I am trying to modify UMLet for my needs and it’s encouraging that (https://www.umlet.com/) it can support Ecplise. Your further suggestion are warmly welcome any time. 
  
Thanks for your time and effort. 
  
Sent from 
Mail for Windows 10 
  
 
 
From: cdt-dev-bounces@xxxxxxxxxxx <cdt-dev-bounces@xxxxxxxxxxx> on behalf of Marc-Andre Laperle <malaperle@xxxxxxxxx> 
Sent: Tuesday, November 12, 2019 12:59:16 PM 
To: CDT General developers list. <cdt-dev@xxxxxxxxxxx> 
Subject: Re: [cdt-dev] How to use CDT lib/java source
  
 
Hi, 
 
 
Some replies inline.
 
 
Hi Marc-André 
  
  
“Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:1.4.0:build-qualifier (default-build-qualifier) on project org.eclipse.cdt.core.native: Working tree is dirty. 
git status core/org.eclipse.cdt.core.native: 
  
Changes not staged for commit: 
modified:    core/org.eclipse.cdt.core.native/plugin.properties 
  
You are trying to use tycho-buildtimestamp-jgit on a directory that has uncommitted changes (see details above). 
Either commit all changes/add files to .gitignore, or enable fallback to default timestamp provider by configuring 
jgit.dirtyWorkingTree=warning for tycho-packaging-plugin” 
  
Although I did not touch the folder. 
 
 
 
 
 
You can try doing a 'git reset —hard' to make sure nothing is modified. 
Otherwise, I often build with this command: 
 
 
  mvn clean install -Dmaven.test.skip=true -Djgit.dirtyWorkingTree-cdtDefault=ignore 
 
 
It skips the tests and the dirty working tree check. 
The built jars will be in org.eclipse.cdt/releng/org.eclipse.cdt.repo/target/repository/plugins 
 
 
 
 
  
Is there anyway I can get a complete CDT jar file Eclipse? 
 
 
 
 
 
I don’t think there is such a single jar. Like Eclipse, CDT is made of several modules. The one you likely need from CDT is org.eclipse.cdt.core_$version$.jar. Then you’ll need all its dependencies, like org.eclipse.core.resources.jar, etc. If your UML
 tool is an Eclipse plugin, then you can add org.eclipse.cdt.core as a dependency and it will resolve the other dependencies. Otherwise, you'd have to put all the jars dependencies on the classpath manually…quite a daunting task. 
 
  
Following your kind suggestion, if I want to create my first ASTNode of main(), 
  
How to achieve the effect of “new  IASTFunctionDefinition()”. 
 ?    It seem new Function is not the way because IFunction is not IASTNode.  
  
  
ITranslationUnit tu = (ITranslationUnit) 
CDTUITools.getEditorInputCElement(editor.getEditorInput()); 
ITranslationUnit tu = (ITranslationUnit) 
CDTUITools.getEditorInputCElement(editor.getEditorInput()); 
- 
ITranslationUnit tu = (ITranslationUnit) CDTUITools.getEditorInputCElement(editor.getEditorInput());
 - 
ITranslationUnit tu= (ITranslationUnit) CoreModel.getDefault().create(file);
  
I don’t have (need) UI Editor, and assume I just start my UML tool, so neither a src file; so how to create a tu? BTW how many different ways to create tu? 
 
 
 
 
 
 
 
Probably one of these is your best bet: 
 
 
CoreModel.getDefault().createTranslationUnitFrom(ICProject cproject, IPath path) 
CoreModel.getDefault().createTranslationUnitFrom(ICProject cproject, URI locationURI) 
 
 
But as you see, this needs a ICproject. Is your UML tool running as a plugin part of Eclipse or not? If not, it will be quite a bit more difficult as you have to load everything necessary to create a workspace and projects outside the Eclipse
 runtime. I assume it’s possible with a lot of fiddling of many jars and startup boiler plate code but I don’t know for sure and it might be very difficult without good knowledge of how Eclipse works. So I hope your UML tool is running within Eclipse otherwise
 you might hit a dead end unless you are *very* motivated. 
 
 
It might be simpler to look into template engines such as  Freemarker which might be enough for your needs and way less setup and need of Eclipse knowledge.  
 
 
Marc-André 
 
 
 
 
  
Thanks. 
Sent from  Mail for Windows 10  
  
 
 
Hi Ming, 
 
 
 
 
I found this presentation about CDT refactoring, there are a few slides about creating AST nodes (node factory), ASTRewrite and generating changes that might useful to you: 
https://wiki.eclipse.org/images/b/be/PTPUserDev2012_Ruegg_Refactoring.pdf
 
 
About how to use this within your tool, it will depend a lot on how close your tool is to being an Eclipse plugin running in a workspace with a C/C++ project. If some of those conditions are not met, you will have a few more hurdles, like having
 to add all cdt.core dependencies on the classpath, figuring out if you can do AST writing on an external file (non-workspace), etc. 
 
 
Either way, it sounds like an interesting project and something that you could write about in a blog or developer FAQ if you do manage to get it working. 
 
 
Regards, 
Marc-André 
 
Hi The team, 
  
I want to develop C++ source code generator according to user’s diagram something like UML tool but very limited just for my needs. So my questions are: 
  
- 
Can I call CDT lib’s API to generate C++ class/functions?
 - 
What’s the ABC steps so I can follow them to merge the lib into my tool to see some very basic features?
  
  
Ming Cheng. 
Warm Regards 
  
  
Sent from  Mail for Windows 10  
  
 
_______________________________________________
cdt-dev
 mailing list
cdt-dev@xxxxxxxxxxx
To
 change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/cdt-dev 
 
 
 
 
 
_______________________________________________
cdt-dev
 mailing list
cdt-dev@xxxxxxxxxxx
To
 change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/cdt-dev 
 
 
 
 |