http://tinyos.stanford.edu/tinyos-wiki/api.php?action=feedcontributions&user=22&feedformat=atomTinyOS Wiki - User contributions [en]2024-03-29T04:50:48ZUser contributionsMediaWiki 1.31.14http://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1573NESCDT- An editor for nesC in Eclipse2008-07-21T09:52:00Z<p>Rasped: /* Installing */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a an identifier). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.22''': <br />
**Either download the ''nescdt_0.0.22.jar'' file [[http://nxtmote.sf.net/nescdtupdate/plugins/nescdt_0.0.22.jar here]], <br />
**or use the update site url [http://nxtmote.sf.net/nescdtupdate http://nxtmote.sf.net/nescdtupdate] in the Eclipse update manager.<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
[[Image:0-plugin-details.png]]<br />
<br />
===Using the Plugin===<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes) by the nesC scanner); externally it's project folder is decorated with a ''nC'' icon. Your new empty ''nescdt'' project looks something like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
*When an interface name is types and the . character is typed, then a list of interface functions is suggested.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that you maintain this fork of the plugin):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1572NESCDT- An editor for nesC in Eclipse2008-07-21T09:51:42Z<p>Rasped: /* Installing */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a an identifier). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.22''': <br />
**Either download the ''nescdt_0.0.22.jar'' file [[http://nxtmote.sf.net/nescdtupdate/plugins/nescdt_0.0.22.jar here]], <br />
**or use the update site url [[http://nxtmote.sf.net/nescdtupdate http://nxtmote.sf.net/nescdtupdate]] in the Eclipse update manager.<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
[[Image:0-plugin-details.png]]<br />
<br />
===Using the Plugin===<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes) by the nesC scanner); externally it's project folder is decorated with a ''nC'' icon. Your new empty ''nescdt'' project looks something like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
*When an interface name is types and the . character is typed, then a list of interface functions is suggested.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that you maintain this fork of the plugin):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1571NESCDT- An editor for nesC in Eclipse2008-07-21T09:51:14Z<p>Rasped: /* Installing */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a an identifier). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.22''': <br />
**Either download the ''nescdt_0.0.22.jar'' file [[http://nxtmote.sf.net/nescdtupdate/plugins/nescdt_0.0.20.jar here]], <br />
**or use the update site url [[http://nxtmote.sf.net/nescdtupdate http://nxtmote.sf.net/nescdtupdate]] in the Eclipse update manager.<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
[[Image:0-plugin-details.png]]<br />
<br />
===Using the Plugin===<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes) by the nesC scanner); externally it's project folder is decorated with a ''nC'' icon. Your new empty ''nescdt'' project looks something like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
*When an interface name is types and the . character is typed, then a list of interface functions is suggested.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that you maintain this fork of the plugin):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1570NESCDT- An editor for nesC in Eclipse2008-07-21T09:22:40Z<p>Rasped: /* Using the Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a an identifier). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.20''': First download the ''nescdt_0.0.20.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.20.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
[[Image:0-plugin-details.png]]<br />
<br />
===Using the Plugin===<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes) by the nesC scanner); externally it's project folder is decorated with a ''nC'' icon. Your new empty ''nescdt'' project looks something like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
*When an interface name is types and the . character is typed, then a list of interface functions is suggested.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that you maintain this fork of the plugin):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1353NESCDT- An editor for nesC in Eclipse2008-06-27T12:00:32Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a an identifier). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.20''': First download the ''nescdt_0.0.20.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.20.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
[[Image:0-plugin-details.png]]<br />
<br />
===Using the Plugin===<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
*When an interface name is types and the . character is typed, then a list of interface functions is suggested.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that you maintain this fork of the plugin):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1352NESCDT- An editor for nesC in Eclipse2008-06-27T11:52:54Z<p>Rasped: /* Using the Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a an identifier). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.19''': First download the ''nescdt_0.0.19.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.19.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
[[Image:0-plugin-details.png]]<br />
<br />
===Using the Plugin===<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
*When an interface name is types and the . character is typed, then a list of interface functions is suggested.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that you maintain this fork of the plugin):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=File:6-Dev-start-export.png&diff=1351File:6-Dev-start-export.png2008-06-27T11:50:14Z<p>Rasped: uploaded a new version of "Image:6-Dev-start-export.png"</p>
<hr />
<div></div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1350NESCDT- An editor for nesC in Eclipse2008-06-27T11:48:51Z<p>Rasped: /* Installing */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a an identifier). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.19''': First download the ''nescdt_0.0.19.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.19.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
[[Image:0-plugin-details.png]]<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
*When an interface name is types and the . character is typed, then a list of interface functions is suggested.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that you maintain this fork of the plugin):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=File:0-plugin-details.png&diff=1349File:0-plugin-details.png2008-06-27T11:46:49Z<p>Rasped: </p>
<hr />
<div></div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1348NESCDT- An editor for nesC in Eclipse2008-06-27T11:43:16Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a an identifier). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.19''': First download the ''nescdt_0.0.19.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.19.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
*When an interface name is types and the . character is typed, then a list of interface functions is suggested.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that you maintain this fork of the plugin):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1347NESCDT- An editor for nesC in Eclipse2008-06-27T07:08:06Z<p>Rasped: /* Debugging */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that you maintain this fork of the plugin):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1346NESCDT- An editor for nesC in Eclipse2008-06-27T07:06:54Z<p>Rasped: /* Debugging */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard''. (Consider changing the provider entry to indicate that the new version is maintained by you.):<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1345NESCDT- An editor for nesC in Eclipse2008-06-27T07:06:07Z<p>Rasped: /* Exporting */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin:<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1344NESCDT- An editor for nesC in Eclipse2008-06-27T07:05:40Z<p>Rasped: /* Exporting */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and increment the version number of the new plugin. You can also change that the provider entry to indicate that the new version is maintained by you :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1343NESCDT- An editor for nesC in Eclipse2008-06-27T07:01:55Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other words found when then plugin scanned the ''.nc'' files in the linked folders. Press ''CTRL + SPACE'' to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1342NESCDT- An editor for nesC in Eclipse2008-06-25T12:42:17Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
Windows XP:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
<br />
Xubuntos:<br />
<br />
[[Image:Nescdt-at-a-glance-xubuntos.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=File:Nescdt-at-a-glance-xubuntos.png&diff=1341File:Nescdt-at-a-glance-xubuntos.png2008-06-25T12:40:05Z<p>Rasped: </p>
<hr />
<div></div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1340NESCDT- An editor for nesC in Eclipse2008-06-25T11:39:27Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [[Running_a_XubunTOS_Virtual_Machine_Image_in_VMware_Player|Xubuntos distro]]) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1339NESCDT- An editor for nesC in Eclipse2008-06-25T11:35:52Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''/opt/eclipse/plugins'' on a Linux machine (like the [test] Xubuntos distro) or ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1338NESCDT- An editor for nesC in Eclipse2008-06-25T07:29:16Z<p>Rasped: /* Importing the Plugin into Eclipse for Development */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace named ''workspace-plugintest'' (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugintest<br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1337NESCDT- An editor for nesC in Eclipse2008-06-25T07:28:29Z<p>Rasped: /* Extending and Customizing the Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for ''.nc'' files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1336NESCDT- An editor for nesC in Eclipse2008-06-25T07:28:18Z<p>Rasped: /* Extending and Customizing the Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change the keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java''). A keyword is for example ''module'' which is colored purple in the editor<br />
*Control which words (in addition to the keywords) are included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1335NESCDT- An editor for nesC in Eclipse2008-06-25T07:26:50Z<p>Rasped: /* Side notes */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse's is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1334NESCDT- An editor for nesC in Eclipse2008-06-25T07:24:41Z<p>Rasped: /* Using the Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). Your new empty ''nescdt'' project looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1333NESCDT- An editor for nesC in Eclipse2008-06-25T07:23:46Z<p>Rasped: /* Using the Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked (internally) as an ''nesC'' project (it later serves to determine which projects in the Eclipse workspace are scanned (for auto-completion purposes)). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1332NESCDT- An editor for nesC in Eclipse2008-06-25T07:22:09Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.17''': First download the ''nescdt_0.0.17.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.17.jar here]]<br />
* Then save it in the Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be ''c:\eclipse\plugins'' on a Windows machine<br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1328NESCDT- An editor for nesC in Eclipse2008-06-24T13:34:42Z<p>Rasped: /* Extending and Customizing the Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt'' plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1327NESCDT- An editor for nesC in Eclipse2008-06-24T13:34:29Z<p>Rasped: /* Developing/Debugging on the NESCDT Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be working in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1326NESCDT- An editor for nesC in Eclipse2008-06-24T13:33:36Z<p>Rasped: /* Side notes */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
*The ''nescdt'' plugin is < 100 kB<br />
*(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
*If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
*I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
*You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1325NESCDT- An editor for nesC in Eclipse2008-06-24T13:33:04Z<p>Rasped: /* Side notes */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 100 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1324NESCDT- An editor for nesC in Eclipse2008-06-24T13:32:22Z<p>Rasped: /* Extending and customizing the Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
===Extending and Customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1323NESCDT- An editor for nesC in Eclipse2008-06-24T13:32:08Z<p>Rasped: /* Developing/Debugging on the NESCDT Plugin */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
===Extending and customizing the Plugin===<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1322NESCDT- An editor for nesC in Eclipse2008-06-24T13:31:11Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1321NESCDT- An editor for nesC in Eclipse2008-06-24T13:30:47Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new ''nescdt'' project in Eclipse and link those folders from your TinyOS installation and your application trees that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today. Here it is:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1320NESCDT- An editor for nesC in Eclipse2008-06-24T13:28:37Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. when a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today. Here it is:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1319NESCDT- An editor for nesC in Eclipse2008-06-24T13:28:24Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. hwen a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today. Here it is:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.16''': First download the ''nescdt_0.0.16.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.16.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1317NESCDT- An editor for nesC in Eclipse2008-06-24T13:20:23Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. hwen a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today. Here it is:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.15''': First download the ''nescdt_0.0.15.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.15.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT&diff=1316NESCDT2008-06-24T13:13:56Z<p>Rasped: Replacing page with 'Link: NESCDT- An editor for nesC in Eclipse'</p>
<hr />
<div>Link: [[NESCDT- An editor for nesC in Eclipse]]</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=TinyOS_Documentation_Wiki&diff=1315TinyOS Documentation Wiki2008-06-24T13:12:40Z<p>Rasped: /* Various TinyOS Tools */</p>
<hr />
<div>This is the new Wiki site for the TinyOS Documentation Working Group.<br />
Everyone is welcome to edit these pages and contribute TinyOS documentation.<br><br />
In order to edit, you must first create an account, using the link on the upper right ('''Login / create account''').<br><br />
Consult the [http://meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software.<br><br />
<br><br />
= TinyOS Documentation Index =<br />
'''Purpose of this Wiki Site:''' This site is part of a new effort (as of October 2007) to establish a single, common site for all TinyOS Documentation, akin to the Linux Documentation Project (but for TinyOS, of course). Right now, TinyOS documentation is scattered across many sites and is often poorly maintained. We hope that by using a Wiki - and making the site fairly open to edits from anyone - that it will be possible to create and ''maintain'' TinyOS documentation over a longer period of time. Click [[Special:Allpages| here]] to see an index of all the available pages.<br />
<br />
So, you are encouraged to contribute documentation to this site simply by editing this page and adding a link to a new (empty) page. Come back and click on that link and start creating content for the new page. Don't worry too much about organization right now, since we can re-organize things later on if need be. If you are not familiar with the Wiki system, consult the [http://meta.wikimedia.org/wiki/Help:Contents User's Guide].<br />
<br />
We prefer all documentation to live on this site, rather than having links to external sites, but external links are OK too.<br />
<br />
== TinyOS Search Engine ==<br />
Using Google's custom search features, a search engine dedicated to TinyOS has been created. The advantage of using this search engine instead of a normal web search is that only specific sites are indexed. This means that any search results are highly relevant to TinyOS, and your search terms can be very general. For example, if you need help on installing TinyOS in Ubuntu, just search "Ubuntu" in the custom search engine and it will only return links to pages containing the word "Ubuntu" on known TinyOS sites.<br />
<br />
[http://www.google.com/coop/cse?cx=000490616372089452102%3Ajdf9nzpy7se Click here for the TinyOS Custom Search Engine]<br />
<br />
== Installing TinyOS ==<br />
<br />
* [[Windows_Installation| Linux / Windows]]<br />
** [[java_cygwin | Common Java problems on Cygwin]]<br />
** [http://www.isis.vanderbilt.edu/projects/NEST/tinyos-2.x-iris/doc/html/install-tinyos-iris.html Updating external tools to support the IRIS mote]<br />
* [http://gentoo-wiki.com/TinyOS Installing TinyOS on Gentoo]<br />
* [http://www.5secondfuse.com/tinyos/install.html Installing TinyOS on Ubuntu] [http://hi.baidu.com/vvfang/blog/item/e2dfa4126bd9adcdc3fd789c.html Chinese Version]<br />
* [http://toilers.mines.edu/Public/XubunTOS Installing TinyOS on XubunTOS]<br />
* [[Installing a XubunTOS Virtual Machine on VMWare Server]]<br />
* [[Running a XubunTOS Virtual Machine Image in VMware Player]]<br />
* [[Installing tinyos-2.x on Mac OS X (Tiger & Leopard) | Installing TinyOS on Mac OS (Tiger & Leopard)]]<br />
<br />
== Programming Tutorials ==<br />
<br />
* [[TinyOS_Tutorials|Tutorials on Getting Started with TinyOS Programming]]<br />
* [[Boomerang|Boomerang and Tmote Resources from Moteiv]]<br />
* [http://www.tinyos.net/tinyos-2.x/doc/pdf/tinyos-programming.pdf TinyOS Programming Manual]<br />
* [[TUnit|TUnit TinyOS Unit Testing]]<br />
* [[OpenOCD for IMote2 | Programming IMote2 with OpenOCD]]<br />
<br />
== Hardware Platforms ==<br />
<br />
* [[TMote Sky|TMote Sky, a.k.a. Telos Rev B]]<br />
* [[Kmote|Kmote, a.k.a. Telos Rev B]]<br />
* [[MicaZ]]<br />
* [[Mica2]]<br />
* [[Mica2dot]]<br />
* [[NXTMOTE|NXTMOTE - TinyOS on LEGO MINDSTORMS NXT]]<br />
* [[Intel SHIMMER]]<br />
* [[Imote2]]<br />
<br />
== Software Libraries and Drivers ==<br />
<br />
* [[CC2420|CC2420 Radio Stack]]<br />
* [[CC1100/CC2500|CC1100/CC2500 Radio Stack]]<br />
<br />
== Sensorboards ==<br />
<br />
* [[MTS420|MTS420 Sensorboard: Mica Family of Motes]]<br />
<br />
== Various TinyOS Tools ==<br />
* [[NESCDT- An editor for nesC in Eclipse]]<br />
<br />
== Other Documents ==<br />
* [[Contributing Code to TinyOS]]<br />
* [[TinyOS 2.x index of contributed code]]<br />
* [[TinyOS TODO List]]<br />
* [[Frequently Asked Questions (FAQs)| Frequently Asked Questions (FAQs)]]<br />
* [[Wishlist: Ports from TinyOS-1.x to TinyOS-2.x | Wishlist: Ports from TinyOS-1.x to TinyOS-2.x]]<br />
* [http://www.cs.utah.edu/~regehr/tos_avrora.html Using TinyOS with the Avrora Simulator]<br />
* [http://www.cs.utah.edu/~regehr/debugging_tinyos/ TinyOS Debugging Tutorial]<br />
* [http://homepages.dcc.ufmg.br/~bpires/tutorials/tutorial/ Tutorial on setting up a complete TinyOS 2.x Network]<br />
* [http://homepages.dcc.ufmg.br/~bpires/tutorials/manuals/ Some Datasheets]<br />
* [http://homepages.dcc.ufmg.br/~bpires/tutorials/dossie Tutorial in Portuguese]<br />
* [http://hi.baidu.com/vvfang/blog/category/Tinyos%20Related Study Notes in Chinese]<br />
* [http://tinyos.cvs.sourceforge.net/*checkout*/tinyos/tinyos-2.x/doc/html/tep131.html Creating a New Platform for TinyOS 2.x]<br />
* [http://www.btnode.ethz.ch/Projects/SensorNetworkMuseum Nice summarization and overview of various sensor network platforms and related components]<br />
<br />
== Documents that need to be written ==<br />
<br />
Please feel free to add additional topics or create pages for each of the topics below.<br />
* Platforms<br />
**Overview of commonly used platforms with software porting/compatibility issues<br />
* Sensors<br />
** Sensor boards<br />
** Which TinyOS modules to use for which sensor<br />
** How to convert the raw sensor values to commonly used formats<br />
* RSSI / LQI<br />
** How to obtain RSSI / LQI values for a received packet<br />
** How to measure RSSI values without receiving a packet (measuring noise)<br />
** Relationship between RSSI / LQI values and physical distance<br />
* TX power<br />
** How to reduce the TX power<br />
*** For all transmissions<br />
*** On a per-packet basis<br />
* How to debug the programmer<br />
** For Mica-based motes, how to ensure they are properly plugged in<br />
** For network based programmers, how to verify the communication<br />
** Common mistakes, common hardware errors<br />
* How to debug the serial communication<br />
** Which port to use for MIB520<br />
** How to configure network-based programmers<br />
* Case Studies (Example applications)<br />
* CVS CO & Update<br />
* Links or references to the TEP's<br />
<br />
= Meta-documentation for the Wiki site =<br />
<br />
* [http://www.mediawiki.org/wiki/Help:Configuration_settings Configuration settings list]<br />
* [http://www.mediawiki.org/wiki/Help:FAQ MediaWiki FAQ]<br />
* [http://mail.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list]</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT-_An_editor_for_nesC_in_Eclipse&diff=1314NESCDT- An editor for nesC in Eclipse2008-06-24T13:12:23Z<p>Rasped: New page: This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin. It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fun...</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. hwen a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today. Here it is:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.14''': First download the ''nescdt_0.0.14.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.14.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT&diff=1312NESCDT2008-06-24T13:10:57Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. hwen a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today. Here it is:<br />
<br />
[[Image:Nescdt-at-a-glance.png]]<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.14''': First download the ''nescdt_0.0.14.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.14.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=File:Nescdt-at-a-glance.png&diff=1311File:Nescdt-at-a-glance.png2008-06-24T13:10:24Z<p>Rasped: </p>
<hr />
<div></div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT&diff=1310NESCDT2008-06-24T13:01:53Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. hwen a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.14''': First download the ''nescdt_0.0.14.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.14.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty ''nescdt'' project <br />
<br />
[[Image:B1-new-nescdt-project.png]]<br />
<br />
[[Image:B2-new-nescdt-project.png]] <br />
<br />
and name it what you want to (for example ''nescdtsampleproject''). The default location is not important as we will use linked folders for the project. The project location just stores the eclipse specific project files. The project is marked as an ''nesC'' project (it later determines which projects in the Eclipse workspace is scanned for auto-completion purposes). It looks like this: <br />
<br />
[[Image:B3-decorated-project-folder.png]]<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=File:B3-decorated-project-folder.png&diff=1309File:B3-decorated-project-folder.png2008-06-24T12:54:08Z<p>Rasped: </p>
<hr />
<div></div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=File:B2-new-nescdt-project.png&diff=1308File:B2-new-nescdt-project.png2008-06-24T12:53:59Z<p>Rasped: </p>
<hr />
<div></div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=File:B1-new-nescdt-project.png&diff=1307File:B1-new-nescdt-project.png2008-06-24T12:53:48Z<p>Rasped: </p>
<hr />
<div></div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT&diff=1272NESCDT2008-06-22T10:16:25Z<p>Rasped: /* Contact */</p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. hwen a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.14''': First download the ''nescdt_0.0.14.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.14.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty project [[Image:Nxtmote-newproject.jpg]] and name it what you want to (for example ''nescsampleproject'')<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT&diff=1271NESCDT2008-06-22T10:15:26Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. hwen a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]] ''interface'',<br />
* [[Image:Mod.gif]] ''module'',<br />
* [[Image:Genmod.gif]] ''generic module'',<br />
* [[Image:Conf.gif]] ''configuration'', and<br />
* [[Image:Genconf.gif]] ''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.14''': First download the ''nescdt_0.0.14.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.14.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty project [[Image:Nxtmote-newproject.jpg]] and name it what you want to (for example ''nescsampleproject'')<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions for improvements: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT&diff=1270NESCDT2008-06-22T10:14:59Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. hwen a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* [[Image:Inter.gif]]: ''interface'',<br />
* [[Image:Mod.gif]]: ''module'',<br />
* [[Image:Genmod.gif]]: ''generic module'',<br />
* [[Image:Conf.gif]]'': configuration'', and<br />
* [[Image:Genconf.gif]]:''generic configuration'' <br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.14''': First download the ''nescdt_0.0.14.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.14.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty project [[Image:Nxtmote-newproject.jpg]] and name it what you want to (for example ''nescsampleproject'')<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions for improvements: rup.inf(at)cbs.dk</div>Raspedhttp://tinyos.stanford.edu/tinyos-wiki/index.php?title=NESCDT&diff=1269NESCDT2008-06-22T10:13:52Z<p>Rasped: </p>
<hr />
<div>This is a short description of how to ''use'' and ''develop'' the ''nescdt'' plugin.<br />
It is an editor for working with ''nesC'' code within Eclipse (as an alternative to other editors). Fundamentally, you just create a new project in Eclipse and link those folders from your TinyOS installation and your application tree that are needed. The plugin then scans the linked source code and uses this for auto-completion purposes (ie. hwen a user press CTRL + SPACE after having partially typed a word). Built-in keywords (which you can change (see Development section)) are used for syntax highlighting.<br />
The plugin ''does not touch'', nor does it compete with your build system: you still build your applications with ''make'' in whatever way you do it today.<br />
<br />
==Using the ''nescdt'' TinyOS plugin for Eclipse==<br />
A basic [http://nescc.sourceforge.net/papers/nesc-ref.pdf '''nesC'''] editor plugin for TinyOS-2.x using Eclipse with syntax highlighting and ''.nc'' file content detection for the follow types (the same symbols are used as in [[Getting_Started_with_TinyOS#Visualizing_a_Component_Graph| nesdoc]]):<br />
* ''interface'' [[Image:Inter.gif]],<br />
* ''module'' [[Image:Mod.gif]],<br />
* ''generic module'' [[Image:Genmod.gif]],<br />
* ''configuration'' [[Image:Conf.gif]],<br />
* ''generic configuration'' [[Image:Genconf.gif]]<br />
<br />
===Installing===<br />
The source is included in the plugin jar file, and it is possible to refine it (see the Development section). To install the plugin:<br />
* '''Version 0.0.14''': First download the ''nescdt_0.0.14.jar'' file [[http://nxtmote.sf.net/nescdt_0.0.14.jar here]]<br />
* Save it in the root of Eclipse plugin directory (where the other (jar) plugins also reside), and delete the previous version of this plugin if you have it. It would usually be c:\eclipse\plugins on a Windows machine. <br />
* Restart Eclipse (perhaps verify for yourself that it is installed: ''Help->About Eclipse SDK->Plug-in Details'')<br />
<br />
===Using the Plugin===<br />
* Associate the *.nc files with this editor: ''Windows->Preferences->General->Editors->File Associations'' <br />
[[Image:Nxtmote-fileassosi.png]]<br />
* Create a new empty project [[Image:Nxtmote-newproject.jpg]] and name it what you want to (for example ''nescsampleproject'')<br />
* Create a new folder in the project (right-click on the project) and name it what you want to<br />
* Import and link to the part of the TinyOS tree or your own code(right-click on the ''nescsampleproject'' folder and press import)<br />
[[Image:Nxtmote-folderlink.jpg]]<br />
* Choose the ''Link to folder in the file system'' option and proceed (this will not change your TinyOS code at all and it will not copy any files on your computer)<br />
*Repeat the steps above until you have linked all the folders you need for application development<br />
* When you are done the Eclipse IDE could look something like this (note that the content of the files have been analyzed and that the icons reveal that we have some configurations, generic configurations, modules, and generic modules in the ''mica2'' folder): <br />
[[Image:Nxtmote-editor.png]]<br />
*When you open some ''.nc'' file it will be syntax colored (according some some predefined rules in the plugin):<br />
[[Image:Nxtmote-editorsyntax2.png]]<br />
*There is auto-completion for keywords, types, and all other word found when then plugin scanned the .nc files in the linked folders. Press CTRL + SPACE to get the suggestions.<br />
<br />
[[Image:Nxtmote-keywordcompletion1a.png]]<br />
<br />
Then select a word and press ENTER to insert the word.<br />
<br />
[[Image:Nxtmote-keywordcompletion2.png]]<br />
<br />
=== Side notes ===<br />
**The ''nescdt'' plugin is < 50 kB<br />
**(Experimental) If it detects ''safe'' code (looking for ''@safe'', ''*COUNT'', ''*SIZE'', or ''*SAFE'') a rhombus shape is added to the icon. A ''safe'' module could look like this [[Image:Nxtmote-safedemo.png]] in the file navigator (note that a little rhombus has been added to the module icon).<br />
**If the CVS [http://www.eclipse.org/articles/Article-Decorators/decorators.html decorators] annoy you (if, for example, another CVS client than Eclipse is being used), then turn them off from ''Window->Preferences->General->Appearance->Label Decorations''. <br />
**I suggest the standard [[http://www.eclipse.org/legal/epl-v10.html Eclipse Public License]] for the source code as it makes it easy to re-use patterns from many other plugins<br />
**You can also consider downloading the CDT plugin for editing header files and perhaps ''C'' files in Eclipse. Enter the [http://download.eclipse.org/tools/cdt/releases/europa http://download.eclipse.org/tools/cdt/releases/europa] as a new ''Remote site'' in the Eclipse update manager and choose the CDT main plugin: <br />
[[Image:Nxtmote-cdtdownload.png]]<br />
<br />
==Developing/Debugging on the NESCDT Plugin==<br />
The last section was about using the plugin. To develop, customize, or debug the ''nescdt'' plugin, you can follow the guide below. In a best-case scenario it would be completed in 15-30 min.<br />
<br />
The immediate places for personal enhancement/customization of the ''nescdt''plugin are:<br />
*Change keywords coloring (go to ''INescColorConstants.java'')<br />
*Add or remove items in the keywords list (go to ''NescKeywords.java'')<br />
*Control which words included in the auto-completion scanner (go to the method ''parseLine'' in ''NescParser.java'')<br />
*Change the icons used for nc files and type visualization (go to the icons folder)<br />
<br />
<br />
===Importing the Plugin into Eclipse for Development===<br />
Here we start with a blank Eclipse workspace. You can get a new workspace (if you want to) by creating a shortcut and starting Eclipse with a command line similar to this:<br />
C:\eclipse\eclipse.exe -consolelog -data C:\Dokumenter\eclipse\workspace-plugin <br />
The '''consolelog''' makes it possible to see '''System.out.println''' from the plugin itself (it is cheating, but useful during development).<br />
<br />
[[Image:1-Dev-Blank-Eclipse.png]]<br />
<br />
Assuming that you have downloaded and installed the plugin (see start of this wiki page) it is now the time to import it into Eclipse for development. Press ''Import'':<br />
<br />
[[Image:2-Dev-Import.png]]<br />
<br />
Select ''Plug-ins and Fragments'':<br />
<br />
[[Image:3-Dev-pluginselect.png]]<br />
<br />
'''Important:''' Choose ''Projects with source folders'':<br />
<br />
[[Image:4-Dev-withsource.png]]<br />
<br />
Select the ''nescdt'' plugin in the version you happen to have:<br />
<br />
[[Image:5-Dev-select.png]]<br />
<br />
===Debugging===<br />
To show how easy it is to change it, look at the following example. It is code that splits the contents of a ''.nc'' file line into string tokens:<br />
<br />
[[Image:5a-Dev-coding-example.png]]<br />
<br />
Try to place a breakpoint by double-clicking on the bar to the left of the code that you want to inspect (see red arrow below). Then click on the menu to debug an ''Eclipse Application''. It is a second Eclipse instance that will be launched running the imported version of the plugin (not the plugin you downloaded into the ECLIPSEHOME/plugin folder. Eclipse automatically deactivates the permanent plugin in the launched debugging instance of Eclipe):<br />
<br />
[[Image:5b-Dev-debug-start.png]]<br />
<br />
It will then look like this when you have the two instances of Eclipse running. As a side-note you can see the completion processor has started to scan the .nc source code (red arrow):<br />
<br />
[[Image:5c-Dev-debug-ok.png]]<br />
<br />
To create a new version of the plugin please double click on the ''plugin.xml'' file in the project. Then select the ''Export Wizard'':<br />
<br />
[[Image:6-Dev-start-export.png]]<br />
<br />
Check the ''src'' folder for export when doing a binary build (so you export the source code with the plugin and makes it possible for others to do what you are doing now):<br />
<br />
[[Image:8-Dev-src-build.png]]<br />
<br />
===Exporting===<br />
Then export the plugin to the ECLIPSEHOME/plugin directory (it will run next time Eclipse is restarted). It is best to delete the old plugin file (such as ''nescdt_0.0.12.jar'') and change the increment the version number of the new plugin :<br />
<br />
[[Image:7-Dev-export.png]]<br />
<br />
Finally verify that the plugin jar file is in the plugin directory as expected:<br />
<br />
[[Image:9-Dev-plugin-eclipse-dir.png]]<br />
<br />
==Contact==<br />
If you have some light-weight suggestions for improvements: rup.inf(at)cbs.dk</div>Rasped