ddms

16:35:02.652 INFO  jd.cli.Main - Decompiling ddms.jar
package com.android.ddms;

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

class AboutDialog$1
  extends SelectionAdapter
{
  AboutDialog$1(AboutDialog paramAboutDialog, Shell paramShell) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    val$shell.close();
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.AboutDialog.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.Log;
import com.android.ddmuilib.ImageLoader;
import java.io.InputStream;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class AboutDialog
  extends Dialog
{
  private Image logoImage;
  
  public AboutDialog(Shell parent)
  {
    this(parent, 67680);
  }
  
  public AboutDialog(Shell parent, int style)
  {
    super(parent, style);
  }
  
  public void open()
  {
    Shell parent = getParent();
    Shell shell = new Shell(parent, getStyle());
    shell.setText("About...");
    
    logoImage = loadImage(shell, "ddms-128.png");
    createContents(shell);
    shell.pack();
    
    shell.open();
    Display display = parent.getDisplay();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    logoImage.dispose();
  }
  
  private Image loadImage(Shell shell, String fileName)
  {
    String pathName = "/images/" + fileName;
    
    InputStream imageStream = getClass().getResourceAsStream(pathName);
    if (imageStream == null)
    {
      Log.w("ddms", "Couldn't load " + pathName);
      Display display = shell.getDisplay();
      return ImageLoader.createPlaceHolderArt(display, 100, 50, display.getSystemColor(9));
    }
    Image img = new Image(shell.getDisplay(), imageStream);
    if (img == null) {
      throw new NullPointerException("couldn't load " + pathName);
    }
    return img;
  }
  
  private void createContents(final Shell shell)
  {
    shell.setLayout(new GridLayout(2, false));
    
    Label logo = new Label(shell, 2048);
    logo.setImage(logoImage);
    
    Composite textArea = new Composite(shell, 0);
    GridLayout layout = new GridLayout(1, true);
    textArea.setLayout(layout);
    
    Label label = new Label(textArea, 0);
    if ((Main.sRevision != null) && (Main.sRevision.length() > 0)) {
      label.setText("Dalvik Debug Monitor Revision " + Main.sRevision);
    } else {
      label.setText("Dalvik Debug Monitor");
    }
    label = new Label(textArea, 0);
    
    label.setText("Copyright 2007-2012, The Android Open Source Project");
    label = new Label(textArea, 0);
    label.setText("All Rights Reserved.");
    
    label = new Label(shell, 0);
    
    Button ok = new Button(shell, 8);
    ok.setText("OK");
    GridData data = new GridData(128);
    widthHint = 80;
    ok.setLayoutData(data);
    ok.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        shell.close();
      }
    });
    shell.pack();
    
    shell.setDefaultButton(ok);
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.AboutDialog
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.DebugPortManager.IDebugPortProvider;
import com.android.ddmlib.IDevice;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.eclipse.jface.preference.IPreferenceStore;

public class DebugPortProvider
  implements DebugPortManager.IDebugPortProvider
{
  private static DebugPortProvider sThis = new DebugPortProvider();
  public static final String PREFS_STATIC_PORT_LIST = "android.staticPortList";
  private Map<String, Map<String, Integer>> mMap;
  
  public static DebugPortProvider getInstance()
  {
    return sThis;
  }
  
  private DebugPortProvider()
  {
    computePortList();
  }
  
  public int getPort(IDevice device, String appName)
  {
    if (mMap != null)
    {
      Map<String, Integer> deviceMap = (Map)mMap.get(device.getSerialNumber());
      if (deviceMap != null)
      {
        Integer i = (Integer)deviceMap.get(appName);
        if (i != null) {
          return i.intValue();
        }
      }
    }
    return -1;
  }
  
  public Map<String, Map<String, Integer>> getPortList()
  {
    return mMap;
  }
  
  private void computePortList()
  {
    mMap = new HashMap();
    
    IPreferenceStore store = PrefsDialog.getStore();
    String value = store.getString("android.staticPortList");
    if ((value != null) && (value.length() > 0))
    {
      String[] portSegments = value.split("\\|");
      for (String seg : portSegments)
      {
        String[] entry = seg.split(":");
        
        String deviceName = null;
        if (entry.length == 3) {
          deviceName = entry[2];
        } else {
          deviceName = "emulator-5554";
        }
        Map<String, Integer> deviceMap = (Map)mMap.get(deviceName);
        if (deviceMap == null)
        {
          deviceMap = new HashMap();
          mMap.put(deviceName, deviceMap);
        }
        deviceMap.put(entry[0], Integer.valueOf(entry[1]));
      }
    }
  }
  
  public void setPortList(Map<String, Map<String, Integer>> map)
  {
    mMap.clear();
    mMap.putAll(map);
    
    StringBuilder sb = new StringBuilder();
    
    Set<String> deviceKeys = map.keySet();
    for (Iterator i$ = deviceKeys.iterator(); i$.hasNext();)
    {
      deviceKey = (String)i$.next();
      deviceMap = (Map)map.get(deviceKey);
      if (deviceMap != null)
      {
        Set<String> appKeys = deviceMap.keySet();
        for (String appKey : appKeys)
        {
          Integer port = (Integer)deviceMap.get(appKey);
          if (port != null) {
            sb.append(appKey).append(':').append(port.intValue()).append(':').append(deviceKey).append('|');
          }
        }
      }
    }
    String deviceKey;
    Map<String, Integer> deviceMap;
    String value = sb.toString();
    
    IPreferenceStore store = PrefsDialog.getStore();
    
    store.setValue("android.staticPortList", value);
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DebugPortProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.Log;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class DeviceCommandDialog$1
  implements Listener
{
  DeviceCommandDialog$1(DeviceCommandDialog paramDeviceCommandDialog) {}
  
  public void handleEvent(Event event)
  {
    if (!DeviceCommandDialog.access$000(this$0))
    {
      Log.d("ddms", "NOT closing - cancelling command");
      doit = false;
      DeviceCommandDialog.access$102(this$0, true);
    }
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DeviceCommandDialog.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

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

class DeviceCommandDialog$2
  extends SelectionAdapter
{
  DeviceCommandDialog$2(DeviceCommandDialog paramDeviceCommandDialog, Shell paramShell) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    DeviceCommandDialog.access$200(this$0, val$shell);
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DeviceCommandDialog.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

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

class DeviceCommandDialog$3
  extends SelectionAdapter
{
  DeviceCommandDialog$3(DeviceCommandDialog paramDeviceCommandDialog, Shell paramShell) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    if (!DeviceCommandDialog.access$000(this$0)) {
      DeviceCommandDialog.access$102(this$0, true);
    } else {
      val$shell.close();
    }
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DeviceCommandDialog.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

class DeviceCommandDialog$Gatherer$1
  implements Runnable
{
  DeviceCommandDialog$Gatherer$1(DeviceCommandDialog.Gatherer paramGatherer) {}
  
  public void run()
  {
    DeviceCommandDialog.access$400(this$1.this$0, DeviceCommandDialog.Gatherer.access$300(this$1));
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DeviceCommandDialog.Gatherer.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import org.eclipse.swt.widgets.Text;

class DeviceCommandDialog$Gatherer$2
  implements Runnable
{
  DeviceCommandDialog$Gatherer$2(DeviceCommandDialog.Gatherer paramGatherer, String paramString) {}
  
  public void run()
  {
    DeviceCommandDialog.Gatherer.access$500(this$1).append(val$text);
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DeviceCommandDialog.Gatherer.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.AdbCommandRejectedException;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.IShellOutputReceiver;
import com.android.ddmlib.Log;
import com.android.ddmlib.ShellCommandUnresponsiveException;
import com.android.ddmlib.TimeoutException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

class DeviceCommandDialog$Gatherer
  extends Thread
  implements IShellOutputReceiver
{
  public static final int RESULT_UNKNOWN = 0;
  public static final int RESULT_SUCCESS = 1;
  public static final int RESULT_FAILURE = 2;
  public static final int RESULT_CANCELLED = 3;
  private Shell mShell;
  private String mCommand;
  private Text mText;
  private int mResult;
  private IDevice mDevice;
  
  public DeviceCommandDialog$Gatherer(DeviceCommandDialog paramDeviceCommandDialog, Shell shell, IDevice device, String command, Text text)
  {
    mShell = shell;
    mDevice = device;
    mCommand = command;
    mText = text;
    mResult = 0;
    
    DeviceCommandDialog.access$102(paramDeviceCommandDialog, false);
  }
  
  public void run()
  {
    if (mDevice == null)
    {
      Log.w("ddms", "Cannot execute command: no device selected.");
      mResult = 2;
    }
    else
    {
      try
      {
        mDevice.executeShellCommand(mCommand, this);
        if (DeviceCommandDialog.access$100(this$0)) {
          mResult = 3;
        } else {
          mResult = 1;
        }
      }
      catch (IOException ioe)
      {
        Log.w("ddms", "Remote exec failed: " + ioe.getMessage());
        mResult = 2;
      }
      catch (TimeoutException e)
      {
        Log.w("ddms", "Remote exec failed: " + e.getMessage());
        mResult = 2;
      }
      catch (AdbCommandRejectedException e)
      {
        Log.w("ddms", "Remote exec failed: " + e.getMessage());
        mResult = 2;
      }
      catch (ShellCommandUnresponsiveException e)
      {
        Log.w("ddms", "Remote exec failed: " + e.getMessage());
        mResult = 2;
      }
    }
    mShell.getDisplay().asyncExec(new Runnable()
    {
      public void run()
      {
        DeviceCommandDialog.access$400(this$0, mResult);
      }
    });
  }
  
  public void addOutput(byte[] data, int offset, int length)
  {
    Log.v("ddms", "received " + length + " bytes");
    try
    {
      final String text = new String(data, offset, length, "ISO-8859-1");
      
      mText.getDisplay().asyncExec(new Runnable()
      {
        public void run()
        {
          mText.append(text);
        }
      });
    }
    catch (UnsupportedEncodingException uee)
    {
      uee.printStackTrace();
    }
  }
  
  public void flush() {}
  
  public boolean isCancelled()
  {
    return DeviceCommandDialog.access$100(this$0);
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DeviceCommandDialog.Gatherer
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.AdbCommandRejectedException;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.IShellOutputReceiver;
import com.android.ddmlib.Log;
import com.android.ddmlib.ShellCommandUnresponsiveException;
import com.android.ddmlib.TimeoutException;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class DeviceCommandDialog
  extends Dialog
{
  public static final int DEVICE_STATE = 0;
  public static final int APP_STATE = 1;
  public static final int RADIO_STATE = 2;
  public static final int LOGCAT = 3;
  private String mCommand;
  private String mFileName;
  private Label mStatusLabel;
  private Button mCancelDone;
  private Button mSave;
  private Text mText;
  private Font mFont = null;
  private boolean mCancel;
  private boolean mFinished;
  
  public DeviceCommandDialog(String command, String fileName, Shell parent)
  {
    this(command, fileName, parent, 67696);
  }
  
  public DeviceCommandDialog(String command, String fileName, Shell parent, int style)
  {
    super(parent, style);
    mCommand = command;
    mFileName = fileName;
  }
  
  public void open(IDevice currentDevice)
  {
    Shell parent = getParent();
    Shell shell = new Shell(parent, getStyle());
    shell.setText("Remote Command");
    
    mFinished = false;
    mFont = findFont(shell.getDisplay());
    createContents(shell);
    
    shell.setMinimumSize(500, 200);
    shell.setSize(800, 600);
    shell.open();
    
    executeCommand(shell, currentDevice);
    
    Display display = parent.getDisplay();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    if (mFont != null) {
      mFont.dispose();
    }
  }
  
  private void createContents(final Shell shell)
  {
    shell.setLayout(new GridLayout(2, true));
    
    shell.addListener(21, new Listener()
    {
      public void handleEvent(Event event)
      {
        if (!mFinished)
        {
          Log.d("ddms", "NOT closing - cancelling command");
          doit = false;
          mCancel = true;
        }
      }
    });
    mStatusLabel = new Label(shell, 0);
    mStatusLabel.setText("Executing '" + shortCommandString() + "'");
    GridData data = new GridData(32);
    horizontalSpan = 2;
    mStatusLabel.setLayoutData(data);
    
    mText = new Text(shell, 770);
    mText.setEditable(false);
    mText.setFont(mFont);
    data = new GridData(1808);
    horizontalSpan = 2;
    mText.setLayoutData(data);
    
    mSave = new Button(shell, 8);
    mSave.setText("Save");
    data = new GridData(64);
    widthHint = 80;
    mSave.setLayoutData(data);
    mSave.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        DeviceCommandDialog.this.saveText(shell);
      }
    });
    mSave.setEnabled(false);
    
    mCancelDone = new Button(shell, 8);
    mCancelDone.setText("Cancel");
    data = new GridData(64);
    widthHint = 80;
    mCancelDone.setLayoutData(data);
    mCancelDone.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        if (!mFinished) {
          mCancel = true;
        } else {
          shell.close();
        }
      }
    });
  }
  
  private Font findFont(Display display)
  {
    String fontStr = PrefsDialog.getStore().getString("textOutputFont");
    if (fontStr != null)
    {
      FontData fdat = new FontData(fontStr);
      if (fdat != null) {
        return new Font(display, fdat);
      }
    }
    return null;
  }
  
  class Gatherer
    extends Thread
    implements IShellOutputReceiver
  {
    public static final int RESULT_UNKNOWN = 0;
    public static final int RESULT_SUCCESS = 1;
    public static final int RESULT_FAILURE = 2;
    public static final int RESULT_CANCELLED = 3;
    private Shell mShell;
    private String mCommand;
    private Text mText;
    private int mResult;
    private IDevice mDevice;
    
    public Gatherer(Shell shell, IDevice device, String command, Text text)
    {
      mShell = shell;
      mDevice = device;
      mCommand = command;
      mText = text;
      mResult = 0;
      
      mCancel = false;
    }
    
    public void run()
    {
      if (mDevice == null)
      {
        Log.w("ddms", "Cannot execute command: no device selected.");
        mResult = 2;
      }
      else
      {
        try
        {
          mDevice.executeShellCommand(mCommand, this);
          if (mCancel) {
            mResult = 3;
          } else {
            mResult = 1;
          }
        }
        catch (IOException ioe)
        {
          Log.w("ddms", "Remote exec failed: " + ioe.getMessage());
          mResult = 2;
        }
        catch (TimeoutException e)
        {
          Log.w("ddms", "Remote exec failed: " + e.getMessage());
          mResult = 2;
        }
        catch (AdbCommandRejectedException e)
        {
          Log.w("ddms", "Remote exec failed: " + e.getMessage());
          mResult = 2;
        }
        catch (ShellCommandUnresponsiveException e)
        {
          Log.w("ddms", "Remote exec failed: " + e.getMessage());
          mResult = 2;
        }
      }
      mShell.getDisplay().asyncExec(new Runnable()
      {
        public void run()
        {
          DeviceCommandDialog.this.updateForResult(mResult);
        }
      });
    }
    
    public void addOutput(byte[] data, int offset, int length)
    {
      Log.v("ddms", "received " + length + " bytes");
      try
      {
        final String text = new String(data, offset, length, "ISO-8859-1");
        
        mText.getDisplay().asyncExec(new Runnable()
        {
          public void run()
          {
            mText.append(text);
          }
        });
      }
      catch (UnsupportedEncodingException uee)
      {
        uee.printStackTrace();
      }
    }
    
    public void flush() {}
    
    public boolean isCancelled()
    {
      return mCancel;
    }
  }
  
  private void executeCommand(Shell shell, IDevice device)
  {
    Gatherer gath = new Gatherer(shell, device, commandString(), mText);
    gath.start();
  }
  
  private void updateForResult(int result)
  {
    if (result == 1)
    {
      mStatusLabel.setText("Successfully executed '" + shortCommandString() + "'");
      
      mSave.setEnabled(true);
    }
    else if (result == 3)
    {
      mStatusLabel.setText("Execution cancelled; partial results below");
      mSave.setEnabled(true);
    }
    else if (result == 2)
    {
      mStatusLabel.setText("Failed");
    }
    mStatusLabel.pack();
    mCancelDone.setText("Done");
    mFinished = true;
  }
  
  private void saveText(Shell shell)
  {
    FileDialog dlg = new FileDialog(shell, 8192);
    
    dlg.setText("Save output...");
    dlg.setFileName(defaultFileName());
    dlg.setFilterPath(PrefsDialog.getStore().getString("lastTextSaveDir"));
    dlg.setFilterNames(new String[] { "Text Files (*.txt)" });
    
    dlg.setFilterExtensions(new String[] { "*.txt" });
    
    String fileName = dlg.open();
    if (fileName != null)
    {
      PrefsDialog.getStore().setValue("lastTextSaveDir", dlg.getFilterPath());
      
      Log.d("ddms", "Saving output to " + fileName);
      
      String text = mText.getText();
      byte[] ascii;
      try
      {
        ascii = text.getBytes("ISO-8859-1");
      }
      catch (UnsupportedEncodingException uee)
      {
        uee.printStackTrace();
        ascii = new byte[0];
      }
      try
      {
        int length = ascii.length;
        
        FileOutputStream outFile = new FileOutputStream(fileName);
        BufferedOutputStream out = new BufferedOutputStream(outFile);
        for (int i = 0; i < length; i++) {
          if ((i >= length - 1) || (ascii[i] != 13) || (ascii[(i + 1)] != 10)) {
            out.write(ascii[i]);
          }
        }
        out.close();
      }
      catch (IOException ioe)
      {
        Log.w("ddms", "Unable to save " + fileName + ": " + ioe);
      }
    }
  }
  
  private String commandString()
  {
    return mCommand;
  }
  
  private String defaultFileName()
  {
    return mFileName;
  }
  
  private String shortCommandString()
  {
    String str = commandString();
    if (str.length() > 50) {
      return str.substring(0, 50) + "...";
    }
    return str;
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DeviceCommandDialog
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.ToolItem;

class DropdownSelectionListener$1
  extends SelectionAdapter
{
  DropdownSelectionListener$1(DropdownSelectionListener paramDropdownSelectionListener) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    MenuItem sel = (MenuItem)widget;
    DropdownSelectionListener.access$000(this$0).setText(sel.getText());
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DropdownSelectionListener.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.Log;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;

public class DropdownSelectionListener
  extends SelectionAdapter
{
  private Menu mMenu;
  private ToolItem mDropdown;
  
  public DropdownSelectionListener(ToolItem item)
  {
    mDropdown = item;
    mMenu = new Menu(item.getParent().getShell(), 8);
  }
  
  public void add(String label)
  {
    MenuItem item = new MenuItem(mMenu, 0);
    item.setText(label);
    item.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        MenuItem sel = (MenuItem)widget;
        mDropdown.setText(sel.getText());
      }
    });
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    if (detail == 4)
    {
      ToolItem item = (ToolItem)widget;
      Rectangle rect = item.getBounds();
      Point pt = item.getParent().toDisplay(new Point(x, y));
      mMenu.setLocation(x, y + height);
      mMenu.setVisible(true);
    }
    else
    {
      Log.d("ddms", mDropdown.getText() + " Pressed");
    }
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.DropdownSelectionListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

class Main$1 {}

/* Location:
 * Qualified Name:     com.android.ddms.Main.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.Log;

class Main$UncaughtHandler
  implements Thread.UncaughtExceptionHandler
{
  public void uncaughtException(Thread t, Throwable e)
  {
    Log.e("ddms", "shutting down due to uncaught exception");
    Log.e("ddms", e);
    System.exit(1);
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.Main.UncaughtHandler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.DebugPortManager;
import com.android.ddmlib.Log;
import com.android.sdkstats.SdkStatsService;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.util.Properties;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Main
{
  public static String sRevision;
  
  private static class UncaughtHandler
    implements Thread.UncaughtExceptionHandler
  {
    public void uncaughtException(Thread t, Throwable e)
    {
      Log.e("ddms", "shutting down due to uncaught exception");
      Log.e("ddms", e);
      System.exit(1);
    }
  }
  
  public static void main(String[] args)
  {
    if (isMac())
    {
      RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean();
      System.setProperty("JAVA_STARTED_ON_FIRST_THREAD_" + rt.getName().split("@")[0], "1");
    }
    Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler(null));
    
    PrefsDialog.init();
    
    Log.d("ddms", "Initializing");
    
    Display.setAppName("DDMS");
    Shell shell = new Shell(Display.getDefault());
    
    SdkStatsService stats = new SdkStatsService();
    stats.checkUserPermissionForPing(shell);
    if ((args.length >= 3) && (args[0].equals("ping")))
    {
      stats.ping(args);
      return;
    }
    if (args.length > 0)
    {
      Log.e("ddms", "Unknown argument: " + args[0]);
      System.exit(1);
    }
    String ddmsParentLocation = System.getProperty("com.android.ddms.bindir");
    if (ddmsParentLocation == null) {
      ddmsParentLocation = System.getenv("com.android.ddms.bindir");
    }
    ping(stats, ddmsParentLocation);
    stats = null;
    
    DebugPortManager.setProvider(DebugPortProvider.getInstance());
    
    UIThread ui = UIThread.getInstance();
    try
    {
      ui.runUI(ddmsParentLocation);
    }
    finally
    {
      PrefsDialog.save();
      
      AndroidDebugBridge.terminate();
    }
    Log.d("ddms", "Bye");
    
    System.exit(0);
  }
  
  static boolean isMac()
  {
    return System.getProperty("os.name").startsWith("Mac OS");
  }
  
  private static void ping(SdkStatsService stats, String ddmsParentLocation)
  {
    Properties p = new Properties();
    try
    {
      File sourceProp;
      File sourceProp;
      if ((ddmsParentLocation != null) && (ddmsParentLocation.length() > 0)) {
        sourceProp = new File(ddmsParentLocation, "source.properties");
      } else {
        sourceProp = new File("source.properties");
      }
      FileInputStream fis = null;
      try
      {
        fis = new FileInputStream(sourceProp);
        p.load(fis);
        if (fis != null) {
          try
          {
            fis.close();
          }
          catch (IOException ignore) {}
        }
        sRevision = p.getProperty("Pkg.Revision");
      }
      finally
      {
        if (fis != null) {
          try
          {
            fis.close();
          }
          catch (IOException ignore) {}
        }
      }
      if ((sRevision != null) && (sRevision.length() > 0)) {
        stats.ping("ddms", sRevision);
      }
    }
    catch (FileNotFoundException e) {}catch (IOException e) {}
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.Main
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

class PrefsDialog$1 {}

/* Location:
 * Qualified Name:     com.android.ddms.PrefsDialog.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.DdmPreferences;
import com.android.ddmlib.Log;
import com.android.sdkstats.DdmsPreferenceStore;
import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;

class PrefsDialog$ChangeListener
  implements IPropertyChangeListener
{
  public void propertyChange(PropertyChangeEvent event)
  {
    String changed = event.getProperty();
    PreferenceStore prefStore = PrefsDialog.access$100().getPreferenceStore();
    if (changed.equals("adbDebugBasePort")) {
      DdmPreferences.setDebugPortBase(prefStore.getInt("adbDebugBasePort"));
    } else if (changed.equals("debugSelectedPort")) {
      DdmPreferences.setSelectedDebugPort(prefStore.getInt("debugSelectedPort"));
    } else if (changed.equals("ddmsLogLevel")) {
      DdmPreferences.setLogLevel((String)event.getNewValue());
    } else if (changed.equals("textSaveDir")) {
      prefStore.setValue("lastTextSaveDir", (String)event.getNewValue());
    } else if (changed.equals("imageSaveDir")) {
      prefStore.setValue("lastImageSaveDir", (String)event.getNewValue());
    } else if (changed.equals("timeOut")) {
      DdmPreferences.setTimeOut(prefStore.getInt("timeOut"));
    } else if (changed.equals("profilerBufferSizeMb")) {
      DdmPreferences.setProfilerBufferSizeMb(prefStore.getInt("profilerBufferSizeMb"));
    } else if (changed.equals("useAdbHost")) {
      DdmPreferences.setUseAdbHost(prefStore.getBoolean("useAdbHost"));
    } else if (changed.equals("adbHostValue")) {
      DdmPreferences.setAdbHostValue(prefStore.getString("adbHostValue"));
    } else {
      Log.v("ddms", "Preference change: " + event.getProperty() + ": '" + event.getOldValue() + "' --> '" + event.getNewValue() + "'");
    }
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.PrefsDialog.ChangeListener
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmuilib.PortFieldEditor;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.util.PropertyChangeEvent;

class PrefsDialog$DebuggerPrefs
  extends FieldEditorPreferencePage
{
  private BooleanFieldEditor mUseAdbHost;
  private StringFieldEditor mAdbHostValue;
  
  public PrefsDialog$DebuggerPrefs()
  {
    super(1);
    setTitle("Debugger");
  }
  
  protected void createFieldEditors()
  {
    IntegerFieldEditor ife = new PortFieldEditor("adbDebugBasePort", "Starting value for local port:", getFieldEditorParent());
    
    addField(ife);
    
    ife = new PortFieldEditor("debugSelectedPort", "Port of Selected VM:", getFieldEditorParent());
    
    addField(ife);
    
    mUseAdbHost = new BooleanFieldEditor("useAdbHost", "Use ADBHOST", getFieldEditorParent());
    
    addField(mUseAdbHost);
    
    mAdbHostValue = new StringFieldEditor("adbHostValue", "ADBHOST value:", getFieldEditorParent());
    
    mAdbHostValue.setEnabled(getPreferenceStore().getBoolean("useAdbHost"), getFieldEditorParent());
    
    addField(mAdbHostValue);
  }
  
  public void propertyChange(PropertyChangeEvent event)
  {
    if (event.getSource().equals(mUseAdbHost)) {
      mAdbHostValue.setEnabled(mUseAdbHost.getBooleanValue(), getFieldEditorParent());
    }
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.PrefsDialog.DebuggerPrefs
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.FontFieldEditor;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.RadioGroupFieldEditor;

class PrefsDialog$LogCatPrefs
  extends FieldEditorPreferencePage
{
  public PrefsDialog$LogCatPrefs()
  {
    super(0);
    setTitle("Logcat");
  }
  
  protected void createFieldEditors()
  {
    if (UIThread.useOldLogCatView())
    {
      RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor("ddmsLogColumnMode", "Message Column Resizing Mode", 1, new String[][] { { "Manual", "manual" }, { "Automatic", "auto" } }, getFieldEditorParent(), true);
      
      addField(rgfe);
      
      FontFieldEditor ffe = new FontFieldEditor("ddmsLogFont", "Text output font:", getFieldEditorParent());
      
      addField(ffe);
    }
    else
    {
      FontFieldEditor ffe = new FontFieldEditor("logcat.view.font", "Text output font:", getFieldEditorParent());
      
      addField(ffe);
      
      IntegerFieldEditor maxMessages = new IntegerFieldEditor("logcat.messagelist.max.size", "Maximum number of logcat messages to buffer", getFieldEditorParent());
      
      addField(maxMessages);
      
      BooleanFieldEditor autoScrollLock = new BooleanFieldEditor("logcat.view.auto-scroll-lock", "Automatically enable/disable scroll lock based on the scrollbar position", getFieldEditorParent());
      
      addField(autoScrollLock);
    }
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.PrefsDialog.LogCatPrefs
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.ddmlib.Log.LogLevel;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.FontFieldEditor;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.RadioGroupFieldEditor;

class PrefsDialog$MiscPrefs
  extends FieldEditorPreferencePage
{
  public PrefsDialog$MiscPrefs()
  {
    super(0);
    setTitle("Misc");
  }
  
  protected void createFieldEditors()
  {
    IntegerFieldEditor ife = new IntegerFieldEditor("timeOut", "ADB connection time out (ms):", getFieldEditorParent());
    
    addField(ife);
    
    ife = new IntegerFieldEditor("profilerBufferSizeMb", "Profiler buffer size (MB):", getFieldEditorParent());
    
    addField(ife);
    
    DirectoryFieldEditor dfe = new DirectoryFieldEditor("textSaveDir", "Default text save dir:", getFieldEditorParent());
    
    addField(dfe);
    
    dfe = new DirectoryFieldEditor("imageSaveDir", "Default image save dir:", getFieldEditorParent());
    
    addField(dfe);
    
    FontFieldEditor ffe = new FontFieldEditor("textOutputFont", "Text output font:", getFieldEditorParent());
    
    addField(ffe);
    
    RadioGroupFieldEditor rgfe = new RadioGroupFieldEditor("ddmsLogLevel", "Logging Level", 1, new String[][] { { "Verbose", Log.LogLevel.VERBOSE.getStringValue() }, { "Debug", Log.LogLevel.DEBUG.getStringValue() }, { "Info", Log.LogLevel.INFO.getStringValue() }, { "Warning", Log.LogLevel.WARN.getStringValue() }, { "Error", Log.LogLevel.ERROR.getStringValue() }, { "Assert", Log.LogLevel.ASSERT.getStringValue() } }, getFieldEditorParent(), true);
    
    addField(rgfe);
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.PrefsDialog.MiscPrefs
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;

class PrefsDialog$PanelPrefs
  extends FieldEditorPreferencePage
{
  public PrefsDialog$PanelPrefs()
  {
    super(0);
    setTitle("Info Panels");
  }
  
  protected void createFieldEditors()
  {
    BooleanFieldEditor bfe = new BooleanFieldEditor("defaultThreadUpdateEnabled", "Thread updates enabled by default", getFieldEditorParent());
    
    addField(bfe);
    
    bfe = new BooleanFieldEditor("defaultHeapUpdateEnabled", "Heap updates enabled by default", getFieldEditorParent());
    
    addField(bfe);
    
    IntegerFieldEditor ife = new IntegerFieldEditor("threadStatusInterval", "Thread status interval (seconds):", getFieldEditorParent());
    
    ife.setValidRange(1, 60);
    addField(ife);
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.PrefsDialog.PanelPrefs
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.sdkstats.SdkStatsPermissionDialog;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class PrefsDialog$UsageStatsPrefs$1
  extends SelectionAdapter
{
  PrefsDialog$UsageStatsPrefs$1(PrefsDialog.UsageStatsPrefs paramUsageStatsPrefs) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    SdkStatsPermissionDialog.openUrl(text);
  }
}

/* Location:
 * Qualified Name:     com.android.ddms.PrefsDialog.UsageStatsPrefs.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.ddms;

import com.android.sdkstats.SdkStatsPermissionDialog;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;

class PrefsDialog$UsageStatsPrefs
  extends PreferencePage
{
  private BooleanFieldEditor mOptInCheckbox;
  private Composite mTop;
  
  public PrefsDialog$UsageStatsPrefs()
  {
    setTitle("Usage Stats");
  }
  
  protected Control createContents(Composite parent)
  {
    mTop = new Composite(parent, 0);
    mTop.setLayout(new GridLayout(1, false));
    mTop.setLayoutData(new GridData(1808));
    
    Label text = new Label(mTop, 64);
    text.setLayoutData(new GridData(768));
    text.setText("By choosing to send certain usage statistics to Google, you can help us improve the Android SDK. These usage statistics lets us measure things like active usage of the SDK, and let us know things like which versions of the SDK are in use and which tools are the most popular with developers. This limited data is not associated with personal information about you, and is examined on an aggregate basis, and is maintained in accordance with the Google Privacy Policy.");
    
    Link privacyPolicyLink = new Link(mTop, 64);
    privacyPolicyLink.setText("<a href=\"http://www.google.com/intl/en/privacy.html\">Google Privacy Policy</a>");
    privacyPolicyLink.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        SdkStatsPermissionDialog.openUrl(text);
      }
    });
    mOptInCheckbox = new BooleanFieldEditor("pingOptIn", "Send usage statistics to Google.", mTop);
    
    mOptInCheckbox.setPage(this);
    mOptInCheckbox.setPreferenceStore(getPreferenceStore());
    mOptInCheckbox.load();
    
    return null;
  }
  
  protected Point doComputeSize()
  {
    if (mTop != null) {
      return mTop.computeSize(450, -1, true);
    }
    return super.doComputeSize();
  }
  
  protected void performDefaults()
  {
    if (mOptInCheckbox != null) {
      mOptInCheckbox.loadDefault();
    }
    super.performDefaults();
  }
  
  public void performApply()
  {
    if (mOptInCheckbox != null) {
      mOptInCheckbox.store();
    }
    super.performApply();
  }
  
  public boolean performOk()
  {
    if (mOptInCheckbox != null) {
      mOptInCheckbox.store();
    }
    return super.performOk();
  }
}

/* Location:
 * Qualif
1 2 3 4 5

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