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?


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;

                        // Save all editors first
                        ICommandService service = (ICommandService) getSite().getService(ICommandService.class);
                        console.writeln("service is " + service.toString());
                catch (CoreException e) {
                        // TODO Auto-generated catch block
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]