?? motoroladevice.java
字號:
/**
* Copyright (c) 2003-2006 Craig Setera
* All Rights Reserved.
* Licensed under the Eclipse Public License - v 1.0
* For more information see http://www.eclipse.org/legal/epl-v10.html
*/
package eclipseme.toolkit.motorola.impl;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunchConfiguration;
import eclipseme.core.launching.ILaunchConstants;
import eclipseme.core.model.LaunchEnvironment;
import eclipseme.core.model.ReplaceableParametersProcessor;
import eclipseme.core.model.impl.AbstractDevice;
import eclipseme.core.persistence.IPersistenceProvider;
import eclipseme.core.persistence.PersistenceException;
/**
* Implementation of the IDevice interface for Motorola devices.
* <p />
* Copyright (c) 2003-2006 Craig Setera<br>
* All Rights Reserved.<br>
* Licensed under the Eclipse Public License - v 1.0<p/>
* <br>
* $Revision: 1.7 $
* <br>
* $Date: 2006/08/06 01:44:35 $
* <br>
* @author Craig Setera
*/
public class MotorolaDevice extends AbstractDevice {
private File propertiesFile;
/**
* @see eclipseme.core.model.device.IDevice#getLaunchCommand(eclipseme.core.model.LaunchEnvironment, org.eclipse.core.runtime.IProgressMonitor)
*/
public String getLaunchCommand(LaunchEnvironment launchEnvironment, IProgressMonitor monitor)
throws CoreException
{
// Fill in our properties so we can use them for resolution
// against the raw executable command line
Map executionProperties = new HashMap();
executionProperties.put("executable", executable);
executionProperties.put("device", getName());
executionProperties.put("devicePropsFile", propertiesFile);
// Debug information
if (launchEnvironment.isDebugLaunch()) {
executionProperties.put(
"debugPort",
new Integer(launchEnvironment.getDebugListenerPort()));
}
// Classpath
ILaunchConfiguration launchConfiguration =
launchEnvironment.getLaunchConfiguration();
boolean shouldDirectLaunchJAD = shouldDirectLaunchJAD(launchConfiguration);
if (!shouldDirectLaunchJAD) {
String classpathString =
getProjectClasspathString(launchEnvironment.getMidletSuite(), monitor);
executionProperties.put("classpath", classpathString);
}
// Add launch configuration values
addLaunchConfigurationValue(
executionProperties,
"verbose",
launchConfiguration,
ILaunchConstants.VERBOSITY_OPTIONS);
addLaunchConfigurationValue(
executionProperties,
"heapsize",
launchConfiguration,
ILaunchConstants.HEAP_SIZE);
if (shouldDirectLaunchJAD) {
executionProperties.put("jadfile", getSpecifiedJadURL(launchConfiguration));
} else if (!shouldDoOTA(launchConfiguration)) {
File jadFile = calculateJADFile(launchEnvironment.getMidletSuite(), launchConfiguration);
if (jadFile.exists()) {
executionProperties.put("jadfile", jadFile.toString());
}
}
String extraArguments =
launchConfiguration.getAttribute(ILaunchConstants.LAUNCH_PARAMS, "");
executionProperties.put("userSpecifiedArguments", extraArguments);
// Do the property resolution given the previous information
return ReplaceableParametersProcessor.processReplaceableValues(launchCommandTemplate, executionProperties);
}
/**
* @see eclipseme.core.model.impl.AbstractDevice#loadUsing(eclipseme.core.persistence.IPersistenceProvider)
*/
public void loadUsing(IPersistenceProvider persistenceProvider)
throws PersistenceException
{
super.loadUsing(persistenceProvider);
propertiesFile = new File(persistenceProvider.loadString("propertiesFile"));
}
/**
* @param propertiesFile The propertiesFile to set.
*/
public void setPropertiesFile(File propertiesFile) {
this.propertiesFile = propertiesFile;
}
/**
* @see eclipseme.core.model.impl.AbstractDevice#storeUsing(eclipseme.core.persistence.IPersistenceProvider)
*/
public void storeUsing(IPersistenceProvider persistenceProvider) throws PersistenceException {
super.storeUsing(persistenceProvider);
persistenceProvider.storeString("propertiesFile", propertiesFile.toString());
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -