Issue 10022 - cannot execute script saved to a file
Summary: cannot execute script saved to a file
Status: CLOSED FIXED
Alias: None
Product: General
Classification: Code
Component: scripting (show other issues)
Version: 643C
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: noel.power
QA Contact: issues@framework
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-12 14:47 UTC by robert.kinsella
Modified: 2003-02-24 15:55 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description robert.kinsella 2002-12-12 14:47:59 UTC
OpenOffice.org 643C, Srcipting framework early developer release, version 0.1.

This bug is described in two parts, firt user deploys a script to the user
application area, creates a binding and then removes the script. The user then
deploys a new script with the same name as the original to a document, the
previouslky created key binding should cause the script deployed to the document
to execute.

Part 1. 
1. Start jedit
     Browse to Utilities>Global Options...
     Browse in the Global Options dialog box to the Proxy Servers.
     Check "Use HTTP proxy Servers" and set all information needed for jEdit to
access the web.
     Click on OK. 

     2. Browse to Plugins->Plugin Manager...
     Click on Install Plugins (If you get errors then your Proxy is not well
setup)
     Then you get a list of plugins.
     The plugins needed for Scripting IDE are AntFarm and Console.
     So just select them if you cant find them on the list then you have them
already installed.
     Click on install
     Just to make sure you have the latest AntFarm and Console click on Update
Plugins
     Click on Close.
     Exit jEdit.

     4. Start jEdit again.
     Browse to Utilities>Global Options...
     Select Plugins->Office Scripting
     Select the Path of your Office installation.
     Ensue you select Apply , select OK.

     5. Select Plugins->AntFarm->Build Options
     Select Run Ant Targets in the same JVM.

     6. Browse to Utilities>Global Options...
     Select Docking
     Activity Log docking position: bottom
     Ant Farm docking position: right
     Console docking position: bottom
     Error List docking position: bottom
     File System Browser docking position: left
     Office Scripting docking position: right
     Click on Apply, click onOK.

     7. Click on the Office Scripting button on the right of the frame.
     Right click on all parcels.
     Select New
     Enter the name of the new parcel e.g. HelloJedit.
     Select a directory where you want the parcel to be built .

     8. In the left hand frame the HelloJedit script is opened you need to add
the following lines to the top of the script
     immediately after the first import statement

     import com.sun.star.uno.UnoRuntime;
     import com.sun.star.frame.XModel;
     import com.sun.star.text.*;


     9. Add the following lines within the public class HelloJedit class.

     XModel model = xSc.getDocument();
      XTextDocument textdoc = (XTextDocument)
                 UnoRuntime.queryInterface(XTextDocument.class, model);
      XText oText = textdoc.getText();
      XTextCursor oCursor = oText.createTextCursor();
      oText.insertString(oCursor, "Hello jEdit", false);


     10. Right click on  'HelloJedit' and select ScriptCompile.
     After complation has successfully completed, right click on 'HelloJedit'
and select Build Parcel SXP.
     In the scripting framework dialog that appears select all methods in the
left frame and add to scripts (right frame).
     Select Finish.

     11. Right click on the HelloJedit.sxp parcel and select Deploy to
OpenOffice.org.
     Check that the scripts have been deployed to
<office_installation>/user/Scripts/java.

     12. Assign an event  to execute the script.
     -Start OpenOffice.org  writer document.
     - Select Tools, Assign Script(java) To, Menu.
     -In the popup dialog,
          in the select script function select a script e.g. HelloJedit.doMethod
         Select File in the Top Level menu drop down list.
         In the New Menu, enter a menu item name e.g. HelloJedit.
         Select New Script Menu, select ok.
     - Select OK when prompted to restart OpenOffice.org. Exit and restart
OpenOffice.org writer document.
     - Select File, HelloJedit - Hello jEdit should be inserted into the
document.


Part 2.

     Delete directory <office-install>/user/Scripts/java/HelloJedit.
     OpenOffice.org is not running.
     A previously created OpenOffice.org writer document, e.g. TestBindjE.sxw


     1. Start Jedit
     Click on the HelloJedit.java file listed under All Parcels, HelloJedit.
     Change the text in the hellojedit.java file from "Hello jEdit"  to "Hello
jEdit 3---".
     Select File Save.

     2. Right click on hellojedit and select Script Compile.
     After complation has successfully completed, right click on 'HelloJedit'
and select Build Parcel SXP.
     Select Finish.

     3. Right click on the HelloJedit.sxp parcel and select Deploy to Document.

     4. Check that the script has been successfully deployed to the document by
running unzip -l  TestBindjE.sxw. (Unix) 
     or pkunzip -v  TestBindjE.sxw (Windows). You should see the script saved in
the document.

     5. Launch OpenOffice.org, note the previously assigned bindings as setup in
part 1 still apply to the TestBindjE.sxw 
     document. Open the TestBindjE.sxw document.

     6. Select File HelloJedit - "Hello jEdit  3--- "should be inserted into the
document.
Comment 1 robert.kinsella 2002-12-12 15:48:49 UTC
Step 6 does not execute, i.e. HellojEdit 3--- does not get inserted to
the document.
Comment 2 tomaisoc 2003-01-09 16:54:03 UTC
Reassigning to John to find appropriate owner.
Comment 3 Unknown 2003-01-10 08:52:26 UTC
Reassign to Noel to be fixed.

Issue is problem with IDE's adding "." in CLASSPATH when saving out
parceldescriptor.xml.
On loading script the framework works fine when loading from file, but
ucb has a problem with the "." in the CLASSPATH and this stops correct
loading of script. IDE's should not be adding "." and the SF should be
eating the "." before making the ucb query.
Comment 4 noel.power 2003-01-29 17:45:18 UTC
Additional code added to new class PathUtils.java which processes ./
and ../ entries in path. 
Comment 5 robert.kinsella 2003-02-24 15:55:50 UTC
SFrameworkInstall.jar.02.21.2003 option added for assign to scripts
within document. However the functioanlity of this option does not
work as specified in 11726. closing issue.