diff options
author | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-14 17:04:19 +0900 |
---|---|---|
committer | Jinkun Jang <jinkun.jang@samsung.com> | 2013-03-14 17:04:19 +0900 |
commit | 1217dab9ea5a5a672c1cdf2b76b963dcf0ba6b1c (patch) | |
tree | 461af50aef951d181c3c3b0d7601a25218aec971 /org.tizen.common.connection | |
parent | 174190a2edf52a3a980d4e556e2b4e29407a08d9 (diff) | |
download | common-eplugin-1217dab9ea5a5a672c1cdf2b76b963dcf0ba6b1c.tar.gz common-eplugin-1217dab9ea5a5a672c1cdf2b76b963dcf0ba6b1c.tar.bz2 common-eplugin-1217dab9ea5a5a672c1cdf2b76b963dcf0ba6b1c.zip |
sync
Diffstat (limited to 'org.tizen.common.connection')
12 files changed, 0 insertions, 372 deletions
diff --git a/org.tizen.common.connection/icons/Connection Explorer.gif b/org.tizen.common.connection/icons/Connection Explorer.gif Binary files differdeleted file mode 100644 index 111e3f9ea..000000000 --- a/org.tizen.common.connection/icons/Connection Explorer.gif +++ /dev/null diff --git a/org.tizen.common.connection/icons/Emulator_start.gif b/org.tizen.common.connection/icons/Emulator_start.gif Binary files differdeleted file mode 100644 index 8737c07bd..000000000 --- a/org.tizen.common.connection/icons/Emulator_start.gif +++ /dev/null diff --git a/org.tizen.common.connection/icons/Emulator_stop.gif b/org.tizen.common.connection/icons/Emulator_stop.gif Binary files differdeleted file mode 100644 index 60cf40cad..000000000 --- a/org.tizen.common.connection/icons/Emulator_stop.gif +++ /dev/null diff --git a/org.tizen.common.connection/icons/log/Add tab.png b/org.tizen.common.connection/icons/log/Add tab.png Binary files differdeleted file mode 100644 index b07109b79..000000000 --- a/org.tizen.common.connection/icons/log/Add tab.png +++ /dev/null diff --git a/org.tizen.common.connection/icons/log/Clear Log.png b/org.tizen.common.connection/icons/log/Clear Log.png Binary files differdeleted file mode 100644 index 4f542ad11..000000000 --- a/org.tizen.common.connection/icons/log/Clear Log.png +++ /dev/null diff --git a/org.tizen.common.connection/icons/log/Edit tab.png b/org.tizen.common.connection/icons/log/Edit tab.png Binary files differdeleted file mode 100644 index d13ab48cf..000000000 --- a/org.tizen.common.connection/icons/log/Edit tab.png +++ /dev/null diff --git a/org.tizen.common.connection/icons/log/Export Log.png b/org.tizen.common.connection/icons/log/Export Log.png Binary files differdeleted file mode 100644 index ee3f1e8a3..000000000 --- a/org.tizen.common.connection/icons/log/Export Log.png +++ /dev/null diff --git a/org.tizen.common.connection/icons/log/Log View.gif b/org.tizen.common.connection/icons/log/Log View.gif Binary files differdeleted file mode 100644 index 9007253b2..000000000 --- a/org.tizen.common.connection/icons/log/Log View.gif +++ /dev/null diff --git a/org.tizen.common.connection/icons/log/Remove tab.png b/org.tizen.common.connection/icons/log/Remove tab.png Binary files differdeleted file mode 100644 index 6788fc85b..000000000 --- a/org.tizen.common.connection/icons/log/Remove tab.png +++ /dev/null diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java deleted file mode 100644 index 144e688f8..000000000 --- a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstall.java +++ /dev/null @@ -1,321 +0,0 @@ -/* -* Common -* -* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. -* -* Contact: -* Hoon Kang <h245.kang@samsung.com> -* YoonKi Park <yoonki.park@samsung.com> -* - * Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -* -* Contributors: -* - S-Core Co., Ltd -* -*/ - -package org.tizen.common.connection.debugtools; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.util.List; -import java.util.regex.Pattern; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.tizen.common.connection.ConnectionPlugin; -import org.tizen.common.log.Logger; - -import org.tizen.sdblib.IDevice; -import org.tizen.sdblib.SdbCommandRejectedException; -import org.tizen.sdblib.SdbShellProcess; -import org.tizen.sdblib.SyncService; -import org.tizen.sdblib.SyncService.SyncResult; -import org.tizen.sdblib.TimeoutException; - -class PackageInstallMonitorDialog extends ProgressMonitorDialog { - public PackageInstallMonitorDialog(Shell parent) { - super(parent); - int shellStyle = getShellStyle(); - shellStyle &= ~SWT.APPLICATION_MODAL; - setShellStyle(shellStyle); - } -} - -class InstallProgress implements IRunnableWithProgress { - - private static final String CMD_RESULT_CHECK = "; echo $?"; - - private IDevice device = null; - - IProgressMonitor monitor = null; - - private boolean checkDirectory(String dir) throws CoreException { - String cmd = "ls " + dir + CMD_RESULT_CHECK; - return checkExitCode(cmd, ToolsInstallMessages.CANNOT_CHECK_DIRECTORY); - } - - - private void makeDirectory(String dir) throws CoreException { - String cmd = "mkdir -p -m 755 " + dir + CMD_RESULT_CHECK ; - String msg = ToolsInstallMessages.CANNOT_CREATE_DIRECTORY; - - if (checkExitCode(cmd, msg) == false) - installCoreException(msg, null); - } - - private boolean checkExitCode( String cmd, String msg ) throws CoreException - { - boolean result = false; - SdbShellProcess lsProc; - BufferedReader br = null; - try { - lsProc = device.executeShellCommand(cmd); - br = new BufferedReader(new InputStreamReader( - lsProc.getInputStream())); - String lsOut = null; - while (null != (lsOut = br.readLine())) { - if ("0".equals(lsOut)) { - result = true; - break; - } - } - } catch (IOException e) { - installCoreException(msg, e); - Logger.error(msg, e); - }finally - { - if( br != null ) - try { - br.close(); - } catch (IOException e) { - Logger.error("Error to close BufferedReader", e); - } - } - return result; - } - - private boolean isInstalled(DebugTool dt) throws CoreException { - boolean ret = false; - BufferedReader br = null; - try { - - SdbShellProcess echoProc = device.executeShellCommand( - "cat " + DebugTool.TOOLS_TARGET_PATH + "/" + dt.getControlFile() + CMD_RESULT_CHECK); - br = new BufferedReader(new InputStreamReader( - echoProc.getInputStream())); - - String lsOut = null; - String oldVersion = null; - while (null != (lsOut = br.readLine())) { - //version:0.0.0 - if (lsOut.toLowerCase().startsWith("version:")) { - oldVersion = lsOut.split(":")[1]; - } - - if ("0".equals(lsOut)) { - String v1 = normalisedVersion(oldVersion, ".", 4); - String v2 = normalisedVersion(dt.getVersion(), ".", 4); - if (v2.compareTo(v1) > 0) { - //TODO : do install and save! - ret = false; - } else { //same version - ret = true; - } - break; - } else - ret = false; - } - } catch (IOException e) { - installCoreException(ToolsInstallMessages.CANNOT_CHECK_INSTALLED, e); - Logger.error(ToolsInstallMessages.CANNOT_CHECK_INSTALLED, e); - } finally { - if(br != null) - try { - br.close(); - } catch (IOException e) { - Logger.error("Error to close BufferedReader", e); - } - } - return ret; - - } - private String normalisedVersion(String version, String sep, int maxWidth) { - String[] split = Pattern.compile(sep, Pattern.LITERAL).split(version); - StringBuilder sb = new StringBuilder(); - for (String s : split) { - sb.append(String.format("%" + maxWidth + 's', s)); - } - return sb.toString(); - } - - private boolean copyPackage(String source, String destination) { - boolean pushResult = false; - try { - SyncService syncService = device.getSyncService(); - SyncResult pushSyncResult = syncService.pushFile(source, destination, - SyncService.getNullProgressMonitor()); - if (SyncService.RESULT_OK == pushSyncResult.getCode()) { - pushResult = true; - } - } catch (TimeoutException e) { - return false; - } catch (SdbCommandRejectedException e) { - return false; - } catch (IOException e) { - return false; - } - return pushResult; - } - - private final void installPackage(DebugTool tool) throws CoreException { - String local = DebugTool.TOOLS_HOST_PATH + "/" + tool.getSourcepath() + "/" + tool.getBinaryname(); - String remote = DebugTool.TOOLS_TARGET_PATH + "/" + tool.getBinaryname(); - - // delete old version - try { - device.executeShellCommand( - "cd " + DebugTool.TOOLS_TARGET_PATH + " && rm " + tool.getControlFile()); - } catch (IOException e) { - installCoreException(ToolsInstallMessages.CANNOT_REMOVE_CONTROLFILE, e); - Logger.error(ToolsInstallMessages.CANNOT_REMOVE_CONTROLFILE, e); - } - - - boolean isCopied = copyPackage(local, remote); - monitor.worked(5); - if (isCopied) { - try { - device.executeShellCommand("rm -rf " + DebugTool.TOOLS_TARGET_PATH + "/" + tool.getPackagename() + ";" - + "cd " + DebugTool.TOOLS_TARGET_PATH + " && tar -xzf " + tool.getBinaryname() + ";" - + "echo 'version:" + tool.getVersion() + "' >" + DebugTool.TOOLS_TARGET_PATH + "/" + tool.getControlFile() + ";" - + "cd " + DebugTool.TOOLS_TARGET_PATH + " && rm " + tool.getBinaryname()); - } catch (IOException e) { - Logger.error("Error after copied " + tool.getPackagename() , e); - } - } - } - - @Override - public void run(IProgressMonitor pMonitor) throws InvocationTargetException, InterruptedException { - final List<DebugTool> debugTools = ConnectionPlugin.getDebugTools(device); - - if (debugTools == null || debugTools.size() == 0) - return; - boolean isInstalled = false; - for (int i = 0; i < debugTools.size(); i++) { - DebugTool dt = (DebugTool) debugTools.get(i); - try { - isInstalled = isInstalled(dt); - } catch (CoreException e) { - Logger.error("Error to check installed", e); - } - if (isInstalled == false) - break; - } - if (isInstalled) - return; - - this.monitor = pMonitor; - - pMonitor.beginTask(ToolsInstallMessages.DIALOG_INITILIZE, 100); - //monitor.subTask("Prepare install"); - - // check directory exist - try { - if (!checkDirectory(DebugTool.TOOLS_TARGET_PATH)) - makeDirectory(DebugTool.TOOLS_TARGET_PATH); - } catch (CoreException e) { - Logger.error("Error to check or make directory", e); - } - - pMonitor.worked(10); - - // get package list to install - - pMonitor.worked(15); - - // install loop (cp, tar) - for (int i=0 ; i<debugTools.size(); i++) { - final DebugTool dt = (DebugTool)debugTools.get(i); - - if (device.isEmulator()) { - if (!dt.getArchitecture().equals("i386")) - continue; - } - else { - if (!dt.getArchitecture().equals("armel")) - continue; - } - Thread thread = new Thread(null, new Runnable() { - - @Override - public void run() { - try { - installPackage(dt); - } catch (CoreException e) { - Logger.error("Error to install tools", e); - } - } - }, "package check and install"); - thread.start(); - } - pMonitor.done(); - } - - public void setDevice(IDevice pDevice) { - device = pDevice; - } - - private void installCoreException(String message, Throwable exception) throws CoreException { - Status status = new Status(Status.ERROR, ConnectionPlugin.PLUGIN_ID, message, exception); - throw new CoreException(status); - } -} - -public class ToolsInstall { - - public static void installPackages(IDevice device) { - final IDevice tDevice = device; - - if (tDevice.isOffline()) { - return; - } - - Display.getDefault().asyncExec(new Runnable() { - @Override - public void run() { - final PackageInstallMonitorDialog installDialog = new PackageInstallMonitorDialog( - Display.getDefault().getActiveShell()); - try { - InstallProgress installProgress = new InstallProgress(); - installProgress.setDevice(tDevice); - installDialog.run(true, false, installProgress); - } catch (InvocationTargetException e) { - return; - } catch (InterruptedException e) { - return; - } - } - }); - - } -}
\ No newline at end of file diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.java b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.java deleted file mode 100644 index a81a712e0..000000000 --- a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.java +++ /dev/null @@ -1,43 +0,0 @@ -/*
-* Common
-*
-* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact:
-* Hoon Kang <h245.kang@samsung.com>
-* YoonKi Park <yoonki.park@samsung.com>
-*
- * Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-* Contributors:
-* - S-Core Co., Ltd
-*
-*/
-package org.tizen.common.connection.debugtools;
-
-import org.eclipse.osgi.util.NLS;
-
-public class ToolsInstallMessages extends NLS {
-
- static {
- NLS.initializeMessages(ToolsInstallMessages.class.getName(), ToolsInstallMessages.class);
- }
-
- public static String DIALOG_INITILIZE;
- public static String CANNOT_CREATE_DIRECTORY;
- public static String CANNOT_CHECK_DIRECTORY;
- public static String CANNOT_CHECK_INSTALLED;
- public static String CANNOT_COPY_FILE;
- public static String CANNOT_REMOVE_CONTROLFILE;
-
-}
diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.properties b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.properties deleted file mode 100644 index 5d8397958..000000000 --- a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/ToolsInstallMessages.properties +++ /dev/null @@ -1,8 +0,0 @@ -
-DIALOG_INITILIZE=Connection Explorer is initializing now. It might take few minutes.
-CANNOT_CREATE_DIRECTORY=Cannot create sdk tools directory
-CANNOT_CHECK_DIRECTORY=Cannot check sdk tools directory
-CANNOT_CHECK_INSTALLED=Cannot check installed tools
-CANNOT_COPY_FILE=Cannot copy file
-CANNOT_REMOVE_CONTROLFILE=Cannot copy file
-
|