com.android.ide.eclipse.ddms_22.6.2.v201403212031-1085508

16:34:12.266 INFO  jd.cli.Main - Decompiling com.android.ide.eclipse.ddms_22.6.2.v201403212031-1085508.jar
package com.android.ide.eclipse.ddms;

import com.android.ddmuilib.actions.ICommonAction;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;

public class CommonAction
  extends Action
  implements ICommonAction
{
  private Runnable mRunnable;
  
  public CommonAction() {}
  
  public CommonAction(String text)
  {
    super(text);
  }
  
  public CommonAction(String text, ImageDescriptor image)
  {
    super(text, image);
  }
  
  public CommonAction(String text, int style)
  {
    super(text, style);
  }
  
  public void run()
  {
    if (mRunnable != null) {
      mRunnable.run();
    }
  }
  
  public void setRunnable(Runnable runnable)
  {
    mRunnable = runnable;
  }
}

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

import org.eclipse.ui.console.MessageConsoleStream;

class DdmsPlugin$1
  implements Runnable
{
  DdmsPlugin$1(DdmsPlugin paramDdmsPlugin, MessageConsoleStream paramMessageConsoleStream) {}
  
  public void run()
  {
    val$errorConsoleStream.setColor(DdmsPlugin.access$0(this$0));
  }
}

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

import com.android.ddmlib.Log.LogLevel;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

class DdmsPlugin$2$1
  implements Runnable
{
  DdmsPlugin$2$1(DdmsPlugin.2 param2, Display paramDisplay, Log.LogLevel paramLogLevel, String paramString1, String paramString2) {}
  
  public void run()
  {
    Shell shell = val$display.getActiveShell();
    if (val$logLevel == Log.LogLevel.ERROR) {
      MessageDialog.openError(shell, val$tag, val$message);
    } else {
      MessageDialog.openWarning(shell, val$tag, val$message);
    }
  }
}

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

import com.android.ddmlib.Log.ILogOutput;
import com.android.ddmlib.Log.LogLevel;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.console.MessageConsoleStream;

class DdmsPlugin$2
  implements Log.ILogOutput
{
  DdmsPlugin$2(DdmsPlugin paramDdmsPlugin, MessageConsoleStream paramMessageConsoleStream1, MessageConsoleStream paramMessageConsoleStream2, Display paramDisplay) {}
  
  public void printLog(Log.LogLevel logLevel, String tag, String message)
  {
    if (logLevel.getPriority() >= Log.LogLevel.ERROR.getPriority())
    {
      DdmsPlugin.access$1(val$errorConsoleStream, tag, message);
      DdmsPlugin.access$3(this$0, DdmsPlugin.access$2(this$0));
    }
    else
    {
      DdmsPlugin.access$1(val$consoleStream, tag, message);
    }
  }
  
  public void printAndPromptLog(final Log.LogLevel logLevel, final String tag, final String message)
  {
    printLog(logLevel, tag, message);
    
    val$display.asyncExec(new Runnable()
    {
      public void run()
      {
        Shell shell = val$display.getActiveShell();
        if (logLevel == Log.LogLevel.ERROR) {
          MessageDialog.openError(shell, tag, message);
        } else {
          MessageDialog.openWarning(shell, tag, message);
        }
      }
    });
  }
}

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

import com.android.ddmuilib.console.IDdmConsole;
import org.eclipse.ui.console.MessageConsoleStream;

class DdmsPlugin$3
  implements IDdmConsole
{
  DdmsPlugin$3(DdmsPlugin paramDdmsPlugin, MessageConsoleStream paramMessageConsoleStream1, MessageConsoleStream paramMessageConsoleStream2) {}
  
  public void printErrorToConsole(String message)
  {
    DdmsPlugin.access$1(val$errorConsoleStream, null, message);
    DdmsPlugin.access$3(this$0, DdmsPlugin.access$2(this$0));
  }
  
  public void printErrorToConsole(String[] messages)
  {
    String[] arrayOfString;
    int j = (arrayOfString = messages).length;
    for (int i = 0; i < j; i++)
    {
      String m = arrayOfString[i];
      DdmsPlugin.access$1(val$errorConsoleStream, null, m);
    }
    DdmsPlugin.access$3(this$0, DdmsPlugin.access$2(this$0));
  }
  
  public void printToConsole(String message)
  {
    DdmsPlugin.access$1(val$consoleStream, null, message);
  }
  
  public void printToConsole(String[] messages)
  {
    String[] arrayOfString;
    int j = (arrayOfString = messages).length;
    for (int i = 0; i < j; i++)
    {
      String m = arrayOfString[i];
      DdmsPlugin.access$1(val$consoleStream, null, m);
    }
  }
}

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

import com.android.ddmlib.DdmPreferences;
import com.android.ddmuilib.DdmUiPreferences;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;

class DdmsPlugin$4
  implements IPropertyChangeListener
{
  DdmsPlugin$4(DdmsPlugin paramDdmsPlugin, IPreferenceStore paramIPreferenceStore) {}
  
  public void propertyChange(PropertyChangeEvent event)
  {
    String property = event.getProperty();
    if ("com.android.ide.eclipse.ddms.adbDebugBasePort".equals(property)) {
      DdmPreferences.setDebugPortBase(
        val$eclipseStore.getInt("com.android.ide.eclipse.ddms.adbDebugBasePort"));
    } else if ("com.android.ide.eclipse.ddms.debugSelectedPort".equals(property)) {
      DdmPreferences.setSelectedDebugPort(
        val$eclipseStore.getInt("com.android.ide.eclipse.ddms.debugSelectedPort"));
    } else if ("com.android.ide.eclipse.ddms.threadStatusInterval".equals(property)) {
      DdmUiPreferences.setThreadRefreshInterval(
        val$eclipseStore.getInt("com.android.ide.eclipse.ddms.threadStatusInterval"));
    } else if ("com.android.ide.eclipse.ddms.logLevel".equals(property)) {
      DdmPreferences.setLogLevel(
        val$eclipseStore.getString("com.android.ide.eclipse.ddms.logLevel"));
    } else if ("com.android.ide.eclipse.ddms.timeOut".equals(property)) {
      DdmPreferences.setTimeOut(
        val$eclipseStore.getInt("com.android.ide.eclipse.ddms.timeOut"));
    } else if ("com.android.ide.eclipse.ddms.useAdbHost".equals(property)) {
      DdmPreferences.setUseAdbHost(
        val$eclipseStore.getBoolean("com.android.ide.eclipse.ddms.useAdbHost"));
    } else if ("com.android.ide.eclipse.ddms.adbHostValue".equals(property)) {
      DdmPreferences.setAdbHostValue(
        val$eclipseStore.getString("com.android.ide.eclipse.ddms.adbHostValue"));
    }
  }
}

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

import com.android.ddmlib.AndroidDebugBridge;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;

class DdmsPlugin$5
  extends Job
{
  DdmsPlugin$5(DdmsPlugin paramDdmsPlugin, String $anonymous0, IConfigurationElement[] paramArrayOfIConfigurationElement)
  {
    super($anonymous0);
  }
  
  protected IStatus run(IProgressMonitor monitor)
  {
    try
    {
      AndroidDebugBridge.init(true);
      
      IConfigurationElement[] elements = this$0.findConfigElements(
        "com.android.ide.eclipse.ddms.toolsLocator");
      
      IToolsLocator[] locators = DdmsPlugin.access$4(this$0, elements);
      IToolsLocator[] arrayOfIToolsLocator1;
      int j = (arrayOfIToolsLocator1 = locators).length;
      for (int i = 0; i < j; i++)
      {
        IToolsLocator locator = arrayOfIToolsLocator1[i];
        try
        {
          String adbLocation = locator.getAdbLocation();
          String traceviewLocation = locator.getTraceViewLocation();
          String hprofConvLocation = locator.getHprofConvLocation();
          if ((adbLocation != null) && (traceviewLocation != null) && 
            (hprofConvLocation != null)) {
            if (DdmsPlugin.access$5(adbLocation, hprofConvLocation, 
              traceviewLocation)) {
              AndroidDebugBridge.createBridge(DdmsPlugin.access$6(), 
                true);
            }
          }
        }
        catch (Throwable localThrowable) {}
      }
      DdmsPlugin.access$8(this$0, DdmsPlugin.access$7(this$0, val$dcce));
      
      elements = this$0.findConfigElements("com.android.ide.eclipse.ddms.traceviewLauncher");
      DdmsPlugin.access$10(this$0, DdmsPlugin.access$9(this$0, elements));
      
      return Status.OK_STATUS;
    }
    catch (CoreException e)
    {
      return e.getStatus();
    }
  }
}

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

import com.android.ddmlib.AndroidDebugBridge;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Status;

class DdmsPlugin$6
  extends Thread
{
  public void run()
  {
    try
    {
      AndroidDebugBridge.createBridge(DdmsPlugin.access$6(), 
        false);
    }
    catch (Throwable t)
    {
      Status status = new Status(4, "com.android.ide.eclipse.ddms", 
        "Failed to create AndroidDebugBridge", t);
      DdmsPlugin.getDefault().getLog().log(status);
    }
  }
}

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

import com.android.ddmlib.Client;
import com.android.ddmlib.IDevice;

class DdmsPlugin$7
  implements Runnable
{
  DdmsPlugin$7(DdmsPlugin paramDdmsPlugin, IDevice paramIDevice) {}
  
  public void run()
  {
    boolean newDevice = false;
    if (DdmsPlugin.access$11(this$0) != val$device)
    {
      DdmsPlugin.access$12(this$0, val$device);
      newDevice = true;
      for (DdmsPlugin.ISelectionListener listener : DdmsPlugin.access$13(this$0)) {
        listener.selectionChanged(DdmsPlugin.access$11(this$0));
      }
    }
    if (val$device != null)
    {
      if ((newDevice) || (DdmsPlugin.access$14(this$0) == null))
      {
        Client[] clients = val$device.getClients();
        if (clients.length > 0) {
          DdmsPlugin.access$15(this$0, clients[0]);
        } else {
          DdmsPlugin.access$15(this$0, null);
        }
      }
    }
    else {
      DdmsPlugin.access$15(this$0, null);
    }
  }
}

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

import com.android.ddmlib.Client;
import com.android.ddmlib.IDevice;

public abstract interface DdmsPlugin$ISelectionListener
{
  public abstract void selectionChanged(Client paramClient);
  
  public abstract void selectionChanged(IDevice paramIDevice);
}

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

import com.android.annotations.NonNull;
import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
import com.android.ddmlib.Client;
import com.android.ddmlib.DdmPreferences;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.Log;
import com.android.ddmlib.Log.ILogOutput;
import com.android.ddmlib.Log.LogLevel;
import com.android.ddmuilib.DdmUiPreferences;
import com.android.ddmuilib.DevicePanel.IUiSelectionListener;
import com.android.ddmuilib.StackTracePanel;
import com.android.ddmuilib.StackTracePanel.ISourceRevealer;
import com.android.ddmuilib.console.DdmConsole;
import com.android.ddmuilib.console.IDdmConsole;
import com.android.ide.eclipse.ddms.i18n.Messages;
import com.android.ide.eclipse.ddms.preferences.PreferenceInitializer;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.console.ConsolePlugin;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.MessageConsole;
import org.eclipse.ui.console.MessageConsoleStream;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public final class DdmsPlugin
  extends AbstractUIPlugin
  implements AndroidDebugBridge.IDeviceChangeListener, DevicePanel.IUiSelectionListener, StackTracePanel.ISourceRevealer
{
  public static final String PLUGIN_ID = "com.android.ide.eclipse.ddms";
  private static DdmsPlugin sPlugin;
  private static String sAdbLocation;
  private static String sToolsFolder;
  private static String sHprofConverter;
  private boolean mHasDebuggerConnectors;
  private IDebuggerConnector[] mDebuggerConnectors;
  private ITraceviewLauncher[] mTraceviewLaunchers;
  private List<IClientAction> mClientSpecificActions = null;
  private MessageConsole mDdmsConsole;
  private IDevice mCurrentDevice;
  private Client mCurrentClient;
  private boolean mListeningToUiSelection = false;
  private final ArrayList<ISelectionListener> mListeners = new ArrayList();
  private Color mRed;
  private LogCatMonitor mLogCatMonitor;
  
  public DdmsPlugin()
  {
    sPlugin = this;
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    
    final Display display = getDisplay();
    
    final IPreferenceStore eclipseStore = getPreferenceStore();
    
    AndroidDebugBridge.addDeviceChangeListener(this);
    
    DdmUiPreferences.setStore(eclipseStore);
    
    mDdmsConsole = new MessageConsole("DDMS", null);
    ConsolePlugin.getDefault().getConsoleManager().addConsoles(
      new IConsole[] {
      mDdmsConsole });
    
    final MessageConsoleStream consoleStream = mDdmsConsole.newMessageStream();
    final MessageConsoleStream errorConsoleStream = mDdmsConsole.newMessageStream();
    mRed = new Color(display, 255, 0, 0);
    
    display.asyncExec(new Runnable()
    {
      public void run()
      {
        errorConsoleStream.setColor(mRed);
      }
    });
    Log.setLogOutput(new Log.ILogOutput()
    {
      public void printLog(Log.LogLevel logLevel, String tag, String message)
      {
        if (logLevel.getPriority() >= Log.LogLevel.ERROR.getPriority())
        {
          DdmsPlugin.printToStream(errorConsoleStream, tag, message);
          DdmsPlugin.this.showConsoleView(mDdmsConsole);
        }
        else
        {
          DdmsPlugin.printToStream(consoleStream, tag, message);
        }
      }
      
      public void printAndPromptLog(final Log.LogLevel logLevel, final String tag, final String message)
      {
        printLog(logLevel, tag, message);
        
        display.asyncExec(new Runnable()
        {
          public void run()
          {
            Shell shell = val$display.getActiveShell();
            if (logLevel == Log.LogLevel.ERROR) {
              MessageDialog.openError(shell, tag, message);
            } else {
              MessageDialog.openWarning(shell, tag, message);
            }
          }
        });
      }
    });
    DdmConsole.setConsole(new IDdmConsole()
    {
      public void printErrorToConsole(String message)
      {
        DdmsPlugin.printToStream(errorConsoleStream, null, message);
        DdmsPlugin.this.showConsoleView(mDdmsConsole);
      }
      
      public void printErrorToConsole(String[] messages)
      {
        String[] arrayOfString;
        int j = (arrayOfString = messages).length;
        for (int i = 0; i < j; i++)
        {
          String m = arrayOfString[i];
          DdmsPlugin.printToStream(errorConsoleStream, null, m);
        }
        DdmsPlugin.this.showConsoleView(mDdmsConsole);
      }
      
      public void printToConsole(String message)
      {
        DdmsPlugin.printToStream(consoleStream, null, message);
      }
      
      public void printToConsole(String[] messages)
      {
        String[] arrayOfString;
        int j = (arrayOfString = messages).length;
        for (int i = 0; i < j; i++)
        {
          String m = arrayOfString[i];
          DdmsPlugin.printToStream(consoleStream, null, m);
        }
      }
    });
    eclipseStore.addPropertyChangeListener(new IPropertyChangeListener()
    {
      public void propertyChange(PropertyChangeEvent event)
      {
        String property = event.getProperty();
        if ("com.android.ide.eclipse.ddms.adbDebugBasePort".equals(property)) {
          DdmPreferences.setDebugPortBase(
            eclipseStore.getInt("com.android.ide.eclipse.ddms.adbDebugBasePort"));
        } else if ("com.android.ide.eclipse.ddms.debugSelectedPort".equals(property)) {
          DdmPreferences.setSelectedDebugPort(
            eclipseStore.getInt("com.android.ide.eclipse.ddms.debugSelectedPort"));
        } else if ("com.android.ide.eclipse.ddms.threadStatusInterval".equals(property)) {
          DdmUiPreferences.setThreadRefreshInterval(
            eclipseStore.getInt("com.android.ide.eclipse.ddms.threadStatusInterval"));
        } else if ("com.android.ide.eclipse.ddms.logLevel".equals(property)) {
          DdmPreferences.setLogLevel(
            eclipseStore.getString("com.android.ide.eclipse.ddms.logLevel"));
        } else if ("com.android.ide.eclipse.ddms.timeOut".equals(property)) {
          DdmPreferences.setTimeOut(
            eclipseStore.getInt("com.android.ide.eclipse.ddms.timeOut"));
        } else if ("com.android.ide.eclipse.ddms.useAdbHost".equals(property)) {
          DdmPreferences.setUseAdbHost(
            eclipseStore.getBoolean("com.android.ide.eclipse.ddms.useAdbHost"));
        } else if ("com.android.ide.eclipse.ddms.adbHostValue".equals(property)) {
          DdmPreferences.setAdbHostValue(
            eclipseStore.getString("com.android.ide.eclipse.ddms.adbHostValue"));
        }
      }
    });
    PreferenceInitializer.setupPreferences();
    
    StackTracePanel.setSourceRevealer(this);
    
    final IConfigurationElement[] dcce = findConfigElements(
      "com.android.ide.eclipse.ddms.debuggerConnector");
    mHasDebuggerConnectors = (dcce.length > 0);
    
    new Job(Messages.DdmsPlugin_DDMS_Post_Create_Init)
    {
      protected IStatus run(IProgressMonitor monitor)
      {
        try
        {
          AndroidDebugBridge.init(true);
          
          IConfigurationElement[] elements = findConfigElements(
            "com.android.ide.eclipse.ddms.toolsLocator");
          
          IToolsLocator[] locators = DdmsPlugin.this.instantiateToolsLocators(elements);
          IToolsLocator[] arrayOfIToolsLocator1;
          int j = (arrayOfIToolsLocator1 = locators).length;
          for (int i = 0; i < j; i++)
          {
            IToolsLocator locator = arrayOfIToolsLocator1[i];
            try
            {
              String adbLocation = locator.getAdbLocation();
              String traceviewLocation = locator.getTraceViewLocation();
              String hprofConvLocation = locator.getHprofConvLocation();
              if ((adbLocation != null) && (traceviewLocation != null) && 
                (hprofConvLocation != null)) {
                if (DdmsPlugin.setToolsLocation(adbLocation, hprofConvLocation, 
                  traceviewLocation)) {
                  AndroidDebugBridge.createBridge(DdmsPlugin.sAdbLocation, 
                    true);
                }
              }
            }
            catch (Throwable localThrowable) {}
          }
          mDebuggerConnectors = DdmsPlugin.this.instantiateDebuggerConnectors(dcce);
          
          elements = findConfigElements("com.android.ide.eclipse.ddms.traceviewLauncher");
          mTraceviewLaunchers = DdmsPlugin.this.instantiateTraceviewLauncher(elements);
          
          return Status.OK_STATUS;
        }
        catch (CoreException e)
        {
          return e.getStatus();
        }
      }
    }.schedule();
  }
  
  private void showConsoleView(MessageConsole console)
  {
    ConsolePlugin.getDefault().getConsoleManager().showConsoleView(console);
  }
  
  IConfigurationElement[] findConfigElements(String extensionPointId)
  {
    IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
    IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(extensionPointId);
    if (extensionPoint != null) {
      return extensionPoint.getConfigurationElements();
    }
    return new IConfigurationElement[0];
  }
  
  private IToolsLocator[] instantiateToolsLocators(IConfigurationElement[] configElements)
    throws CoreException
  {
    ArrayList<IToolsLocator> list = new ArrayList();
    if (configElements.length > 0)
    {
      IConfigurationElement configElement = configElements[0];
      
      Object obj = configElement.createExecutableExtension("class");
      if ((obj instanceof IToolsLocator)) {
        list.add((IToolsLocator)obj);
      }
    }
    return (IToolsLocator[])list.toArray(new IToolsLocator[list.size()]);
  }
  
  private IDebuggerConnector[] instantiateDebuggerConnectors(IConfigurationElement[] configElements)
    throws CoreException
  {
    ArrayList<IDebuggerConnector> list = new ArrayList();
    if (configElements.length > 0)
    {
      IConfigurationElement configElement = configElements[0];
      
      Object obj = configElement.createExecutableExtension("class");
      if ((obj instanceof IDebuggerConnector)) {
        list.add((IDebuggerConnector)obj);
      }
    }
    return (IDebuggerConnector[])list.toArray(new IDebuggerConnector[list.size()]);
  }
  
  private ITraceviewLauncher[] instantiateTraceviewLauncher(IConfigurationElement[] configElements)
    throws CoreException
  {
    ArrayList<ITraceviewLauncher> list = new ArrayList();
    if (configElements.length > 0)
    {
      IConfigurationElement configElement = configElements[0];
      
      Object obj = configElement.createExecutableExtension("class");
      if ((obj instanceof ITraceviewLauncher)) {
        list.add((ITraceviewLauncher)obj);
      }
    }
    return (ITraceviewLauncher[])list.toArray(new ITraceviewLauncher[list.size()]);
  }
  
  private List<IClientAction> instantiateClientSpecificActions(IConfigurationElement[] elements)
    throws CoreException
  {
    if ((elements == null) || (elements.length == 0)) {
      return Collections.emptyList();
    }
    List<IClientAction> extensions = new ArrayList(1);
    IConfigurationElement[] arrayOfIConfigurationElement;
    int j = (arrayOfIConfigurationElement = elements).length;
    for (int i = 0; i < j; i++)
    {
      IConfigurationElement e = arrayOfIConfigurationElement[i];
      Object o = e.createExecutableExtension("class");
      if ((o instanceof IClientAction)) {
        extensions.add((IClientAction)o);
      }
    }
    return extensions;
  }
  
  public static Display getDisplay()
  {
    IWorkbench bench = sPlugin.getWorkbench();
    if (bench != null) {
      return bench.getDisplay();
    }
    return null;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    AndroidDebugBridge.removeDeviceChangeListener(this);
    
    AndroidDebugBridge.terminate();
    
    mRed.dispose();
    
    sPlugin = null;
    super.stop(context);
  }
  
  public static DdmsPlugin getDefault()
  {
    return sPlugin;
  }
  
  public static String getAdb()
  {
    return sAdbLocation;
  }
  
  public static File getPlatformToolsFolder()
  {
    return new File(sAdbLocation).getParentFile();
  }
  
  public static String getToolsFolder()
  {
    return sToolsFolder;
  }
  
  public static String getHprofConverter()
  {
    return sHprofConverter;
  }
  
  private static boolean setToolsLocation(String adbLocation, String hprofConvLocation, String traceViewLocation)
  {
    File adb = new File(adbLocation);
    File hprofConverter = new File(hprofConvLocation);
    File traceview = new File(traceViewLocation);
    
    String missing = "";
    if (!adb.isFile()) {
      missing = missing + adb.getAbsolutePath() + " ";
    }
    if (!hprofConverter.isFile()) {
      missing = missing + hprofConverter.getAbsolutePath() + " ";
    }
    if (!traceview.isFile()) {
      missing = missing + traceview.getAbsolutePath() + " ";
    }
    if (missing.length() > 0)
    {
      String msg = String.format("DDMS files not found: %1$s", new Object[] { missing });
      Log.e("DDMS", msg);
      Status status = new Status(4, "com.android.ide.eclipse.ddms", msg, null);
      getDefault().getLog().log(status);
      return false;
    }
    sAdbLocation = adbLocation;
    sHprofConverter = hprofConverter.getAbsolutePath();
    DdmUiPreferences.setTraceviewLocation(traceview.getAbsolutePath());
    
    sToolsFolder = traceview.getParent();
    
    return true;
  }
  
  public static void setToolsLocation(String adbLocation, boolean startAdb, String hprofConvLocation, String traceViewLocation)
  {
    if (setToolsLocation(adbLocation, hprofConvLocation, traceViewLocation)) {
      if (startAdb) {
        new Thread()
        {
          public void run()
          {
            try
            {
              AndroidDebugBridge.createBridge(DdmsPlugin.sAdbLocation, 
                false);
            }
            catch (Throwable t)
            {
              Status status = new Status(4, "com.android.ide.eclipse.ddms", 
                "Failed to create AndroidDebugBridge", t);
              DdmsPlugin.getDefault().getLog().log(status);
            }
          }
        }.start();
      }
    }
  }
  
  public boolean hasDebuggerConnectors()
  {
    return mHasDebuggerConnectors;
  }
  
  public IDebuggerConnector[] getDebuggerConnectors()
  {
    return mDebuggerConnectors;
  }
  
  public synchronized void addSelectionListener(ISelectionListener listener)
  {
    mListeners.add(listener);
    
    listener.selectionChanged(mCurrentDevice);
    listener.selectionChanged(mCurrentClient);
  }
  
  public synchronized void removeSelectionListener(ISelectionListener listener)
  {
    mListeners.remove(listener);
  }
  
  public synchronized void setListeningState(boolean state)
  {
    mListeningToUiSelection = state;
  }
  
  public void deviceConnected(IDevice device)
  {
    if ((!mListeningToUiSelection) && 
      (mCurrentDevice == null)) {
      handleDefaultSelection(device);
    }
  }
  
  public void deviceDisconnected(IDevice device)
  {
    if (!mListeningToUiSelection) {
      if (mCurrentDevice == device)
      {
        AndroidDebugBridge bridge = AndroidDebugBridge.getBridge();
        if (bridge != null)
        {
          IDevice[] devices = bridge.getDevices();
          if (devices.length == 0) {
            handleDefaultSelection(null);
          } else {
            handleDefaultSelection(devices[0]);
          }
        }
        else
        {
          handleDefaultSelection(null);
        }
      }
    }
  }
  
  public void deviceChanged(IDevice device, int changeMask)
  {
    if (!mListeningToUiSelection) {
      if (device == mCurrentDevice) {
        if (mCurrentClient == null)
        {
          handleDefaultSelection(device);
        }
        else
        {
          Client[] clients = device.getClients();
          boolean foundClient = false;
          Client[] arrayOfClient1;
          int j = (arrayOfClient1 = clients).length;
          for (int i = 0; i < j; i++)
          {
            Client client = arrayOfClient1[i];
            if (client == mCurrentClient)
            {
              foundClient = true;
              break;
            }
          }
          if (!foundClient)
          {
            mCurrentClient = null;
            handleDefaultSelection(device);
          }
        }
      }
    }
  }
  
  public synchronized void selectionChanged(IDevice selectedDevice, Client selectedClient)
  {
    if (mCurrentDevice != selectedDevice)
    {
      mCurrentDevice = selectedDevice;
      for (ISelectionListener listener : mListeners) {
        listener.selectionChanged(mCurrentDevice);
      }
    }
    if (mCurrentClient != selectedClient)
    {
      mCurrentClient = selectedClient;
      for (ISelectionListener listener : mListeners) {
        listener.selectionChanged(mCurrentClient);
      }
    }
  }
  
  private void handleDefaultSelection(final IDevice device)
  {
    try
    {
      Display display = getDisplay();
      
      display.asyncExec(new Runnable()
      {
        public void run()
        {
          boolean newDevice = false;
          if (mCurrentDevice != device)
          {
            mCurrentDevice = device;
            newDevice = true;
            for (DdmsPlugin.ISelectionListener listener : mListeners) {
              listener.selectionChanged(mCurrentDevice);
            }
          }
          if (device != null)
          {
            if ((newDevice) || (mCurrentClient == null))
            {
              Client[] clients = device.getClients();
              if (clients.length > 0) {
                DdmsPlugin.this.handleDefaultSelection(clients[0]);
              } else {
                DdmsPlugin.this.handleDefaultSelection(null);
              }
            }
          }
          else {
            DdmsPlugin.this.handleDefaultSelection(null);
          }
        }
      });
    }
    catch (SWTException localSWTException) {}
  }
  
  private void handleDefaultSelection(Client client)
  {
    mCurrentClient = client;
    for (ISelectionListener listener : mListeners) {
      listener.selectionChanged(mCurrentClient);
    }
  }
  
  private static synchronized void printToStream(MessageConsoleStream stream, String tag, String message)
  {
    String dateTag = getMessageTag(tag);
    
    stream.print(dateTag);
    if (!dateTag.endsWith(" ")) {
      stream.print(" ");
    }
    stream.println(message);
  }
  
  private static String getMessageTag(String tag)
  {
    Calendar c = Calendar.getInstance();
    if (tag == null) {
      return String.format(Messages.DdmsPlugin_Message_Tag_Mask_1, new Object[] { c });
    }
    return String.format(Messages.DdmsPlugin_Message_Tag_Mask_2, new Object[] { c, tag });
  }
  
  public void reveal(String applicationName, String className, int line)
  {
    JavaSourceRevealer.reveal(applicationName, className, line);
  }
  
  public boolean launchTraceview(String osPath)
  {
    if (mTraceviewLaunchers != null)
    {
      ITraceviewLauncher[] arrayOfITraceviewLauncher;
      int j = (arrayOfITraceviewLauncher = mTraceviewLaunchers).length;
      for (int i = 0; i < j; i++)
      {
        ITraceviewLauncher launcher = arrayOfITraceviewLauncher[i];
        try
        {
          if (launcher.openFile(osPath)) {
            return true;
          }
        }
        catch (Throwable localThrowable) {}
      }
    }
    return false;
  }
  
  @NonNull
  public synchronized List<IClientAction> getClientSpecificActions()
  {
    if (mClientSpecificActions == null)
    {
      IConfigurationElement[] elements = 
        findConfigElements("com.android.ide.eclipse.ddms.clientAction");
      try
      {
        mClientSpecificActions = instantiateClientSpecificActions(elements);
      }
      catch (CoreException localCoreException)
      {
        mClientSpecificActions = Collections.emptyList();
      }
    }
    return mClientSpecificActions;
  }
  
  public void startLogCatMonitor(IDevice device)
  {
    if (mLogCatMonitor == null) {
      mLogCatMonitor = new LogCatMonitor(getDebuggerConnectors(), getPreferenceStore());
    }
    mLogCatMonitor.monitorDevice(device);
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    return imageDescriptorFromPlugin("com.android.ide.eclipse.ddms", path);
  }
  
  public static abstract interface ISelectionListener
  {
    public abstract void selectionChanged(Client paramClient);
    
    public abstract void selectionChanged(IDevice paramIDevice);
  }
}

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

import com.android.ddmlib.Client;
import org.eclipse.jface.action.Action;

public abstract interface IClientAction
{
  public abstract Action getAction();
  
  public abstract void selectedClientChanged(Client paramClient);
}

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

public abstract interface IDebuggerConnector
{
  public abstract boolean isWorkspaceApp(String paramString);
  
  public abstract boolean connectDebugger(String paramString, int paramInt1, int paramInt2);
}

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

public abstract interface ISourceRevealer
{
  public abstract boolean reveal(String paramString1, String paramString2, int paramInt);
  
  public abstract boolean revealMethod(String paramString1, String paramString2, int paramInt, String paramString3);
}

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

public abstract interface IToolsLocator
{
  public abstract String getAdbLocation();
  
  public abstract String getTraceViewLocation();
  
  public abstract String getHprofConvLocation();
}

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

public abstract interface ITraceviewLauncher
{
  public abstract boolean openFile(String paramString);
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;

public class JavaSourceRevealer
{
  private static final String SOURCE_REVEALER_EXTENSION_ID = "com.android.ide.eclipse.ddms.sourceRevealer";
  private static List<ISourceRevealer> sSourceRevealers = ;
  
  private static List<ISourceRevealer> instantiateSourceRevealers()
  {
    IConfigurationElement[] configElements = 
      DdmsPlugin.getDefault().findConfigElements("com.android.ide.eclipse.ddms.sourceRevealer");
    
    List<ISourceRevealer> providers = new ArrayList();
    
    IConfigurationElement[] arrayOfIConfigurationElement1 = configElements;int j = configElements.length;
    for (int i = 0; i < j; i++)
    {
      IConfigurationElement configElement = arrayOfIConfigurationElement1[i];
      
      Object obj = null;
      try
      {
        obj = configElement.createExecutableExtension("class");
      }
      catch (CoreException localCoreException) {}
      if ((obj instanceof ISourceRevealer)) {
        providers.add((ISourceRevealer)obj);
      }
    }
    return providers;
  }
  
  public static boolean reveal(String applicationName, String className, int line)
  {
    for (ISourceRevealer revealer : sSourceRevealers) {
      try
      {
        if (revealer.reveal(applicationName, className, line)) {
          return true;
        }
      }
      catch (Throwable localThrowable) {}
    }
    return false;
  }
  
  public static boolean revealMethod(String fqmn, String fileName, int linenumber, String perspective)
  {
    for (ISourceRevealer revealer : sSourceRevealers) {
      try
      {
        if (revealer.revealMethod(fqmn, fileName, linenumber, perspective)) {
          return true;
        }
      }
      catch (Throwable localThrowable) {}
    }
    return false;
  }
}

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

import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
import com.android.ddmlib.IDevice;
import java.util.Map;

class LogCatMonitor$1
  implements AndroidDebugBridge.IDeviceChangeListener
{
  LogCatMonitor$1(LogCatMonitor paramLogCatMonitor) {}
  
  public void deviceDisconnected(IDevice device)
  {
    LogCatMonitor.access$0(this$0, device.getSerialNumber());
    LogCatMonitor.access$1(this$0).remove(device.getSerialNumber());
  }
  
  public void deviceConnected(IDevice device) {}
  
  public void deviceChanged(IDevice device, int changeMask) {}
}

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

import com.android.ddmlib.Log.LogLevel;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;

class LogCatMonitor$2
  implements IPropertyChangeListener
{
  LogCatMonitor$2(LogCatMonitor paramLogCatMonitor) {}
  
  public void propertyChange(PropertyChangeEvent event)
  {
    if (("ddms.logcat.automonitor".equals(event.getProperty())) && 
      (event.getNewValue().equals(Boolean.valueOf(false)))) {
      LogCatMonitor.access$2(this$0);
    } else if ("ddms.logcat.auotmonitor.level".equals(event.getProperty())) {
      LogCatMonitor.access$3(this$0, 
        Log.LogLevel.getByString((String)event.getNewValue()).getPriority());
    }
  }
}

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

import com.android.ddmlib.IDevice;
import com.android.ddmlib.logcat.LogCatMessage;
import com.android.ddmuilib.logcat.ILogCatBufferChangeListener;
import java.util.List;

class LogCatMonitor$3
  implements ILogCatBufferChangeListener
{
  LogCatMonitor$3(LogCatMonitor paramLogCatMonitor, IDevice paramIDevice) {}
  
  public void bufferChanged(List<LogCatMessage> addedMessages, List<LogCatMessage> deletedMessages)
  {
    LogCatMonitor.access$4(this$0, addedMessages, val$device);
  }
}

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

import com.android.ddmlib.IDevice;
import co
1 2 3 4 5 6 7 8

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