import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.slf4j.LoggerFactory;
import org.tizen.common.TizenPlatformConstants;
import org.tizen.common.core.application.InstallPathConfig;
+import org.tizen.common.util.DialogUtil;
import org.tizen.common.util.FileUtil;
import org.tizen.common.util.IOUtil;
import org.tizen.sdblib.Arch;
+import org.tizen.common.util.SWTUtil;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.receiver.MultiLineReceiver;
import org.tizen.sdblib.service.SyncResult;
device = pDevice;
}
- private boolean copyPackage(String source, String destination) throws IOException {
+ private void copyPackage(String source, String destination) throws IOException {
SyncService syncService = null;
try {
syncService = device.getSyncService();
SyncResult result = syncService.push(source, device.getFileEntry( destination ).getParent() );
- if ( result.getCode() == RESULT_OK ) {
- return true;
- }
- else {
- return false;
+ if ( result.getCode() != RESULT_OK ) {
+ throw new IOException(result.getMessage());
}
} finally {
IOUtil.tryClose(syncService);
}
monitor.worked(10);
-
+ List<String> failedFileList = new ArrayList<String>();
for (DebugTool dt : debugTools) {
// get package list to install
verbose("Verifying: " + dt);
continue;
}
- deployPackage(dt);
+ if (!deployPackage(dt)) {
+ failedFileList.add(dt.getBinaryname());
+ }
+ }
+
+ if ( !failedFileList.isEmpty() ) {
+ openErrorDialog(failedFileList);
}
+
monitor.done();
}
+
+ private void openErrorDialog(List<String> messageList) {
+ if ( !messageList.isEmpty() ) {
+ final String messageStr = messageList.toString();
+ SWTUtil.asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ DialogUtil.openErrorDialog(NLS.bind(OnDemandInstallMessages.CANNOT_ON_DEMAND_INSTALL, messageStr));
+ }
+ });
+ }
+ }
- private final void deployPackage(DebugTool tool) {
+ private final boolean deployPackage(DebugTool tool) {
String local = TOOLS_HOST_PATH + "/" + tool.getSourcepath() + "/" + tool.getBinaryname();
String remote = TizenPlatformConstants.TOOLS_TARGET_PATH + "/" + tool.getBinaryname();
String cmd = "";
verbose("Deploying: " + tool);
try {
- if (copyPackage(local, remote) == false) {
- throw new IOException();
- }
+ copyPackage(local, remote);
} catch (IOException e) {
logger.error(NLS.bind(OnDemandInstallMessages.CANNOT_COPY_FILE, tool.getBinaryname()), e);
- return;
+ return false;
}
if (RPM_PACKAGE_TYPE.equals(tool.getPackagetype())) {
result = getResult(cmd);
if (CMD_RESULT_SUCCESS.equals(result) == false) {
logger.error(NLS.bind(OnDemandInstallMessages.CANNOT_INSTALL_TOOL, tool, cmd + " (exitcode: " + result + ")"));
+ return false;
} else {
verbose("Deployed: " + tool);
}
} catch (Exception e) {
logger.error(NLS.bind(OnDemandInstallMessages.ERROR_EXECUTE_COMMAND, cmd), e);
+ return false;
}
+
+ return true;
}
private void verbose(String message) {