/*******************************************************************************
* Copyright (c) 2009 the CHISEL group and contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* the CHISEL group - initial API and implementation
*******************************************************************************/
package ca.uvic.chisel.javasketch.launching.internal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
/**
* Extension to the JavaArumentsTab which just adds the -Xshare:off argument
* to the virtual machine arguments list.
* @author Del
*
*/
public class TraceArgumentsTab extends JavaArgumentsTab {
/* (non-Javadoc)
* @see org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
*/
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
super.setDefaults(config);
String vmargs;
try {
vmargs = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "");
if (!vmargs.contains("-Xshare:off")) {
vmargs = "-Xshare:off " + vmargs;
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmargs);
}
} catch (CoreException e) {
//ignore
}
}
}