Question

I have installed Eclipse Escripts plugin, but it does not seem to have proper documentation and I am very new to Eclipse JDT API.

I am trying to write a script which can run Server and several Clients with just one click using Escripts. Server and Client are Run Configuration what I have in Eclipse.

This an example of a script which can open a new project wizard

<?xml version="1.0"?>
<escript>
 <action id="org.eclipse.jdt.ui.actions.OpenProjectWizard">
  <dialog title="New Java Project">
   <!-- Enter the project name in the dialog and finish the wizard: -->
   <enter text="Escripts Examples - Java Project"/>
   <click button="Finish"/>
  </dialog>
 </action>
</escript>

So my guess is that I need to change action to something like org.eclipse.jdt.launching and specify run configuration inside inner XML-tags. I have found this page for JDT, but cannot find proper action to Run a project.

Any one can help me to come up with script which can run existing Run Configuration?

Was it helpful?

Solution

Instead of searching into JDT documentation, just open the Escripts view:

Windows
  > Show View
    > Other...
      > Escripts
        > Escripts Elements (drag and drop to a script file)

You will see there all the available actions, commands and wizards.

Create a empty .escript file, select an item in the Escripts view, and just drag and drop it to the .escript file.

There are a lot of options, but I have found that the "Run Configurations" dialog can be opened with the following command:

<command id="org.eclipse.debug.ui.commands.OpenRunConfigurations">
</command>

But the projects can also be launched as follow without opening the dialog:

<command id="org.eclipse.jdt.debug.ui.localJavaShortcut.run">
  <selection>
    <resource name="<project>/src/<package>/Server.java"/>
  </selection>
</command>

<command id="org.eclipse.jdt.debug.ui.localJavaShortcut.run">
  <selection>
    <resource name="<project>/src/<package>/Client.java"/>
  </selection>
</command>

Be sure to take a look at the XML schema escript.xsd inside net.sf.escripts_<version>.jar (current 1.0.1.r85).

By the way, people installing this plugin from http://escripts.sf.net/updates must uncheck the "Group items by category" checkbox in the Eclipse install wizard to avoid the "There are no categorized items" (as "Details" section message of the wizard says).

OTHER TIPS

Juan is right on track! The Escripts Elements view will give you an overview of all available commands, actions, and wizards that Escripts can drive.

There is an action with the ID org.eclipse.debug.internal.ui.actions.RunDropDownAction that seems to correspond to clicking a run configuration in the drop-down menu. You would have to do some more research if and how you can provide the name of the launch configuration that you want to run.

For general help, you can find some example files at http://escripts.svn.sourceforge.net/viewvc/escripts/trunk/net.sf.escripts.tests/src/net/sf/escripts/tests/

I no longer actively maintain Escripts, but I'm happy to make small fixes or add you as a contributor to the SourceForge project. Escripts has some pretty persistent problems with threading and race conditions, so it works well for certain tasks but is not really a universal scripting solution. I think there is some other scripting effort going on on eclipse.org, but I don't know what the current status of that effort is.

HTH,

Mirko

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top