org.tizen.common.connection_2.0.0.201311012034

16:49:50.013 INFO  jd.cli.Main - Decompiling org.tizen.common.connection_2.0.0.201311012034.jar
package org.tizen.common.connection;

import org.tizen.sdblib.service.FileEntry;

public abstract interface ConnectionPlugin$ISelectionListener
{
  public abstract void selectionChanged(FileEntry paramFileEntry);
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.ConnectionPlugin.ISelectionListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection;

import java.util.ArrayList;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.connection.preference.TizenConnectionExplorerPreferencePage;
import org.tizen.common.connection.preference.TizenLogPreferencePage;
import org.tizen.common.util.OSChecker;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.SmartDevelopmentBridge;
import org.tizen.sdblib.service.FileEntry;

public class ConnectionPlugin
  extends AbstractUIPlugin
{
  private static final Logger logger = LoggerFactory.getLogger(ConnectionPlugin.class);
  public static final String PLUGIN_ID = "org.tizen.common.connection";
  public static final String ID_LOGS_VIEW = "org.tizen.common.connection.log.LogView";
  public static final String ID_CONNECTION_VIEW = "org.tizen.common.connection.explorer.ConnectionExplorer";
  private static ConnectionPlugin plugin;
  private IDevice currentDevice = null;
  private final ArrayList<ISelectionListener> listeners = new ArrayList();
  public int os;
  public static final int LINUX = 0;
  public static final int WINDOWS = 1;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
    if (OSChecker.isWindows()) {
      os = 1;
    } else {
      os = 0;
    }
  }
  
  protected void initializeDefaultPreferences(IPreferenceStore store)
  {
    store.setDefault("pushpull_timeout", 30000);
    store.setDefault("emulator_manager_path", TizenConnectionExplorerPreferencePage.VALUE_EMULATOR_MANAGER_PATH_DEFAULT);
    store.setDefault("default_log_level", TizenLogPreferencePage.VALUE_DEFAULT_LEVEL);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null;
    
    int deviceCnt = SmartDevelopmentBridge.getBridge().getDevices().length;
    if (deviceCnt == 0) {
      SmartDevelopmentBridge.disconnectBridge();
    }
    super.stop(context);
  }
  
  public static ConnectionPlugin getDefault()
  {
    return plugin;
  }
  
  public void setCurrentDevice(IDevice device)
  {
    currentDevice = device;
  }
  
  public IDevice getCurrentDevice()
  {
    return currentDevice;
  }
  
  public void addSelectionListener(ISelectionListener listener)
  {
    listeners.add(listener);
  }
  
  public void removeSelectionListener(ISelectionListener listener)
  {
    listeners.remove(listener);
  }
  
  public void notifySelectionListeners(FileEntry file)
  {
    ISelectionListener[] listenersCopy = (ISelectionListener[])listeners.toArray(
      new ISelectionListener[listeners.size()]);
    ISelectionListener[] arrayOfISelectionListener1;
    int j = (arrayOfISelectionListener1 = listenersCopy).length;
    for (int i = 0; i < j; i++)
    {
      ISelectionListener listener = arrayOfISelectionListener1[i];
      try
      {
        listener.selectionChanged(file);
      }
      catch (Exception e)
      {
        logger.error("Failed to invoke selectionChanged", e);
      }
    }
  }
  
  public static ImageDescriptor getImageDescriptorFromPlugin(String path)
  {
    return imageDescriptorFromPlugin("org.tizen.common.connection", path);
  }
  
  public static abstract interface ISelectionListener
  {
    public abstract void selectionChanged(FileEntry paramFileEntry);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.ConnectionPlugin
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection;

import org.tizen.common.Surrogate;

public class ConnectionPluginSurrogate
  implements Surrogate<ConnectionPlugin>
{
  public ConnectionPlugin getAdapter()
  {
    return ConnectionPlugin.getDefault();
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.ConnectionPluginSurrogate
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.debugtools;

public class DebugTool
{
  private String binaryname;
  private String packagename;
  private String sourcepath;
  private String architecture;
  private String description;
  private String version;
  private String packagetype;
  
  public DebugTool() {}
  
  public DebugTool(String packagename, String binaryname, String sourcepath, String version, String desc, String arch, String type)
  {
    this.packagename = packagename;
    this.binaryname = binaryname;
    this.sourcepath = sourcepath;
    this.version = version;
    description = desc;
    architecture = arch;
    packagetype = type;
  }
  
  public String getBinaryname()
  {
    return binaryname;
  }
  
  public String getVersion()
  {
    return version;
  }
  
  public void setVersion(String pVersion)
  {
    version = pVersion;
  }
  
  public void setBinaryname(String pBinaryname)
  {
    binaryname = pBinaryname;
  }
  
  public String getPackagename()
  {
    return packagename;
  }
  
  public void setPackagename(String pPackagename)
  {
    packagename = pPackagename;
  }
  
  public String getSourcepath()
  {
    return sourcepath;
  }
  
  public void setSourcepath(String pSourcepath)
  {
    sourcepath = pSourcepath;
  }
  
  public String getArchitecture()
  {
    return architecture;
  }
  
  public void setArchitecture(String pArchitecture)
  {
    architecture = pArchitecture;
  }
  
  public String getDescription()
  {
    return description;
  }
  
  public void setDescription(String pDescription)
  {
    description = pDescription;
  }
  
  public void setPackagetype(String packagetype)
  {
    this.packagetype = packagetype;
  }
  
  public String getPackagetype()
  {
    return packagetype;
  }
  
  public String toString()
  {
    return packagename + "," + packagetype + "," + architecture + "," + binaryname;
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.debugtools.DebugTool
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.debugtools;

import org.eclipse.osgi.util.NLS;
import org.tizen.common.util.DialogUtil;

class OnDemandInstall$1
  implements Runnable
{
  OnDemandInstall$1(OnDemandInstall paramOnDemandInstall, String paramString) {}
  
  public void run()
  {
    DialogUtil.openErrorDialog(NLS.bind(OnDemandInstallMessages.CANNOT_ON_DEMAND_INSTALL, val$messageStr));
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.debugtools.OnDemandInstall.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.debugtools;

import org.tizen.sdblib.receiver.MultiLineReceiver;

final class OnDemandInstall$CommandOuputReceiver
  extends MultiLineReceiver
{
  private String result = "";
  
  private OnDemandInstall$CommandOuputReceiver(OnDemandInstall paramOnDemandInstall) {}
  
  public void processNewLines(String[] lines)
  {
    result = lines[(lines.length - 1)];
  }
  
  public String getResult()
  {
    return result;
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.debugtools.OnDemandInstall.CommandOuputReceiver
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.debugtools;

import org.eclipse.core.runtime.IProgressMonitor;

class OnDemandInstall$OnDemandNullProgressMonitor
  implements IProgressMonitor
{
  public void beginTask(String name, int totalWork) {}
  
  public void done() {}
  
  public void internalWorked(double work) {}
  
  public boolean isCanceled()
  {
    return false;
  }
  
  public void setCanceled(boolean value) {}
  
  public void setTaskName(String name) {}
  
  public void subTask(String name) {}
  
  public void worked(int work) {}
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.debugtools.OnDemandInstall.OnDemandNullProgressMonitor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.debugtools;

import org.eclipse.core.runtime.IProgressMonitor;

class OnDemandInstall$OnDemandRunnable
  implements Runnable
{
  IProgressMonitor monitor = null;
  
  OnDemandInstall$OnDemandRunnable(OnDemandInstall paramOnDemandInstall, IProgressMonitor monitor)
  {
    this.monitor = monitor;
  }
  
  public void run()
  {
    OnDemandInstall.access$0(this$0, monitor);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.debugtools.OnDemandInstall.OnDemandRunnable
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.debugtools;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.osgi.util.NLS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.TizenPlatformConstants;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.common.util.CollectionUtil;
import org.tizen.common.util.DialogUtil;
import org.tizen.common.util.FileUtil;
import org.tizen.common.util.IOUtil;
import org.tizen.common.util.SWTUtil;
import org.tizen.common.util.SdbCommandUtil;
import org.tizen.sdblib.Arch;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.receiver.MultiLineReceiver;
import org.tizen.sdblib.service.FileEntry;
import org.tizen.sdblib.service.SyncResult;
import org.tizen.sdblib.service.SyncService;

public class OnDemandInstall
{
  private Logger logger = LoggerFactory.getLogger(getClass());
  public static final String ID_DEBUGTOOLS_EXTENSION = "org.tizen.common.connection.tools";
  public static final String TOOLS_HOST_PATH = ;
  public static final String RPM_PACKAGE_TYPE = "rpm";
  private static final String RPM_QUERY_COMMAND = "rpm -qa | grep %s | wc -l";
  private static final String CMD_RESULT_SUCCESS = "0";
  private static final String MOVE_WORKING_DIR_COMMAND = "cd " + TizenPlatformConstants.TOOLS_TARGET_PATH;
  private static final String REMOVE_TOOL_COMMAND = "rm -f %s";
  private static final String TAR_INSTALL_COMMAND = MOVE_WORKING_DIR_COMMAND + " && tar -xf %s" + " && " + "rm -f %s";
  private static final String RPM_INSTALL_COMMAND = MOVE_WORKING_DIR_COMMAND + " && rpm -U %s" + " && " + "rm -f %s";
  private IDevice device = null;
  private static IProgressMonitor nullMonitor = new OnDemandNullProgressMonitor(null);
  private List<DebugTool> debugTools = null;
  boolean blocking = false;
  
  public OnDemandInstall(IDevice device)
  {
    this.device = device;
    debugTools = getDebugTools(device);
  }
  
  public OnDemandInstall(IDevice device, String packageName)
  {
    this.device = device;
    debugTools = getDebugTools(device, packageName);
  }
  
  public void setBlocking(boolean blocking)
  {
    this.blocking = blocking;
  }
  
  private boolean checkDirectory(String dir)
  {
    String cmd = "ls " + dir + "; echo $?;";
    String result = "";
    try
    {
      result = getResult(cmd);
      if ("0".equals(result)) {
        return true;
      }
    }
    catch (Exception localException)
    {
      logger.error(OnDemandInstallMessages.CANNOT_CHECK_DIRECTORY);
    }
    return false;
  }
  
  private void makeDirectory(String dir)
  {
    String cmd = "mkdir -p -m 755 " + dir + "; echo $?;";
    String result = "";
    try
    {
      result = getResult(cmd);
      if (!"0".equals(result)) {
        logger.error(OnDemandInstallMessages.CANNOT_CREATE_DIRECTORY);
      }
    }
    catch (Exception localException)
    {
      logger.error(OnDemandInstallMessages.CANNOT_CREATE_DIRECTORY);
    }
  }
  
  private String getResult(String cmd)
    throws Exception
  {
    String result = "";
    CommandOuputReceiver receiver = new CommandOuputReceiver(null);
    
    device.executeShellCommand(cmd, receiver, 0);
    result = receiver.getResult();
    return result;
  }
  
  private boolean isInstalled(DebugTool dt)
  {
    if ("rpm".equals(dt.getPackagetype())) {
      return false;
    }
    String cmd = "ls " + TizenPlatformConstants.TOOLS_TARGET_PATH + "/" + dt.getPackagename() + "; echo $?;";
    try
    {
      String result = getResult(cmd);
      if ("0".equals(result)) {
        return true;
      }
    }
    catch (Exception e)
    {
      logger.error(NLS.bind(OnDemandInstallMessages.CANNOT_CHECK_INSTALLED, dt.getPackagename()), e);
    }
    return false;
  }
  
  public void install(IProgressMonitor monitor)
  {
    if (monitor == null) {
      monitor = nullMonitor;
    }
    if (blocking)
    {
      installPackage(monitor);
    }
    else
    {
      String threadName = "OnDemandInstallThread";
      Runnable r = new OnDemandRunnable(monitor);
      Thread t = new Thread(r, threadName);
      t.start();
    }
  }
  
  public void setDevice(IDevice pDevice)
  {
    device = pDevice;
  }
  
  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.isOk()) {
        throw new IOException(result.getMessage());
      }
    }
    finally
    {
      IOUtil.tryClose(new Object[] {syncService });
    }
    IOUtil.tryClose(new Object[] {syncService });
  }
  
  private void installPackage(IProgressMonitor monitor)
  {
    if (CollectionUtil.isEmpty(debugTools)) {
      return;
    }
    monitor.beginTask(OnDemandInstallMessages.DIALOG_INITILIZE, 100);
    monitor.subTask("Prepare install");
    if (!checkDirectory(TizenPlatformConstants.TOOLS_TARGET_PATH)) {
      makeDirectory(TizenPlatformConstants.TOOLS_TARGET_PATH);
    }
    monitor.worked(10);
    List<String> failedFileList = new ArrayList();
    for (DebugTool dt : debugTools)
    {
      verbose("Verifying: " + dt);
      if (verifyArchitecture(dt.getArchitecture())) {
        if (isInstalled(dt)) {
          verbose("Verifying failed (already installed): " + dt);
        } else 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()
      {
        public void run()
        {
          DialogUtil.openErrorDialog(NLS.bind(OnDemandInstallMessages.CANNOT_ON_DEMAND_INSTALL, messageStr));
        }
      });
    }
  }
  
  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 = "";
    String result = "";
    
    verbose("Deploying: " + tool);
    try
    {
      copyPackage(local, remote);
    }
    catch (IOException e)
    {
      logger.error(NLS.bind(OnDemandInstallMessages.CANNOT_COPY_FILE, tool.getBinaryname()), e);
      return false;
    }
    if ("rpm".equals(tool.getPackagetype()))
    {
      cmd = String.format(RPM_INSTALL_COMMAND, new Object[] { tool.getBinaryname(), tool.getBinaryname() }) + "; echo $?;";
      if (device.isEmulator()) {
        SdbCommandUtil.runRootCommand(device, true);
      }
    }
    else
    {
      cmd = String.format(TAR_INSTALL_COMMAND, new Object[] { tool.getBinaryname(), tool.getBinaryname() }) + "; echo $?;";
    }
    try
    {
      result = getResult(cmd);
      if (!"0".equals(result))
      {
        logger.error(NLS.bind(OnDemandInstallMessages.CANNOT_INSTALL_TOOL, tool, cmd + " (exitcode: " + result + ")"));
        return false;
      }
      verbose("Deployed: " + tool);
    }
    catch (Exception e)
    {
      logger.error(NLS.bind(OnDemandInstallMessages.ERROR_EXECUTE_COMMAND, cmd), e);
      return false;
    }
    finally
    {
      if (("rpm".equals(tool.getPackagetype())) && 
        (device.isEmulator())) {
        SdbCommandUtil.runRootCommand(device, false);
      }
    }
    if (("rpm".equals(tool.getPackagetype())) && 
      (device.isEmulator())) {
      SdbCommandUtil.runRootCommand(device, false);
    }
    return true;
  }
  
  private void verbose(String message)
  {
    logger.debug("[OnDemandInstall][" + Thread.currentThread().getId() + "] " + message);
  }
  
  private void warn(String message)
  {
    logger.warn("[OnDemandInstall][" + Thread.currentThread().getId() + "] " + message);
  }
  
  class OnDemandRunnable
    implements Runnable
  {
    IProgressMonitor monitor = null;
    
    OnDemandRunnable(IProgressMonitor monitor)
    {
      this.monitor = monitor;
    }
    
    public void run()
    {
      OnDemandInstall.this.installPackage(monitor);
    }
  }
  
  public static IProgressMonitor getNullIProgressMonitor()
  {
    return nullMonitor;
  }
  
  private static class OnDemandNullProgressMonitor
    implements IProgressMonitor
  {
    public void beginTask(String name, int totalWork) {}
    
    public void done() {}
    
    public void internalWorked(double work) {}
    
    public boolean isCanceled()
    {
      return false;
    }
    
    public void setCanceled(boolean value) {}
    
    public void setTaskName(String name) {}
    
    public void subTask(String name) {}
    
    public void worked(int work) {}
  }
  
  private final class CommandOuputReceiver
    extends MultiLineReceiver
  {
    private String result = "";
    
    private CommandOuputReceiver() {}
    
    public void processNewLines(String[] lines)
    {
      result = lines[(lines.length - 1)];
    }
    
    public String getResult()
    {
      return result;
    }
  }
  
  private boolean verifyArchitecture(String arch)
  {
    if (arch == null) {
      return false;
    }
    if (device.getArch() == Arch.X86)
    {
      if (arch.contains("arm")) {
        return false;
      }
    }
    else if (arch.contains("86")) {
      return false;
    }
    return true;
  }
  
  private synchronized List<DebugTool> getDebugTools(IDevice device, String packageName)
  {
    List<DebugTool> debugTools = getDebugTools(device);
    List<DebugTool> toolInfo = new ArrayList(1);
    if (packageName != null) {
      for (DebugTool dt : debugTools) {
        if (packageName.equals(dt.getPackagename())) {
          toolInfo.add(dt);
        }
      }
    }
    return toolInfo;
  }
  
  private synchronized List<DebugTool> getDebugTools(IDevice device)
  {
    List<DebugTool> toolLists = new ArrayList();
    IExtensionRegistry x = RegistryFactory.getRegistry();
    IConfigurationElement[] ces = x.getConfigurationElementsFor("org.tizen.common.connection.tools");
    try
    {
      IConfigurationElement[] arrayOfIConfigurationElement1;
      int j = (arrayOfIConfigurationElement1 = ces).length;
      for (int i = 0; i < j; i++)
      {
        IConfigurationElement ce = arrayOfIConfigurationElement1[i];
        if (ce.getName().equals("tools"))
        {
          String packagename = ce.getAttribute("packagename");
          if (packagename != null)
          {
            String sourcepath = ce.getAttribute("sourcepath");
            if (sourcepath != null)
            {
              verbose("a extension ('" + packagename + "') is loaded.");
              String description = ce.getAttribute("description");
              Path sourcePath = new Path(InstallPathConfig.getPlatformVersionPath() + "/" + sourcepath);
              File packageList = new File(sourcePath.toOSString());
              
              DebugTool dt = null;
              File[] packageFileList = packageList.listFiles();
              if (packageFileList != null)
              {
                File[] arrayOfFile1;
                int m = (arrayOfFile1 = packageFileList).length;
                for (int k = 0; k < m; k++)
                {
                  File f = arrayOfFile1[k];
                  if ("rpm".equals(FileUtil.getFileExtension(f.getName()))) {
                    dt = makeDebugToolFromRPM(f, device, packagename, sourcepath, description);
                  } else {
                    dt = makeDebugToolFromTar(f, device, packagename, sourcepath, description);
                  }
                  if (dt != null) {
                    toolLists.add(dt);
                  } else if (dt == null) {
                    verbose("packagename('" + packagename + "') does not match with the file name('" + f.getName() + "').");
                  }
                }
              }
            }
          }
        }
      }
    }
    catch (Throwable e)
    {
      logger.error("Failed making DebugTool list for on-demand install", e);
    }
    return toolLists;
  }
  
  private DebugTool makeDebugToolFromRPM(File f, IDevice device, String packagename, String sourcepath, String description)
  {
    DebugTool dt = null;
    try
    {
      verbose("start makeDebugToolFromRPM(f - '" + f.getName() + ", ' packagename - '" + packagename + "')");
      String architecture = "";
      String version = "";
      String name = "";
      
      String[] fileSplit = f.getName().split("-");
      if (fileSplit.length >= 3)
      {
        name = fileSplit[0];
        for (int i = 1; i < fileSplit.length - 2; i++) {
          name = name + "-" + fileSplit[i];
        }
        version = fileSplit[(fileSplit.length - 2)];
        String[] archSplit = fileSplit[(fileSplit.length - 1)].split("\\.");
        architecture = archSplit[(archSplit.length - 2)];
        if (packagename.equals(name)) {
          if (verifyArchitecture(architecture)) {
            dt = new DebugTool(packagename, f.getName(), sourcepath, version, description, architecture, "rpm");
          }
        }
      }
    }
    finally {}
    verbose("end makeDebugToolFromRPM(f - '" + f.getName() + ", ' packagename - '" + packagename + "') return: " + dt);
    return dt;
  }
  
  private DebugTool makeDebugToolFromTar(File f, IDevice device, String packagename, String sourcepath, String description)
  {
    DebugTool dt = null;
    try
    {
      verbose("start makeDebugToolFromTar(f - '" + f.getName() + ", ' packagename - '" + packagename + "')");
      String[] filename = f.getName().split("_");
      if (filename.length == 3) {
        if (filename[0].equals(packagename))
        {
          String version = filename[1];
          String[] arch = filename[2].split("\\.");
          if (arch.length == 2)
          {
            String architecture = arch[0];
            if (verifyArchitecture(architecture)) {
              dt = new DebugTool(packagename, f.getName(), sourcepath, version, description, architecture, "tar");
            }
          }
        }
      }
    }
    finally {}
    verbose("end makeDebugToolFromTar(f - '" + f.getName() + ", ' packagename - '" + packagename + "') return: " + dt);
    return dt;
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.debugtools.OnDemandInstall
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.debugtools;

import org.eclipse.osgi.util.NLS;

public class OnDemandInstallMessages
  extends NLS
{
  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;
  public static String CANNOT_INSTALL_TOOL;
  public static String ERROR_EXECUTE_COMMAND;
  public static String CANNOT_ON_DEMAND_INSTALL;
  
  static
  {
    NLS.initializeMessages(OnDemandInstallMessages.class.getName(), OnDemandInstallMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.debugtools.OnDemandInstallMessages
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;

class ConnectionExplorer$1
  extends KeyAdapter
{
  ConnectionExplorer$1(ConnectionExplorer paramConnectionExplorer) {}
  
  public void keyPressed(KeyEvent e)
  {
    ConnectionExplorer.access$0(this$0, e);
  }
  
  public void keyReleased(KeyEvent e) {}
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$10
  extends Action
{
  ConnectionExplorer$10(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$9(this$0, true);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.10
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$11
  extends Action
{
  ConnectionExplorer$11(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$9(this$0, false);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.11
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;

class ConnectionExplorer$12
  implements IMenuListener
{
  ConnectionExplorer$12(ConnectionExplorer paramConnectionExplorer) {}
  
  public void menuAboutToShow(IMenuManager manager)
  {
    ConnectionExplorer.access$10(this$0, manager);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.12
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;

class ConnectionExplorer$13
  implements IMenuListener
{
  ConnectionExplorer$13(ConnectionExplorer paramConnectionExplorer) {}
  
  public void menuAboutToShow(IMenuManager manager)
  {
    IContributionItem[] items = manager.getItems();
    if (items != null)
    {
      IContributionItem[] arrayOfIContributionItem1;
      int j = (arrayOfIContributionItem1 = items).length;
      for (int i = 0; i < j; i++)
      {
        IContributionItem item = arrayOfIContributionItem1[i];
        if ("team.main".equals(item.getId()))
        {
          manager.remove(item);
          break;
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.13
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jface.action.MenuManager;
import org.slf4j.Logger;
import org.tizen.sdblib.receiver.MultiLineReceiver;

class ConnectionExplorer$14
  extends MultiLineReceiver
{
  ConnectionExplorer$14(ConnectionExplorer paramConnectionExplorer, AtomicInteger paramAtomicInteger) {}
  
  public void processNewLines(String[] lines)
  {
    String[] arrayOfString;
    int j = (arrayOfString = lines).length;
    for (int i = 0; i < j; i++)
    {
      String line = arrayOfString[i];
      if ((ConnectionExplorer.PLATFORMLOG_ON.equals(line)) || (ConnectionExplorer.PLATFORMLOG_OFF.equals(line)))
      {
        val$result.set(Integer.parseInt(line));
        if (ConnectionExplorer.access$11(this$0).isVisible()) {
          break;
        }
        ConnectionExplorer.access$11(this$0).setVisible(true);
        
        break;
      }
    }
    if (val$result.get() == ConnectionExplorer.PLATFORMLOG_UNABLE) {
      ConnectionExplorer.access$12(this$0).error("Failed to get platform log: " + lines[0]);
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.14
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import java.io.IOException;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.slf4j.Logger;

class ConnectionExplorer$15
  extends SelectionAdapter
{
  ConnectionExplorer$15(ConnectionExplorer paramConnectionExplorer) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    try
    {
      
    }
    catch (IOException e1)
    {
      ConnectionExplorer.access$12(this$0).error("Fail to start Emulator Manager", e1.getMessage());
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.15
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ConnectionExplorer$16
  extends SelectionAdapter
{
  ConnectionExplorer$16(ConnectionExplorer paramConnectionExplorer) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    ConnectionExplorer.access$8(this$0).pushIntoSelection();
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.16
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ConnectionExplorer$17
  extends SelectionAdapter
{
  ConnectionExplorer$17(ConnectionExplorer paramConnectionExplorer) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    ConnectionExplorer.access$8(this$0).pullSelection();
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.17
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.tizen.common.util.NotificationType;
import org.tizen.common.util.NotifierDialog;

class ConnectionExplorer$18
  implements Runnable
{
  ConnectionExplorer$18(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    NotifierDialog.notify(ConnectionUIMessages.Explorer_Closed_Title, ConnectionUIMessages.Explorer_Closed_Message, NotificationType.WARN);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.18
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$2
  extends Action
{
  ConnectionExplorer$2(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$3
  extends Action
{
  ConnectionExplorer$3(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$2(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$4
  extends Action
{
  ConnectionExplorer$4(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$3(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$5
  extends Action
{
  ConnectionExplorer$5(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$4(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.5
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$6
  extends Action
{
  ConnectionExplorer$6(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$5(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.6
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$7
  extends Action
{
  ConnectionExplorer$7(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$6(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.7
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$8
  extends Action
{
  ConnectionExplorer$8(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$7(this$0);
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.8
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import org.eclipse.jface.action.Action;

class ConnectionExplorer$9
  extends Action
{
  ConnectionExplorer$9(ConnectionExplorer paramConnectionExplorer) {}
  
  public void run()
  {
    ConnectionExplorer.access$8(this$0).showPropertySelection(this$0.getSite());
  }
}

/* Location:
 * Qualified Name:     org.tizen.common.connection.explorer.ConnectionExplorer.9
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.common.connection.explorer;

import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IPartListener2;
import org.eclipse.ui.IPartService;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.contexts.IContextService;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.part.ViewPart;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.common.util.HostUtil;
import org.tizen.common.util.NotificationType;
import org.tizen.common.util.NotifierDialog;
import org.tizen.common.util.SWTUtil;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.SmartDevelopmentBridge;
import org.tizen.sdblib.receiver.MultiLineReceiver;
import org.tizen.sdblib.service.FileEntry;

public class ConnectionExplorer
  extends ViewPart
  implements IPartListener2
{
  private final Logger logger = LoggerFactory.getLogger(ConnectionExplorer.class);
  private ConnectionExplorerPanel panel;
  private Composite parent;
  private ToolBar toolBar;
  private ToolItem pushToolItem;
  private ToolItem pullToolItem;
  private ToolItem emulManagerToolItem;
  private MenuManager menuMgr;
  private MenuManager subNewMenu;
  private MenuManager subLogMenu;
  private Action actionAddFolder;
  private Action actionAddFile;
  private Action actionPush;
  private Action actionPull;
  private Action actionRefresh;
  private Action actionRename;
  private Action actionProperty;
  private Action actionDelete;
  private Action actionPlatformLogOn;
  private Action actionPlatformLogOff;
  public static String PLATFORMLOG_OFF = "0";
  public static String PLATFORMLOG_ON = "1";
  public static int PLATFORMLOG_UNABLE = 2;
  
  public void dispose()
  {
    IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow();
    workbenchWindow.getPartService().removePartListener(this);
  }
  
  public void createPartControl(Composite p)
  {
    IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow();
    workbenchWindow.getPartService().addPartListener(this);
    
    parent = p;
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.tizen.ide.common.connection_explorer_context");
    parent.setLayoutData(new GridData(1040));
    parent.setLayout(new GridLayout(1, false));
    
    Composite top = new Composite(parent, 0);
    
    GridLayout gridLayout = new GridLayout();
    numColumns = 3;
    marginWidth = 0;
    marginHeight = 0;
    
    GridData gridData = new GridData(768);
    horizontalSpan = 2;
    
    top.setLayoutData(gridData);
    top.setLayout(gridLayout);
    
    createToolBar(top, gridData);
    
    Composite bottom = new Composite(parent, 0);
    bottom.setLayoutData(new GridData(1808));
    bottom.setLayout(new FillLayout());
    
    createFileExplorerView(bottom);
    makeActions();
    activateContext();
    initContextMenu();
    
    panel.setToolItems(pushToolItem, pullToolItem, emulManagerToolItem);
    
    panel.setActions(subNewMenu, actionPush, actionPull, actionRefresh, actionRename, actionProperty, actionDelete, subLogMenu);
  }
  
  private void createFileExplorerView(Composite parent)
  {
    panel = new ConnectionExplorerPanel();
    panel.createControl(parent);
    panel.postCreation();
    panel.getTreeViewer().getTree().addKeyListener(new KeyAdapter()
    {
      public void keyPressed(KeyEvent e)
      {
        ConnectionExplorer.this.handleKeyPressed(e);
      }
      
      public void keyReleased(KeyEvent e) {}
    });
  }
  
  private void handleKeyPressed(KeyEvent event)
  {
    Tree tree = (Tree)widget;
    int length = tree.getSelectionCount();
    if (keyCode == 16777230)
    {
      if (length == 1) {
        actionRefresh();
      }
    }
    else if (keyCode == 16777227)
    {
      if (length == 1) {
        actionRename();
      }
    }
    else if (keyCode == 127) {
      actionDelete();
    
1 2 3 4 5 6 7

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd