org.eclipse.cdt.core.win32_5.2.0.201202111925

16:41:37.557 INFO  jd.cli.Main - Decompiling org.eclipse.cdt.core.win32_5.2.0.201202111925.jar
package org.eclipse.cdt.internal.core.win32;

import org.eclipse.cdt.core.IProcessInfo;

public class ProcessInfo
  implements IProcessInfo
{
  int pid;
  String name;
  
  public ProcessInfo(String pidString, String name)
  {
    try
    {
      pid = Integer.parseInt(pidString);
    }
    catch (NumberFormatException localNumberFormatException) {}
    this.name = name;
  }
  
  public ProcessInfo(int pid, String name)
  {
    this.pid = pid;
    this.name = name;
  }
  
  public String getName()
  {
    return name;
  }
  
  public int getPid()
  {
    return pid;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.internal.core.win32.ProcessInfo
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.internal.core.win32;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import org.eclipse.cdt.core.IProcessInfo;
import org.eclipse.cdt.core.IProcessList;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;

public class ProcessList
  implements IProcessList
{
  private IProcessInfo[] NOPROCESS = new IProcessInfo[0];
  
  public IProcessInfo[] getProcessList()
  {
    Process p = null;
    String command = null;
    InputStream in = null;
    Bundle bundle = Platform.getBundle("org.eclipse.cdt.core");
    IProcessInfo[] procInfos = NOPROCESS;
    try
    {
      URL url = FileLocator.find(bundle, new Path("$os$/listtasks.exe"), null);
      if (url != null)
      {
        url = FileLocator.resolve(url);
        String path = url.getFile();
        File file = new File(path);
        if (file.exists())
        {
          command = file.getCanonicalPath();
          if (command != null) {
            try
            {
              p = ProcessFactory.getFactory().exec(command);
              in = p.getInputStream();
              InputStreamReader reader = new InputStreamReader(in);
              procInfos = parseListTasks(reader);
            }
            finally
            {
              if (in != null) {
                in.close();
              }
              if (p != null) {
                p.destroy();
              }
            }
          }
        }
      }
    }
    catch (IOException localIOException) {}
    return procInfos;
  }
  
  public IProcessInfo[] parseListTasks(InputStreamReader reader)
  {
    BufferedReader br = new BufferedReader(reader);
    ArrayList processList = new ArrayList();
    try
    {
      String line;
      while ((line = br.readLine()) != null)
      {
        String line;
        int tab = line.indexOf('\t');
        if (tab != -1)
        {
          String proc = line.substring(0, tab).trim();
          String name = line.substring(tab).trim();
          if ((proc.length() > 0) && (name.length() > 0)) {
            try
            {
              int pid = Integer.parseInt(proc);
              processList.add(new ProcessInfo(pid, name));
            }
            catch (NumberFormatException localNumberFormatException) {}
          }
        }
      }
    }
    catch (IOException localIOException) {}
    return (IProcessInfo[])processList.toArray(new IProcessInfo[processList.size()]);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.internal.core.win32.ProcessList
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
1

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-2019. Infinite Loop Ltd