Home » Eclipse Projects » Eclipse Platform » "Clear workspace" action(How to replicate it in code?)
"Clear workspace" action [message #664140] |
Thu, 07 April 2011 15:38 |
|
Hi,
in my RCP app I need to replicate (at the application start) the "Clear workspace" setting which is in the Run Configuration tab, but I cannot find how: maybe I need a custom Launcher?
Thank you,
Giovanni.
|
|
|
Re: "Clear workspace" action [message #664149 is a reply to message #664140] |
Thu, 07 April 2011 16:05 |
|
Hi,
I am not sure whether you wanted to know that, how you can clear the workspace at the start of your rcp application manually or whether you wanted to know how you can clear the workspace.
Well, if you want to know, how you can clear the workspace at the Application Startup then, you can add the code to clear the workspace in the start() method of the Activator of you plugin.
If you wanted to know, how you can clear the workspace manually then, you can see the snippet below. This snippet is Eclipse's code to clear the workspace:-
protected void clear(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException {
String workspace = LaunchArgumentsHelper.getWorkspaceLocation(configuration);
// Clear workspace and prompt, if necessary
if (!LauncherUtils.clearWorkspace(configuration, workspace, monitor))
throw new CoreException(Status.CANCEL_STATUS);
// clear config area, if necessary
if (configuration.getAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA, false))
CoreUtility.deleteContent(getConfigDir(configuration));
}
Regards,
Animesh
Regards,
Animesh
|
|
| |
Re: "Clear workspace" action [message #664273 is a reply to message #664149] |
Fri, 08 April 2011 08:24 |
|
Hi Animesh,
thank you very much for your quick answer, that is exactly what I need. Now I need to know how to retrieve the current ILaunchConfiguration, this is the only step I missed; maybe you could point me to the internal class you mentioned in your answer?
Regards,
Giovanni
|
|
| |
Re: "Clear workspace" action [message #664311 is a reply to message #664273] |
Fri, 08 April 2011 11:02 |
|
Giovanni De Sossi wrote on Fri, 08 April 2011 13:54 | Hi Animesh,
thank you very much for your quick answer, that is exactly what I need. Now I need to know how to retrieve the current ILaunchConfiguration, this is the only step I missed; maybe you could point me to the internal class you mentioned in your answer?
Regards,
Giovanni
|
Hi,
I haven't really worked on this launch configuration stuff. But, i had found out a question on creating custom debugger on stackoverflow.com. It has a snippet to create the LaunchConfiguration. Here is the link to it:-
http://stackoverflow.com/questions/1857466/how-to-make-an-ec lipse-debug-launcher-that-launches-a-class
About the internal class, i was referring to, it is "JUnitLaunchConfigurationDelegate" . If you want to create your custom launch configuration delegate, you can extend "AbstractJavaLaunchConfigurationDelegate". Here is the link to the source code of the class "JUnitLaunchConfigurationDelegate" :-
http://www.devdaily.com/java/jwarehouse/eclipse/org.eclipse. pde.ui/src/org/eclipse/pde/ui/launcher/JUnitLaunchConfigurat ionDelegate.java.shtml
Regards,
Animesh
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 14:36:07 GMT 2024
Powered by FUDForum. Page generated in 0.03746 seconds
|