org.tizen.dynamicanalysis.ide.eplugin_2.1.0.201310071554

16:50:01.271 INFO  jd.cli.Main - Decompiling org.tizen.dynamicanalysis.ide.eplugin_2.1.0.201310071554.jar
package org.tizen.dynamicanalysis.ide.eplugin;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.tizen.dynamicanalysis.ide.eplugin.communication.ServerStartup;
import org.tizen.dynamicanalysis.ide.eplugin.launch.PlatformChangingHandler;
import org.tizen.nativecommon.build.PlatformChangingManager;
import org.tizen.nativecommon.build.ui.IPlatformChangedListener;

public class Activator
  implements BundleActivator
{
  public static final String PLUGIN_ID = "org.tizen.dynamicanalyzer";
  public static final String DA_BUILD_CONFIGURATION_NAME_EMULATOR = "DA-Tizen-Emulator";
  public static final String DA_BUILD_CONFIGURATION_NAME_DEVICE = "DA-Tizen-Device";
  public static final String DA_BUILD_CONFIGURATION_NAME_PROFILE = "Profile";
  public static final String DA_BUILD_CONFIGURATION_NAME = "Dynamic Analyzer";
  public static final String PROFILE_MODE = "profile";
  private static BundleContext context;
  public static IPlatformChangedListener listner = new PlatformChangingHandler("Dynamic Analyzer");
  
  static BundleContext getContext()
  {
    return context;
  }
  
  public void start(BundleContext bundleContext)
    throws Exception
  {
    context = bundleContext;
    PlatformChangingManager.addListener(listner);
  }
  
  public void stop(BundleContext bundleContext)
    throws Exception
  {
    context = null;
    ServerStartup.stopServeThread();
  }
}

/* Location:
 * Qualified Name:     org.tizen.dynamicanalysis.ide.eplugin.Activator
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.dynamicanalysis.ide.eplugin;

import java.io.File;
import java.util.Comparator;

class DALog$1
  implements Comparator<File>
{
  public int compare(File object1, File object2)
  {
    return object2.getName().compareTo(object1.getName());
  }
}

/* Location:
 * Qualified Name:     org.tizen.dynamicanalysis.ide.eplugin.DALog.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.dynamicanalysis.ide.eplugin;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

class DALog$2
  implements Runnable
{
  DALog$2(String paramString1, String paramString2) {}
  
  public void run()
  {
    IWorkbenchWindow window = PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow();
    MessageDialog.openError(window.getShell(), val$title, val$message);
  }
}

/* Location:
 * Qualified Name:     org.tizen.dynamicanalysis.ide.eplugin.DALog.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.dynamicanalysis.ide.eplugin;

import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.tizen.common.core.application.InstallPathConfig;

public class DALog
{
  private static boolean LOG_TO_FILE = true;
  static File file = null;
  static FileOutputStream fos = null;
  static DataOutputStream dos = null;
  static boolean setInit = false;
  static final String IDE_LOG_NAME = "da_ide_log_";
  static final int IDE_LOG_SAVE_COUNT = 3;
  
  private static boolean init()
  {
    if (LOG_TO_FILE)
    {
      if (InstallPathConfig.getUserDataPath() == null)
      {
        LOG_TO_FILE = false;
        System.out.println("exception -NULL InstallPathConfig.getUserDataPath()");
        return false;
      }
      StringBuffer logPath = new StringBuffer();
      logPath.append(InstallPathConfig.getUserDataPath())
        .append(File.separatorChar).append("dynamic-analyzer")
        .append(File.separatorChar).append("logs");
      File logsSaveFolderPath = new File(logPath.toString());
      if (!logsSaveFolderPath.exists()) {
        logsSaveFolderPath.mkdirs();
      }
      if (manageIDELogFileCount(logsSaveFolderPath))
      {
        SimpleDateFormat format = new SimpleDateFormat(
          "yyyy_MM_dd_HH-mm-ss", 
          Locale.KOREA);
        Date date = new Date();
        String logFileName = "da_ide_log_" + format.format(date);
        
        logPath.append(File.separatorChar).append(logFileName);
        
        file = new File(logPath.toString());
        file.getParentFile().mkdirs();
        try
        {
          fos = new FileOutputStream(file);
        }
        catch (FileNotFoundException e)
        {
          e.printStackTrace();
        }
        dos = new DataOutputStream(fos);
      }
      else
      {
        LOG_TO_FILE = false;
      }
    }
    return true;
  }
  
  private static boolean manageIDELogFileCount(File logsSaveFolderPath)
  {
    File[] logFiles = logsSaveFolderPath.listFiles();
    if (logFiles == null)
    {
      System.out.println("exception - manageIDELogFileCount");
      LOG_TO_FILE = false;
      return false;
    }
    List<File> listLogFile = sortIDELogFile(logFiles);
    int logSize = listLogFile.size();
    for (int i = 2; i < logSize; i++) {
      ((File)listLogFile.get(i)).delete();
    }
    return true;
  }
  
  private static List<File> sortIDELogFile(File[] logFiles)
  {
    List<File> ideLogFile = new ArrayList();
    File[] arrayOfFile = logFiles;int j = logFiles.length;
    for (int i = 0; i < j; i++)
    {
      File file = arrayOfFile[i];
      if (file.getName().contains("da_ide_log_")) {
        ideLogFile.add(file);
      }
    }
    Collections.sort(ideLogFile, new Comparator()
    {
      public int compare(File object1, File object2)
      {
        return object2.getName().compareTo(object1.getName());
      }
    });
    return ideLogFile;
  }
  
  public static void printLog(String logMsg)
  {
    if (LOG_TO_FILE)
    {
      if (!setInit)
      {
        setInit = true;
        if (!init()) {
          return;
        }
      }
      try
      {
        dos.writeBytes(logMsg);
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
      try
      {
        dos.writeChars("\n");
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
      try
      {
        dos.flush();
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
    }
    else
    {
      System.out.println(logMsg);
    }
  }
  
  public static void printLog(Exception errMsg)
  {
    if (LOG_TO_FILE)
    {
      if (!setInit)
      {
        setInit = true;
        init();
      }
      try
      {
        dos.writeBytes(printStackTraceToString(errMsg));
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
      try
      {
        dos.writeChars("\n");
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
      try
      {
        dos.flush();
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
    }
    else
    {
      errMsg.printStackTrace();
    }
  }
  
  private static String printStackTraceToString(Throwable e)
  {
    StringBuilder sb = new StringBuilder();
    String returnString = null;
    sb.append(e.toString());
    sb.append("\n");
    StackTraceElement[] element = e.getStackTrace();
    for (int idx = 0; idx < element.length; idx++)
    {
      sb.append("\tat ");
      sb.append(element[idx].toString());
      sb.append("\n");
    }
    returnString = sb.toString();
    return returnString;
  }
  
  public static void dlgErrorMessage(String title, final String message)
  {
    Display.getDefault().asyncExec(new Runnable()
    {
      public void run()
      {
        IWorkbenchWindow window = PlatformUI.getWorkbench()
          .getActiveWorkbenchWindow();
        MessageDialog.openError(window.getShell(), DALog.this, message);
      }
    });
  }
}

/* Location:
 * Qualified Name:     org.tizen.dynamicanalysis.ide.eplugin.DALog
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.dynamicanalysis.ide.eplugin.communication;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.RandomAccessFile;
import java.net.Socket;
import java.net.UnknownHostException;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.dynamicanalysis.ide.eplugin.DALog;
import org.tizen.dynamicanalysis.ide.eplugin.nl.Labels;

public class DAServerManager
  extends Thread
{
  private final int MAXBUFSIZE = 1024;
  private static DAServerManager instance;
  private Socket ideClientSocket = null;
  private BufferedWriter writer = null;
  private int serverPort = 0;
  private boolean reservedTraceApplication = false;
  private String reservedDeviceName = "";
  private String reservedApplicationID = "";
  private String reservedApplicationName = "";
  private final String IDE_DA_COMMUNICATION_TYPE_1 = "STATUS";
  private final String IDE_DA_COMMUNICATION_TYPE_2 = "RUN";
  private final String IDE_DA_COMMUNICATION_TYPE_3 = "SOURCE";
  private final String IDE_DA_COMMUNICATION_SEPARATOR = "`,";
  private final String IDE_DA_COMMUNICATION_TYPE_1_RECORD = "record";
  private final String IDE_DA_COMMUNICATION_TYPE_1_STOP = "stop";
  private static final String DANAIC_ANALYZER = "dynamic-analyzer";
  private static final String SAVE = "save";
  private static final String ACTIVE_DA_PLUGIN = "active_da_plugin";
  private final String CURRENT_ACTIVE_IDE_PORT = "current_active_ide_port";
  private static Boolean recvDAReadyStatus = Boolean.FALSE;
  
  public static synchronized DAServerManager getInstance()
  {
    if (instance == null) {
      instance = new DAServerManager();
    }
    return instance;
  }
  
  public Socket getClientSocket()
  {
    return ideClientSocket;
  }
  
  public void reserveTraceApplication(String deviceName, String appID, String appName)
  {
    reservedTraceApplication = true;
    reservedDeviceName = deviceName;
    reservedApplicationID = appID;
    reservedApplicationName = appName;
  }
  
  public void run()
    throws IndexOutOfBoundsException
  {
    if (!checkInstalledTizenSDK()) {
      DALog.printLog("failed - Tizen SDK is not installed ");
    } else {
      for (;;)
      {
        resetSocket();
        
        DALog.printLog(" Start IDE");
        while (!checkDASingleton())
        {
          DALog.printLog(" Waiting DA Connect");
          try
          {
            Thread.sleep(1000L);
          }
          catch (InterruptedException e)
          {
            e.printStackTrace();
          }
        }
        if (!readActiveServerPort())
        {
          System.out.println("Failed Read Active IDE Port");
        }
        else if (!setServerSocket())
        {
          System.out.println("Failed Connect IDE Socket");
        }
        else
        {
          DALog.printLog("Connected DA");
          
          checkReservedTraceApplication();
          
          waitingDataReceive();
          
          DALog.printLog("Disconneced DA");
          resetSocket();
        }
      }
    }
  }
  
  public static boolean checkDASingleton()
  {
    boolean isActiveDA = false;
    StringBuffer savePath = new StringBuffer();
    savePath.append(InstallPathConfig.getUserDataPath())
      .append(File.separatorChar).append("dynamic-analyzer")
      .append(File.separatorChar).append("save")
      .append(File.separatorChar);
    
    File folder = new File(savePath.toString());
    if (!folder.exists()) {
      folder.mkdirs();
    }
    savePath.append("active_da_plugin");
    
    FileLock fileLock = null;
    FileChannel fchannel = null;
    
    File file = new File(savePath.toString());
    try
    {
      fchannel = new RandomAccessFile(file, "rw").getChannel();
    }
    catch (FileNotFoundException e1)
    {
      e1.printStackTrace();
    }
    try
    {
      fileLock = fchannel.tryLock();
    }
    catch (IOException e)
    {
      e.printStackTrace();
    }
    if (fileLock == null)
    {
      isActiveDA = true;
    }
    else
    {
      isActiveDA = false;
      if (fchannel != null) {
        try
        {
          fchannel.close();
        }
        catch (IOException e)
        {
          e.printStackTrace();
        }
      }
    }
    return isActiveDA;
  }
  
  private boolean checkInstalledTizenSDK()
  {
    String installPath = InstallPathConfig.getUserDataPath();
    File logs = new File(installPath.toString());
    if (!logs.exists()) {
      return false;
    }
    return true;
  }
  
  private void checkReservedTraceApplication()
  {
    if (reservedTraceApplication)
    {
      reservedTraceApplication = false;
      runTraceApplication(reservedDeviceName, reservedApplicationID, 
        reservedApplicationName);
    }
  }
  
  private void waitingDataReceive()
  {
    int dataSize = 0;
    try
    {
      InputStream in = ideClientSocket.getInputStream();
      for (;;)
      {
        byte[] arr = new byte['?'];
        
        dataSize = in.read(arr);
        if (dataSize <= 0) {
          break;
        }
        String msg = new String(arr);
        commandReceiveMessage(msg);
        arr = (byte[])null;
      }
    }
    catch (IOException localIOException)
    {
      DALog.printLog("DAServerManager - waitingDataReceive - IOException");
    }
  }
  
  public String getPortFile()
  {
    StringBuffer savePath = new StringBuffer();
    savePath.append(InstallPathConfig.getUserDataPath())
      .append(File.separatorChar).append("dynamic-analyzer")
      .append(File.separatorChar).append("save");
    
    File logs = new File(savePath.toString());
    if (!logs.exists()) {
      logs.mkdirs();
    }
    savePath.append(File.separatorChar).append("current_active_ide_port");
    return savePath.toString();
  }
  
  /* Error */
  private boolean readActiveServerPort()
  {
    // Byte code:
    //   0: iconst_1
    //   1: istore_1
    //   2: aconst_null
    //   3: astore_2
    //   4: aconst_null
    //   5: astore_3
    //   6: new 295	java/io/FileInputStream
    //   9: dup
    //   10: aload_0
    //   11: invokevirtual 297	org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager:getPortFile	()Ljava/lang/String;
    //   14: invokespecial 299	java/io/FileInputStream:<init>	(Ljava/lang/String;)V
    //   17: astore_2
    //   18: new 300	java/io/DataInputStream
    //   21: dup
    //   22: aload_2
    //   23: invokespecial 302	java/io/DataInputStream:<init>	(Ljava/io/InputStream;)V
    //   26: astore_3
    //   27: aload_0
    //   28: aload_3
    //   29: invokevirtual 305	java/io/DataInputStream:readInt	()I
    //   32: putfield 81	org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager:serverPort	I
    //   35: goto +92 -> 127
    //   38: astore 4
    //   40: aload 4
    //   42: invokevirtual 238	java/io/IOException:printStackTrace	()V
    //   45: iconst_0
    //   46: istore_1
    //   47: goto +80 -> 127
    //   50: astore 4
    //   52: aload 4
    //   54: invokevirtual 229	java/io/FileNotFoundException:printStackTrace	()V
    //   57: iconst_0
    //   58: istore_1
    //   59: aload_2
    //   60: ifnull +9 -> 69
    //   63: aload_2
    //   64: invokevirtual 309	java/io/FileInputStream:close	()V
    //   67: aconst_null
    //   68: astore_2
    //   69: aload_3
    //   70: ifnull +87 -> 157
    //   73: aload_3
    //   74: invokevirtual 310	java/io/DataInputStream:close	()V
    //   77: aconst_null
    //   78: astore_3
    //   79: goto +78 -> 157
    //   82: astore 6
    //   84: aload 6
    //   86: invokevirtual 238	java/io/IOException:printStackTrace	()V
    //   89: goto +68 -> 157
    //   92: astore 5
    //   94: aload_2
    //   95: ifnull +9 -> 104
    //   98: aload_2
    //   99: invokevirtual 309	java/io/FileInputStream:close	()V
    //   102: aconst_null
    //   103: astore_2
    //   104: aload_3
    //   105: ifnull +19 -> 124
    //   108: aload_3
    //   109: invokevirtual 310	java/io/DataInputStream:close	()V
    //   112: aconst_null
    //   113: astore_3
    //   114: goto +10 -> 124
    //   117: astore 6
    //   119: aload 6
    //   121: invokevirtual 238	java/io/IOException:printStackTrace	()V
    //   124: aload 5
    //   126: athrow
    //   127: aload_2
    //   128: ifnull +9 -> 137
    //   131: aload_2
    //   132: invokevirtual 309	java/io/FileInputStream:close	()V
    //   135: aconst_null
    //   136: astore_2
    //   137: aload_3
    //   138: ifnull +19 -> 157
    //   141: aload_3
    //   142: invokevirtual 310	java/io/DataInputStream:close	()V
    //   145: aconst_null
    //   146: astore_3
    //   147: goto +10 -> 157
    //   150: astore 6
    //   152: aload 6
    //   154: invokevirtual 238	java/io/IOException:printStackTrace	()V
    //   157: iload_1
    //   158: ireturn
    // Line number table:
    //   Java source line #252	-> byte code offset #0
    //   Java source line #254	-> byte code offset #2
    //   Java source line #255	-> byte code offset #4
    //   Java source line #257	-> byte code offset #6
    //   Java source line #258	-> byte code offset #18
    //   Java source line #260	-> byte code offset #27
    //   Java source line #261	-> byte code offset #38
    //   Java source line #262	-> byte code offset #40
    //   Java source line #263	-> byte code offset #45
    //   Java source line #265	-> byte code offset #50
    //   Java source line #266	-> byte code offset #52
    //   Java source line #267	-> byte code offset #57
    //   Java source line #270	-> byte code offset #59
    //   Java source line #271	-> byte code offset #63
    //   Java source line #272	-> byte code offset #67
    //   Java source line #274	-> byte code offset #69
    //   Java source line #275	-> byte code offset #73
    //   Java source line #276	-> byte code offset #77
    //   Java source line #278	-> byte code offset #82
    //   Java source line #280	-> byte code offset #84
    //   Java source line #268	-> byte code offset #92
    //   Java source line #270	-> byte code offset #94
    //   Java source line #271	-> byte code offset #98
    //   Java source line #272	-> byte code offset #102
    //   Java source line #274	-> byte code offset #104
    //   Java source line #275	-> byte code offset #108
    //   Java source line #276	-> byte code offset #112
    //   Java source line #278	-> byte code offset #117
    //   Java source line #280	-> byte code offset #119
    //   Java source line #283	-> byte code offset #124
    //   Java source line #270	-> byte code offset #127
    //   Java source line #271	-> byte code offset #131
    //   Java source line #272	-> byte code offset #135
    //   Java source line #274	-> byte code offset #137
    //   Java source line #275	-> byte code offset #141
    //   Java source line #276	-> byte code offset #145
    //   Java source line #278	-> byte code offset #150
    //   Java source line #280	-> byte code offset #152
    //   Java source line #284	-> byte code offset #157
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	159	0	this	DAServerManager
    //   1	157	1	bSuccess	boolean
    //   3	134	2	fis	java.io.FileInputStream
    //   5	142	3	dis	java.io.DataInputStream
    //   38	3	4	e	IOException
    //   50	3	4	e	FileNotFoundException
    //   92	33	5	localObject	Object
    //   82	3	6	e	IOException
    //   117	3	6	e	IOException
    //   150	3	6	e	IOException
    // Exception table:
    //   from	to	target	type
    //   27	35	38	java/io/IOException
    //   6	47	50	java/io/FileNotFoundException
    //   59	79	82	java/io/IOException
    //   6	59	92	finally
    //   94	114	117	java/io/IOException
    //   127	147	150	java/io/IOException
  }
  
  private boolean setServerSocket()
  {
    try
    {
      ideClientSocket = new Socket("127.0.0.1", serverPort);
    }
    catch (UnknownHostException e)
    {
      e.printStackTrace();
      ideClientSocket = null;
      return false;
    }
    catch (IOException e)
    {
      e.printStackTrace();
      ideClientSocket = null;
      return false;
    }
    return true;
  }
  
  public boolean sendDAStatusMessage()
  {
    setRecvDAReadyStatus(false);
    StringBuffer command = new StringBuffer();
    command.append("STATUS")
      .append("`,")
      .append("").append("`,")
      .append("");
    try
    {
      sendData(command.toString());
    }
    catch (IOException localIOException)
    {
      DALog.printLog("DAServerManager - sendDAStatusMessage - IOException");
      DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, 
        Labels.MESSAGE_FAIL_TO_LAUNCH_PROJECT);
    }
    synchronized (getRecvDAReadyStatus())
    {
      try
      {
        getRecvDAReadyStatus().wait(10000L);
      }
      catch (InterruptedException e)
      {
        DALog.printLog("DAServerManager - sendDAStatusMessage - getRecvDAReadyStatus().wait(10000)");
        
        e.printStackTrace();
      }
    }
    return getRecvDAReadyStatus().booleanValue();
  }
  
  public void runTraceApplication(String strDevice, String appID, String appName)
  {
    StringBuffer command = new StringBuffer();
    command.append("RUN")
      .append("`,").append(strDevice)
      .append("`,").append(appID)
      .append("`,").append(appName);
    try
    {
      sendData(command.toString());
    }
    catch (IOException localIOException)
    {
      DALog.printLog("DAServerManager - runTraceApplication - IOException");
      DALog.dlgErrorMessage(Labels.MESSAGE_ERROR, 
        Labels.MESSAGE_FAIL_TO_LAUNCH_PROJECT);
    }
  }
  
  private void commandReceiveMessage(String msg)
  {
    DALog.printLog("commandReceiveMessage : " + msg);
    String[] msgArray = msg.split("`,");
    int size = msgArray.length;
    if (size == 3)
    {
      if (msgArray[0].equals("STATUS")) {
        setDAStatus(msgArray);
      } else if (msgArray[0].equals("SOURCE")) {
        viewSouceLine(msgArray);
      } else {
        DALog.printLog("receive message is not valid type");
      }
    }
    else {
      DALog.printLog("receive message is not valid ");
    }
  }
  
  private void setDAStatus(String[] msgArray)
  {
    if (msgArray[1].equals("record")) {
      setRecvDAReadyStatus(false);
    } else if (msgArray[1].equals("stop")) {
      setRecvDAReadyStatus(true);
    } else {
      DALog.printLog("receive message is not valid");
    }
    synchronized (getRecvDAReadyStatus())
    {
      getRecvDAReadyStatus().notify();
    }
  }
  
  private void viewSouceLine(String[] msgArray)
  {
    String srcpath = msgArray[1];
    String strSourceLine = msgArray[2].trim();
    int nline = Integer.parseInt(strSourceLine);
    Thread thread = new Thread(new OpenEditManager(srcpath, nline));
    if (thread != null) {
      PlatformUI.getWorkbench().getDisplay().asyncExec(thread);
    }
  }
  
  /* Error */
  private boolean sendData(String msg)
    throws IOException
  {
    // Byte code:
    //   0: new 370	java/lang/StringBuilder
    //   3: dup
    //   4: ldc_w 444
    //   7: invokespecial 374	java/lang/StringBuilder:<init>	(Ljava/lang/String;)V
    //   10: aload_1
    //   11: invokevirtual 375	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   14: invokevirtual 378	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   17: invokestatic 125	org/tizen/dynamicanalysis/ide/eplugin/DALog:printLog	(Ljava/lang/String;)V
    //   20: iconst_1
    //   21: istore_2
    //   22: aload_0
    //   23: getfield 77	org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager:ideClientSocket	Ljava/net/Socket;
    //   26: ifnull +59 -> 85
    //   29: aload_0
    //   30: new 446	java/io/BufferedWriter
    //   33: dup
    //   34: new 448	java/io/OutputStreamWriter
    //   37: dup
    //   38: aload_0
    //   39: getfield 77	org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager:ideClientSocket	Ljava/net/Socket;
    //   42: invokevirtual 450	java/net/Socket:getOutputStream	()Ljava/io/OutputStream;
    //   45: invokespecial 454	java/io/OutputStreamWriter:<init>	(Ljava/io/OutputStream;)V
    //   48: invokespecial 457	java/io/BufferedWriter:<init>	(Ljava/io/Writer;)V
    //   51: putfield 79	org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager:writer	Ljava/io/BufferedWriter;
    //   54: aload_0
    //   55: getfield 79	org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager:writer	Ljava/io/BufferedWriter;
    //   58: aload_1
    //   59: invokevirtual 460	java/io/BufferedWriter:write	(Ljava/lang/String;)V
    //   62: aload_0
    //   63: getfield 79	org/tizen/dynamicanalysis/ide/eplugin/communication/DAServerManager:writer	Ljava/io/BufferedWriter;
    //   66: invokevirtual 463	java/io/BufferedWriter:flush	()V
    //   69: goto +16 -> 85
    //   72: pop
    //   73: iconst_0
    //   74: istore_2
    //   75: iconst_0
    //   76: istore_2
    //   77: goto +10 -> 87
    //   80: astore_3
    //   81: iconst_0
    //   82: istore_2
    //   83: aload_3
    //   84: athrow
    //   85: iconst_0
    //   86: istore_2
    //   87: iload_2
    //   88: ireturn
    // Line number table:
    //   Java source line #389	-> byte code offset #0
    //   Java source line #390	-> byte code offset #20
    //   Java source line #392	-> byte code offset #22
    //   Java source line #393	-> byte code offset #29
    //   Java source line #394	-> byte code offset #38
    //   Java source line #393	-> byte code offset #51
    //   Java source line #395	-> byte code offset #54
    //   Java source line #396	-> byte code offset #62
    //   Java source line #398	-> byte code offset #72
    //   Java source line #399	-> byte code offset #73
    //   Java source line #401	-> byte code offset #75
    //   Java source line #400	-> byte code offset #80
    //   Java source line #401	-> byte code offset #81
    //   Java source line #402	-> byte code offset #83
    //   Java source line #401	-> byte code offset #85
    //   Java source line #403	-> byte code offset #87
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	89	0	this	DAServerManager
    //   0	89	1	msg	String
    //   21	67	2	bSuccess	boolean
    //   80	4	3	localObject	Object
    //   72	1	4	localIOException	IOException
    // Exception table:
    //   from	to	target	type
    //   22	69	72	java/io/IOException
    //   22	75	80	finally
  }
  
  private void resetSocket()
  {
    ideClientSocket = null;
    writer = null;
    if (ideClientSocket != null) {
      try
      {
        ideClientSocket.close();
        ideClientSocket = null;
      }
      catch (IOException e)
      {
        e.printStackTrace();
      }
    }
  }
  
  public Boolean getRecvDAReadyStatus()
  {
    return recvDAReadyStatus;
  }
  
  public void setRecvDAReadyStatus(boolean status)
  {
    if (status) {
      recvDAReadyStatus = Boolean.TRUE;
    } else {
      recvDAReadyStatus = Boolean.FALSE;
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.dynamicanalysis.ide.eplugin.communication.DAServerManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.dynamicanalysis.ide.eplugin.communication;

import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.common.util.OSChecker;
import org.tizen.dynamicanalysis.ide.eplugin.DALog;

public class FocusManager
  extends Thread
{
  private String[] cmds;
  private int selfPid;
  
  public FocusManager()
  {
    selfPid = -1;
  }
  
  public FocusManager(int iPid)
  {
    selfPid = iPid;
  }
  
  public void run()
  {
    String pid = "";
    String Processid = "";
    if (selfPid > 0)
    {
      pid = String.valueOf(selfPid);
    }
    else
    {
      ManagementFactory.getRuntimeMXBean();
      RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean();
      Processid = rt.getName();
      pid = Processid.substring(0, Processid.indexOf("@"));
    }
    cmds = new String[] { getDynAnalyzerPath(), pid };
    executeCommand(cmds);
  }
  
  private String getDynAnalyzerPath()
  {
    String path = "";
    if (OSChecker.isWindows()) {
      path = InstallPathConfig.getSDKPath() + "/tools/dynamic-analyzer/tool/windowactivator.bat";
    } else if (OSChecker.isMAC()) {
      path = InstallPathConfig.getSDKPath() + "/tools/dynamic-analyzer/tool/macoswindowactivator.sh";
    } else {
      path = InstallPathConfig.getSDKPath() + "/tools/dynamic-analyzer/tool/windowactivator.sh";
    }
    DALog.printLog("activator : " + path);
    return path;
  }
  
  /* Error */
  private int executeCommand(String[] cmds)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_2
    //   2: aconst_null
    //   3: astore_3
    //   4: iconst_0
    //   5: istore 4
    //   7: aload_1
    //   8: arraylength
    //   9: ifne +9 -> 18
    //   12: iconst_m1
    //   13: istore 4
    //   15: goto +78 -> 93
    //   18: invokestatic 111	java/lang/Runtime:getRuntime	()Ljava/lang/Runtime;
    //   21: astore_2
    //   22: aload_2
    //   23: aload_1
    //   24: invokevirtual 117	java/lang/Runtime:exec	([Ljava/lang/String;)Ljava/lang/Process;
    //   27: astore_3
    //   28: aload_3
    //   29: ifnull +64 -> 93
    //   32: aload_3
    //   33: invokevirtual 121	java/lang/Process:waitFor	()I
    //   36: pop
    //   37: aload_3
    //   38: invokevirtual 127	java/lang/Process:exitValue	()I
    //   41: istore 4
    //   43: goto +50 -> 93
    //   46: pop
    //   47: ldc -126
    //   49: invokestatic 105	org/tizen/dynamicanalysis/ide/eplugin/DALog:printLog	(Ljava/lang/String;)V
    //   52: aload_3
    //   53: ifnull +48 -> 101
    //   56: aload_3
    //   57: invokevirtual 132	java/lang/Process:destroy	()V
    //   60: goto +41 -> 101
    //   63: pop
    //   64: ldc -121
    //   66: invokestatic 105	org/tizen/dynamicanalysis/ide/eplugin/DALog:printLog	(Ljava/lang/String;)V
    //   69: aload_3
    //   70: ifnull +31 -> 101
    //   73: aload_3
    //   74: invokevirtual 132	java/lang/Process:destroy	()V
    //   77: goto +24 -> 101
    //   80: astore 5
    //   82: aload_3
    //   83: ifnull +7 -> 90
    //   86: aload_3
    //   87: invokevirtual 132	java/lang/Process:destroy	()V
    //   90: aload 5
    //   92: athrow
    //   93: aload_3
    //   94: ifnull +7 -> 101
    //   97: aload_3
    //   98: invokevirtual 132	java/lang/Process:destroy	()V
    //   101: iload 4
    //   103: ireturn
    // Line number table:
    //   Java source line #83	-> byte code offset #0
    //   Java source line #84	-> byte code offset #2
    //   Java source line #85	-> byte code offset #4
    //   Java source line #88	-> byte code offset #7
    //   Java source line #89	-> byte code offset #12
    //   Java source line #91	-> byte code offset #18
    //   Java source line #92	-> byte code offset #22
    //   Java source line #94	-> byte code offset #28
    //   Java source line #95	-> byte code offset #32
    //   Java source line #96	-> byte code offset #37
    //   Java source line #99	-> byte code offset #46
    //   Java source line #100	-> byte code offset #47
    //   Java source line #104	-> byte code offset #52
    //   Java source line #105	-> byte code offset #56
    //   Java source line #101	-> byte code offset #63
    //   Java source line #102	-> byte code offset #64
    //   Java source line #104	-> byte code offset #69
    //   Java source line #105	-> byte code offset #73
    //   Java source line #103	-> byte code offset #80
    //   Java source line #104	-> byte code offset #82
    //   Java source line #105	-> byte code offset #86
    //   Java source line #107	-> byte code offset #90
    //   Java source line #104	-> byte code offset #93
    //   Java source line #105	-> byte code offset #97
    //   Java source line #108	-> byte code offset #101
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	104	0	this	FocusManager
    //   0	104	1	cmds	String[]
    //   1	22	2	runtime	Runtime
    //   3	95	3	process	Process
    //   5	97	4	retValue	int
    //   80	11	5	localObject	Object
    //   46	1	6	localIOException	java.io.IOException
    //   63	1	7	localInterruptedException	InterruptedException
    // Exception table:
    //   from	to	target	type
    //   7	43	46	java/io/IOException
    //   7	43	63	java/lang/InterruptedException
    //   7	52	80	finally
    //   63	69	80	finally
  }
}

/* Location:
 * Qualified Name:     org.tizen.dynamicanalysis.ide.eplugin.communication.FocusManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.dynamicanalysis.ide.eplugin.communication;

import java.io.File;
import java.io.IOException;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
import org.tizen.dynamicanalysis.ide.eplugin.DALog;

public class OpenEditManager
  implements Runnable
{
  private ITextEditor _editor;
  private IDocument _document;
  private String filepath;
  private int fileline;
  
  public OpenEditManager(String path, int line)
  {
    filepath = path;
    fileline = line;
  }
  
  private void initEditor(String path)
    throws IOException
  {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IFile ifile = root.getFile(new Path(path));
    IEditorPart part = null;
    if (!ifile.exists())
    {
      File targetfile = new File(path);
      if ((targetfile.exists()) && (targetfile.isFile()))
      {
        IFileStore filestore = EFS.getLocalFileSystem().getStore(targetfile.toURI());
        part = openEditor(filestore);
      }
      else
      {
        throw new IOException("Source file (" + path + ") is not found.");
      }
    }
    else
    {
      part = openEditor(ifile);
    }
    if ((part != null) && ((part instanceof ITextEditor)))
    {
      _editor = ((ITextEditor)part);
      IDocumentProvider provider = _editor.getDocumentProvider();
      _document = provider.getDocument(_editor.getEditorInput());
    }
  }
  
  private IEditorPart openEditor(IFile ifile)
  {
    IWorkbenchPage page = PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getActivePage();
    try
    {
      IDE.openEditor(page, ifile);
    }
    catch (PartInitException localPartInitException)
    {
      DALog.printLog("OpenEditManager - openEditor - PartInitException");
    }
    return page.getActiveEditor();
  }
  
  private IEditorPart openEditor(IFileStore ifilestr)
  {
    IWorkbenchPage page = PlatformUI.getWorkbench()
      .getActiveWorkbenchWindow().getActivePage();
    try
    {
      IDE.openEditorOnFileStore(page, ifilestr);
    }
    catch (PartInitException localPartInitException)
    {
      DALog.printLog("OpenEditManager - openEditor - PartInitException");
    }
    return page.getActiveEditor();
  }
  
  private ITextEditor getEditor()
  {
    return _editor;
  }
  
  public void run()
  {
    try
    {
      initEditor(filepath);
      int offset;
      int offset;
      if (fileline > 0) {
        offset = _document.getLineOffset(fileline - 1);
      } else {
        offset = 0;
      }
      getEditor().setHighlightRange(offset, 0, true);
      
      FocusManager fm = new FocusManager();
      fm.start();
    }
    catch (IOException localIOException)
    {
      DALog.printLog("OpenEditManager - run - IOException");
    }
    catch (BadLocationException localBadLocationException)
    {
      DALog.printLog("OpenEditManager - run - BadLocationException");
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.dynamicanalysis.ide.eplugin.communication.OpenEditManager
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.dynamicanalysis.ide.eplugin.communication;

import org.eclipse.ui.IStartup;

public class ServerStartup
  implements IStartup
{
  private static DAServerManager server;
  
  public void earlyStartup()
  {
    server = DAServerManager.getInstance();
    Thread thread = server;
    thread.start();
  }
  
  public static void stopServeThread()
  {
    server.interrupt();
  }
}

/* Location:
 * Qualified Name:     org.tizen.dynamicanalysis.ide.eplugin.communication.ServerStartup
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.dynamicanalysis.ide.eplugin.launch;

import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
import org.tizen.dynamicanalysis.ide.eplugin.Activator;
import org.tizen.nativecommon.build.ui.IPlatformChangedListener;

public class DynamicOptionValueHandler
  implements IManagedOptionValueHandler
{
  public boolean handleValue(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument, int event)
  {
    IConfiguration config = null;
    if ((event != 1) && 
      (event != 4) && 
      (event != 3)) {
      return false;
    }
    if ((configuration instanceof FolderInfo)) {
      return false;
    }
    config = (IConfiguration)configuration;
    
    Activator.listner.platformChanged(config);
    
    return false;
  }
  
  public boolean isDefaultValue(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument)
  {
    return false;
  }
  
  public boolean isEnumValueAppropriate(IBuildObject configuration, IHoldsOptions holder, IOption option, String extraArgument, String enumValue)
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.tizen.dynamicanalysis.ide.eplugin.launch.DynamicOptionValueHandler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.dynamicanalysis.ide.eplugin.launch;

import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.tizen.nativecommon.build.CommonConfigurationManager;
import org.tizen.nativecommon.build.ui.IPlatformChangedListener;

public class PlatformChangingHandler
  implements IPlatformChangedListener
{
  private String configName = "";
  
  public PlatformChangingHandler() {}
  
  public PlatformChangingHandler(String c)
  {
    configName = c;
  }
  
  public String getConfigName()
  {
    return configName;
  }
  
  public void platformChanged(IConfiguration config)
  {
    String linklib = "daprobe";
    String customchartSymbol = "_USE_DA_";
    String libPath = "\"${SDK_INSTALL_PATH}/library/da";
    String deviceLibPath = libPath + "/arm\"";
    String emulatorLibPath = libPath + "/x86\"";
    
    String targetStr 
1 2 3

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