01: /*******************************************************************************
02: * Copyright (c) 2005, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.launcher;
11:
12: import java.io.File;
13:
14: import org.eclipse.debug.core.DebugPlugin;
15: import org.eclipse.debug.core.ILaunchConfiguration;
16: import org.eclipse.debug.core.ILaunchConfigurationListener;
17: import org.eclipse.pde.internal.core.util.CoreUtility;
18:
19: public class LaunchConfigurationListener implements
20: ILaunchConfigurationListener {
21:
22: /* (non-Javadoc)
23: * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
24: */
25: public void launchConfigurationAdded(
26: ILaunchConfiguration configuration) {
27: }
28:
29: /* (non-Javadoc)
30: * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationChanged(org.eclipse.debug.core.ILaunchConfiguration)
31: */
32: public void launchConfigurationChanged(
33: ILaunchConfiguration configuration) {
34: }
35:
36: /* (non-Javadoc)
37: * @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationRemoved(org.eclipse.debug.core.ILaunchConfiguration)
38: */
39: public void launchConfigurationRemoved(
40: ILaunchConfiguration configuration) {
41: File configDir = LaunchConfigurationHelper
42: .getConfigurationLocation(configuration);
43: if (configDir.exists()) {
44: // rename the config area if it was auto-set by PDE when the launch configuration is renamed
45: ILaunchConfiguration destination = DebugPlugin.getDefault()
46: .getLaunchManager().getMovedTo(configuration);
47: boolean delete = true;
48: if (destination != null) {
49: delete = !configDir.renameTo(LaunchConfigurationHelper
50: .getConfigurationLocation(destination));
51: }
52: if (delete)
53: CoreUtility.deleteContent(configDir);
54: }
55: }
56:
57: }
|