Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

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 Go to previous messageGo to next message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
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 #664160 is a reply to message #664140] Thu, 07 April 2011 16:38 Go to previous messageGo to next message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
Do you mean the -clean command line option?
Re: "Clear workspace" action [message #664273 is a reply to message #664149] Fri, 08 April 2011 08:24 Go to previous messageGo to next message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

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 #664274 is a reply to message #664160] Fri, 08 April 2011 08:26 Go to previous messageGo to next message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Hi Felix,

I used yet the "-clean" command line option, but it doesn't do the job I need.

Thanks anyway, bye

Giovanni
Re: "Clear workspace" action [message #664311 is a reply to message #664273] Fri, 08 April 2011 11:02 Go to previous messageGo to next message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
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
Re: "Clear workspace" action [message #664339 is a reply to message #664140] Fri, 08 April 2011 12:22 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/07/2011 11:38 AM, Giovanni De Sossi wrote:
> 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?

That's done as part of your main eclipse's Debug ... it's little more
than an "rm -rf /path/to/runtime/workspace" done before launching.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:Problem keeping workspace while migrating eclipse installs if plugins installed
Next Topic:Shortcut Events
Goto Forum:
  


Current Time: Thu Apr 25 14:36:07 GMT 2024

Powered by FUDForum. Page generated in 0.03746 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top