01: /*******************************************************************************
02: * Copyright (c) 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 org.eclipse.core.runtime.CoreException;
13: import org.eclipse.debug.core.ILaunchConfiguration;
14: import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
15: import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
16: import org.eclipse.pde.internal.ui.IPDEUIConstants;
17:
18: public class OSGiMigrationDelegate extends PDEMigrationDelegate {
19:
20: public boolean isCandidate(ILaunchConfiguration candidate)
21: throws CoreException {
22: return super .isCandidate(candidate)
23: || !candidate
24: .getAttribute(
25: IPDEUIConstants.LAUNCHER_PDE_VERSION,
26: "").equals("3.3"); //$NON-NLS-1$ //$NON-NLS-2$
27: }
28:
29: public void migrate(ILaunchConfigurationWorkingCopy wc)
30: throws CoreException {
31: if (!wc
32: .getAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION, "").equals("3.3")) { //$NON-NLS-1$ //$NON-NLS-2$
33: wc
34: .setAttribute(IPDEUIConstants.LAUNCHER_PDE_VERSION,
35: "3.3"); //$NON-NLS-1$
36: StringBuffer vmArgs = new StringBuffer(
37: wc
38: .getAttribute(
39: IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
40: "")); //$NON-NLS-1$
41: if (vmArgs.indexOf("-Declipse.ignoreApp") == -1) { //$NON-NLS-1$
42: if (vmArgs.length() > 0)
43: vmArgs.append(" "); //$NON-NLS-1$
44: vmArgs.append("-Declipse.ignoreApp=true"); //$NON-NLS-1$
45: }
46: if (vmArgs.indexOf("-Dosgi.noShutdown") == -1) { //$NON-NLS-1$
47: vmArgs.append(" -Dosgi.noShutdown=true"); //$NON-NLS-1$
48: }
49: wc
50: .setAttribute(
51: IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
52: vmArgs.toString());
53: }
54: super.migrate(wc);
55: }
56:
57: }
|