This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DSS javascript dialog box

Hi all,

Is it possible to create a "save file dialog box" in the dss javascript in code composer studio v 6.1.0.00104 ? I am trying to create a script that will save a memory location to a binary file when you push a button (which I achieved by placing the script in the hotmenu: Scripts -> myScript). I got that much to work, but it would be nice to prompt the user first for the location of the file to be saved (so it can be run multiple times without always just overwritting the same hardcoded filename). I should mention the motivation for a script as opposed to using the CCS built in "save memory" function is because the number of words for the variable is large and cumbersome to calculate. I tend to forget things and don't want to have to go back and find out this magic number each time I want to save memory. So I'm basically trying to reinvent the "save memory" dialog with the start address and words hard coded.

I have seen references here that "most" java API calls are supported (specifically File I/O), but java implements open file dialog boxes with java.swing.JFileChooser instead of the java.io package. I can't get this swing package to work.

importPackage(Packages.com.ti.debug.engine.scripting);
importPackage(Packages.com.ti.ccstudio.scripting.environment);
importPackage(java.io);
importPackage(java.lang);
importPackage(java.swing.JFileChooser);

var temp = new JFileChooser();
temp.showOpenDialog();

In the above code snippet I see the program fails on the line 

var temp = new JFileChooser();

with the error --  ReferenceError: "JFileChooser" is not defined.

Thanks for any help!

  • I am not surprised that swing API does not work with Code Composer.

    Code Composer is an Eclipse product and the GUI framework in it is SWT.

    May be you can try using SWT related classes instead. 

    Keep in mind that it also may not work, since the javascript engine within the Java application may have limitations on its own. 

    Even if it works, it is not supported. 

    Regards

    Dobrin