Executing Eclipse SaveAll command from beanshell

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Executing Eclipse SaveAll command from beanshell

J.D. Mullin
I have a beanshell script that is run inside Eclipse via Practically Macro. I need the script to run the File -> SaveAll command, but I'm having problems getting a reference to the ICommandService that Eclipse provides.

The service locator generally uses PlatformUI which doesn't seem accessible inside beanscript. I've also tried getSite() per the Eclipse Services help (http://tinyurl.com/c9o8a9g). It's unclear to me if I will be able to access these inside a beanscript.

I end up getting the error "Typed variable declaration : Command not found: getSite()" or "Attempt to resolve method: getWorkbench() on undefined variable or class name: PlatformUI"

Any pointers?

TIA,
J.D.

import org.eclipse.swt.custom.StyledText;
import org.eclipse.jface.text.IFindReplaceTarget;

import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.ui.commands.ICommandService;

                try
                {
                        // Save all editors first
                        ICommandService service = (ICommandService) getSite().getService(ICommandService.class);
                        console.writeln("service is " + service.toString());
                                       
                        <snip>
                       
                }
                catch (CoreException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
               
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users