com.android.ide.eclipse.monitor_22.6.2.201403212018

16:34:18.065 INFO  jd.cli.Main - Decompiling com.android.ide.eclipse.monitor_22.6.2.201403212018.jar
package com.android.ide.eclipse.monitor;

import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

public class AndroidPreferencePage
  extends PreferencePage
  implements IWorkbenchPreferencePage
{
  public AndroidPreferencePage()
  {
    super("");
    setPreferenceStore(MonitorPlugin.getDefault().getPreferenceStore());
  }
  
  public void init(IWorkbench paramIWorkbench) {}
  
  protected Control createContents(Composite paramComposite)
  {
    return null;
  }
}

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

import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

public class MonitorActionBarAdvisor
  extends ActionBarAdvisor
{
  private ActionFactory.IWorkbenchAction mQuitAction;
  private ActionFactory.IWorkbenchAction mCopyAction;
  private ActionFactory.IWorkbenchAction mSelectAllAction;
  private ActionFactory.IWorkbenchAction mFindAction;
  private ActionFactory.IWorkbenchAction mOpenPerspectiveAction;
  private ActionFactory.IWorkbenchAction mResetPerspectiveAction;
  private ActionFactory.IWorkbenchAction mPreferencesAction;
  private ActionFactory.IWorkbenchAction mAboutAction;
  
  public MonitorActionBarAdvisor(IActionBarConfigurer paramIActionBarConfigurer)
  {
    super(paramIActionBarConfigurer);
  }
  
  protected void makeActions(IWorkbenchWindow paramIWorkbenchWindow)
  {
    mQuitAction = ActionFactory.QUIT.create(paramIWorkbenchWindow);
    register(mQuitAction);
    mCopyAction = ActionFactory.COPY.create(paramIWorkbenchWindow);
    register(mCopyAction);
    mSelectAllAction = ActionFactory.SELECT_ALL.create(paramIWorkbenchWindow);
    register(mSelectAllAction);
    mFindAction = ActionFactory.FIND.create(paramIWorkbenchWindow);
    mFindAction.setText("Find...");
    register(mFindAction);
    mOpenPerspectiveAction = ActionFactory.OPEN_PERSPECTIVE_DIALOG.create(paramIWorkbenchWindow);
    register(mOpenPerspectiveAction);
    mResetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE.create(paramIWorkbenchWindow);
    register(mResetPerspectiveAction);
    mPreferencesAction = ActionFactory.PREFERENCES.create(paramIWorkbenchWindow);
    register(mPreferencesAction);
    mAboutAction = ActionFactory.ABOUT.create(paramIWorkbenchWindow);
    register(mAboutAction);
  }
  
  protected void fillMenuBar(IMenuManager paramIMenuManager)
  {
    MenuManager localMenuManager1 = new MenuManager("&File", "file");
    MenuManager localMenuManager2 = new MenuManager("&Edit", "edit");
    MenuManager localMenuManager3 = new MenuManager("&Help", "help");
    MenuManager localMenuManager4 = new MenuManager("&Window", "window");
    paramIMenuManager.add(localMenuManager1);
    paramIMenuManager.add(localMenuManager2);
    paramIMenuManager.add(new GroupMarker("additions"));
    paramIMenuManager.add(localMenuManager4);
    paramIMenuManager.add(localMenuManager3);
    localMenuManager1.add(new GroupMarker("additions"));
    localMenuManager1.add(mQuitAction);
    localMenuManager2.add(mCopyAction);
    localMenuManager2.add(mSelectAllAction);
    localMenuManager2.add(mFindAction);
    localMenuManager4.add(mOpenPerspectiveAction);
    localMenuManager4.add(mResetPerspectiveAction);
    localMenuManager4.add(new GroupMarker("additions"));
    localMenuManager4.add(mPreferencesAction);
    localMenuManager3.add(new GroupMarker("additions"));
    localMenuManager3.add(mAboutAction);
  }
}

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

import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;

class MonitorApplication$1
  implements Runnable
{
  MonitorApplication$1(MonitorApplication paramMonitorApplication, Display paramDisplay, IWorkbench paramIWorkbench) {}
  
  public void run()
  {
    if (!val$display.isDisposed()) {
      val$workbench.close();
    }
  }
}

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

import com.android.prefs.AndroidLocation;
import com.android.sdklib.SdkManager;
import com.android.sdkstats.DdmsPreferenceStore;
import com.android.sdkstats.SdkStatsService;
import com.android.sdkuilib.internal.repository.ui.AdtUpdateDialog;
import com.android.utils.ILogger;
import com.android.utils.NullLogger;
import java.io.File;
import java.net.URI;
import java.net.URL;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public class MonitorApplication
  implements IApplication
{
  private static final String SDK_PATH_ENVVAR = "com.android.sdk.path";
  private static final String MONITOR_WORKSPACE_PATH = "monitor-workspace";
  
  public Object start(IApplicationContext paramIApplicationContext)
    throws Exception
  {
    Display localDisplay = PlatformUI.createDisplay();
    Location localLocation = Platform.getInstanceLocation();
    IPath localIPath = new Path(AndroidLocation.getFolder()).append("monitor-workspace");
    localLocation.set(localIPath.toFile().toURI().toURL(), true);
    String str = findSdkPath(localDisplay);
    if (!isValidSdkLocation(str)) {
      return Integer.valueOf(-1);
    }
    MonitorPlugin.getDefault().setSdkFolder(new File(str));
    ILogger localILogger = NullLogger.getLogger();
    SdkManager localSdkManager = SdkManager.createManager(str, localILogger);
    if (localSdkManager.getPlatformToolsVersion() == null)
    {
      boolean bool = MessageDialog.openQuestion(new Shell(localDisplay), "Monitor", "The platform tools package that provides adb is missing from your SDK installation. Monitor requires this package to work properly. Would you like to install that package now?");
      if (!bool) {
        return Integer.valueOf(-1);
      }
      AdtUpdateDialog localAdtUpdateDialog = new AdtUpdateDialog(new Shell(localDisplay), localILogger, str);
      localAdtUpdateDialog.installPlatformTools();
    }
    SdkStatsService localSdkStatsService = new SdkStatsService();
    localSdkStatsService.checkUserPermissionForPing(new Shell(localDisplay));
    try
    {
      int i = PlatformUI.createAndRunWorkbench(localDisplay, new MonitorWorkbenchAdvisor());
      if (i == 1)
      {
        localInteger = IApplication.EXIT_RESTART;
        return localInteger;
      }
      Integer localInteger = IApplication.EXIT_OK;
      return localInteger;
    }
    finally
    {
      localDisplay.dispose();
    }
  }
  
  public void stop()
  {
    if (!PlatformUI.isWorkbenchRunning()) {
      return;
    }
    final IWorkbench localIWorkbench = PlatformUI.getWorkbench();
    final Display localDisplay = localIWorkbench.getDisplay();
    localDisplay.syncExec(new Runnable()
    {
      public void run()
      {
        if (!localDisplay.isDisposed()) {
          localIWorkbench.close();
        }
      }
    });
  }
  
  private String findSdkPath(Display paramDisplay)
  {
    String str1 = System.getProperty("com.android.sdk.path");
    if (isValidSdkLocation(str1)) {
      return str1;
    }
    str1 = System.getenv("com.android.sdk.path");
    if (isValidSdkLocation(str1)) {
      return str1;
    }
    Location localLocation = Platform.getInstallLocation();
    if ((localLocation != null) && (localLocation.getURL() != null))
    {
      File localFile = new File(localLocation.getURL().getFile()).getParentFile();
      if (localFile != null)
      {
        String str2 = localFile.getParent();
        if (str2 != null)
        {
          str1 = new File(str2).getParent();
          if (isValidSdkLocation(str1))
          {
            MonitorPlugin.getDdmsPreferenceStore().setLastSdkPath(str1);
            return str1;
          }
        }
      }
    }
    str1 = MonitorPlugin.getDdmsPreferenceStore().getLastSdkPath();
    if (isValidSdkLocation(str1)) {
      return str1;
    }
    str1 = getSdkLocationFromUser(new Shell(paramDisplay));
    if (isValidSdkLocation(str1)) {
      MonitorPlugin.getDdmsPreferenceStore().setLastSdkPath(str1);
    }
    return str1;
  }
  
  private boolean isValidSdkLocation(String paramString)
  {
    if (paramString == null) {
      return false;
    }
    if (paramString.trim().length() == 0) {
      return false;
    }
    SdkToolsLocator localSdkToolsLocator = new SdkToolsLocator(new File(paramString));
    return localSdkToolsLocator.isValidInstallation() == SdkToolsLocator.SdkInstallStatus.VALID;
  }
  
  private String getSdkLocationFromUser(Shell paramShell)
  {
    SdkLocationChooserDialog localSdkLocationChooserDialog = new SdkLocationChooserDialog(paramShell);
    if (localSdkLocationChooserDialog.open() == 0) {
      return localSdkLocationChooserDialog.getPath();
    }
    return null;
  }
}

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

import com.android.sdkstats.DdmsPreferenceStore;
import java.io.File;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class MonitorPlugin
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "com.android.ide.eclipse.monitor";
  private static MonitorPlugin sPlugin;
  private static final DdmsPreferenceStore sDdmsPreferenceStore = new DdmsPreferenceStore();
  private File mSdkFolder;
  
  public void start(BundleContext paramBundleContext)
    throws Exception
  {
    super.start(paramBundleContext);
    sPlugin = this;
  }
  
  public void stop(BundleContext paramBundleContext)
    throws Exception
  {
    sPlugin = null;
    super.stop(paramBundleContext);
  }
  
  public static MonitorPlugin getDefault()
  {
    return sPlugin;
  }
  
  public static ImageDescriptor getImageDescriptor(String paramString)
  {
    return imageDescriptorFromPlugin("com.android.ide.eclipse.monitor", paramString);
  }
  
  public static DdmsPreferenceStore getDdmsPreferenceStore()
  {
    return sDdmsPreferenceStore;
  }
  
  public void setSdkFolder(File paramFile)
  {
    mSdkFolder = paramFile;
  }
  
  public File getSdkFolder()
  {
    return mSdkFolder;
  }
}

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

import com.android.sdkstats.SdkStatsService;
import java.io.File;
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 MonitorStartup$1
  extends Job
{
  MonitorStartup$1(MonitorStartup paramMonitorStartup, String paramString)
  {
    super(paramString);
  }
  
  protected IStatus run(IProgressMonitor paramIProgressMonitor)
  {
    SdkStatsService localSdkStatsService = new SdkStatsService();
    File localFile = MonitorPlugin.getDefault().getSdkFolder();
    if (localFile == null) {
      return Status.OK_STATUS;
    }
    String str = new File(localFile, "tools").getAbsolutePath();
    MonitorStartup.access$0(localSdkStatsService, str);
    return Status.OK_STATUS;
  }
}

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

import com.android.sdkstats.SdkStatsService;
import java.io.File;
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;
import org.eclipse.ui.IStartup;

public class MonitorStartup
  implements IStartup
{
  public void earlyStartup()
  {
    Job local1 = new Job("Android SDK Ping")
    {
      protected IStatus run(IProgressMonitor paramAnonymousIProgressMonitor)
      {
        SdkStatsService localSdkStatsService = new SdkStatsService();
        File localFile = MonitorPlugin.getDefault().getSdkFolder();
        if (localFile == null) {
          return Status.OK_STATUS;
        }
        String str = new File(localFile, "tools").getAbsolutePath();
        MonitorStartup.ping(localSdkStatsService, str);
        return Status.OK_STATUS;
      }
    };
    local1.setPriority(50);
    local1.schedule();
  }
  
  /* Error */
  private static void ping(SdkStatsService paramSdkStatsService, String paramString)
  {
    // Byte code:
    //   0: new 31	java/util/Properties
    //   3: dup
    //   4: invokespecial 33	java/util/Properties:<init>	()V
    //   7: astore_2
    //   8: aload_1
    //   9: ifnull +24 -> 33
    //   12: aload_1
    //   13: invokevirtual 34	java/lang/String:length	()I
    //   16: ifle +17 -> 33
    //   19: new 40	java/io/File
    //   22: dup
    //   23: aload_1
    //   24: ldc 42
    //   26: invokespecial 44	java/io/File:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   29: astore_3
    //   30: goto +13 -> 43
    //   33: new 40	java/io/File
    //   36: dup
    //   37: ldc 42
    //   39: invokespecial 47	java/io/File:<init>	(Ljava/lang/String;)V
    //   42: astore_3
    //   43: aconst_null
    //   44: astore 4
    //   46: new 50	java/io/FileInputStream
    //   49: dup
    //   50: aload_3
    //   51: invokespecial 52	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   54: astore 4
    //   56: aload_2
    //   57: aload 4
    //   59: invokevirtual 55	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   62: goto +22 -> 84
    //   65: astore 5
    //   67: aload 4
    //   69: ifnull +12 -> 81
    //   72: aload 4
    //   74: invokevirtual 59	java/io/FileInputStream:close	()V
    //   77: goto +4 -> 81
    //   80: pop
    //   81: aload 5
    //   83: athrow
    //   84: aload 4
    //   86: ifnull +12 -> 98
    //   89: aload 4
    //   91: invokevirtual 59	java/io/FileInputStream:close	()V
    //   94: goto +4 -> 98
    //   97: pop
    //   98: aload_2
    //   99: ldc 62
    //   101: invokevirtual 64	java/util/Properties:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   104: astore 5
    //   106: aload 5
    //   108: ifnull +27 -> 135
    //   111: aload 5
    //   113: invokevirtual 34	java/lang/String:length	()I
    //   116: ifle +19 -> 135
    //   119: aload_0
    //   120: ldc 68
    //   122: aload 5
    //   124: invokevirtual 70	com/android/sdkstats/SdkStatsService:ping	(Ljava/lang/String;Ljava/lang/String;)V
    //   127: goto +8 -> 135
    //   130: pop
    //   131: goto +4 -> 135
    //   134: pop
    //   135: return
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	136	0	paramSdkStatsService	SdkStatsService
    //   0	136	1	paramString	String
    //   7	92	2	localProperties	java.util.Properties
    //   29	22	3	localFile	File
    //   44	46	4	localFileInputStream	java.io.FileInputStream
    //   65	17	5	localObject	Object
    //   104	19	5	str	String
    //   80	1	7	localIOException1	java.io.IOException
    //   97	1	8	localIOException2	java.io.IOException
    //   130	1	9	localFileNotFoundException	java.io.FileNotFoundException
    //   134	1	10	localIOException3	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   46	65	65	finally
    //   72	77	80	java/io/IOException
    //   89	94	97	java/io/IOException
    //   8	127	130	java/io/FileNotFoundException
    //   8	127	134	java/io/IOException
  }
}

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

import com.android.ide.eclipse.ddms.Perspective;
import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class MonitorWorkbenchAdvisor
  extends WorkbenchAdvisor
{
  public String getInitialWindowPerspectiveId()
  {
    return Perspective.ID;
  }
  
  public void initialize(IWorkbenchConfigurer paramIWorkbenchConfigurer)
  {
    super.initialize(paramIWorkbenchConfigurer);
    paramIWorkbenchConfigurer.setSaveAndRestore(true);
  }
  
  public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer paramIWorkbenchWindowConfigurer)
  {
    return new MonitorWorkbenchWindowAdvisor(paramIWorkbenchWindowConfigurer);
  }
}

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

import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class MonitorWorkbenchWindowAdvisor
  extends WorkbenchWindowAdvisor
{
  public MonitorWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer paramIWorkbenchWindowConfigurer)
  {
    super(paramIWorkbenchWindowConfigurer);
  }
  
  public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer paramIActionBarConfigurer)
  {
    return new MonitorActionBarAdvisor(paramIActionBarConfigurer);
  }
  
  public void preWindowOpen()
  {
    IWorkbenchWindowConfigurer localIWorkbenchWindowConfigurer = getWindowConfigurer();
    localIWorkbenchWindowConfigurer.setShowStatusLine(true);
    localIWorkbenchWindowConfigurer.setShowPerspectiveBar(true);
    localIWorkbenchWindowConfigurer.setTitle("Android Debug Monitor");
  }
}

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

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;

class SdkLocationChooserDialog$1
  implements ModifyListener
{
  SdkLocationChooserDialog$1(SdkLocationChooserDialog paramSdkLocationChooserDialog) {}
  
  public void modifyText(ModifyEvent paramModifyEvent)
  {
    SdkLocationChooserDialog.access$0(this$0);
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Text;

class SdkLocationChooserDialog$2
  extends SelectionAdapter
{
  SdkLocationChooserDialog$2(SdkLocationChooserDialog paramSdkLocationChooserDialog) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    DirectoryDialog localDirectoryDialog = new DirectoryDialog(this$0.getShell(), 4096);
    localDirectoryDialog.setText("Android SDK location");
    String str = localDirectoryDialog.open();
    if (str != null)
    {
      SdkLocationChooserDialog.access$1(this$0).setText(str);
      SdkLocationChooserDialog.access$0(this$0);
    }
  }
}

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

import java.io.File;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
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.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class SdkLocationChooserDialog
  extends Dialog
{
  private static final String TITLE = "Android Device Monitor";
  private static final String DEFAULT_MESSAGE = "Provide the path to the Android SDK";
  private Label mStatusLabel;
  private Text mTextBox;
  private String mPath;
  
  public SdkLocationChooserDialog(Shell paramShell)
  {
    super(paramShell);
  }
  
  protected Control createDialogArea(Composite paramComposite)
  {
    getShell().setText("Android Device Monitor");
    Composite localComposite = new Composite((Composite)super.createDialogArea(paramComposite), 0);
    localComposite.setLayout(new GridLayout(2, false));
    localComposite.setLayoutData(new GridData(1808));
    Label localLabel = new Label(localComposite, 0);
    localLabel.setText("Provide the path to the Android SDK");
    GridDataFactory.fillDefaults().span(2, 1).applyTo(localLabel);
    mTextBox = new Text(localComposite, 2048);
    mTextBox.setLayoutData(new GridData(768));
    GridDataFactory.fillDefaults().hint(SwtUtils.getFontWidth(mTextBox) * 80, -1).applyTo(mTextBox);
    mTextBox.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent paramAnonymousModifyEvent)
      {
        SdkLocationChooserDialog.this.validateInstall();
      }
    });
    Button localButton = new Button(localComposite, 8);
    localButton.setText("Browse");
    localButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        DirectoryDialog localDirectoryDialog = new DirectoryDialog(getShell(), 4096);
        localDirectoryDialog.setText("Android SDK location");
        String str = localDirectoryDialog.open();
        if (str != null)
        {
          mTextBox.setText(str);
          SdkLocationChooserDialog.this.validateInstall();
        }
      }
    });
    mStatusLabel = new Label(localComposite, 64);
    mStatusLabel.setText("");
    mStatusLabel.setForeground(getShell().getDisplay().getSystemColor(3));
    GridDataFactory.fillDefaults().span(2, 1).applyTo(mStatusLabel);
    return super.createDialogArea(paramComposite);
  }
  
  private void validateInstall()
  {
    SdkToolsLocator localSdkToolsLocator = new SdkToolsLocator(new File(mTextBox.getText()));
    SdkToolsLocator.SdkInstallStatus localSdkInstallStatus = localSdkToolsLocator.isValidInstallation();
    if (localSdkInstallStatus.isValid())
    {
      mStatusLabel.setText("");
      getButton(0).setEnabled(true);
    }
    else
    {
      mStatusLabel.setText(localSdkInstallStatus.getErrorMessage());
      mStatusLabel.pack();
      getButton(0).setEnabled(false);
    }
  }
  
  public boolean close()
  {
    mPath = mTextBox.getText();
    return super.close();
  }
  
  public String getPath()
  {
    return mPath;
  }
}

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

public class SdkToolsLocator$SdkInstallStatus
{
  private boolean mValid;
  private String mCause;
  public static final SdkInstallStatus VALID = new SdkInstallStatus(true, "");
  
  private SdkToolsLocator$SdkInstallStatus(boolean paramBoolean, String paramString)
  {
    mValid = paramBoolean;
    mCause = paramString;
  }
  
  public boolean isValid()
  {
    return mValid;
  }
  
  public String getErrorMessage()
  {
    return mCause;
  }
  
  public static SdkInstallStatus invalidInstallation(String paramString)
  {
    return new SdkInstallStatus(false, paramString);
  }
}

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

import com.android.SdkConstants;
import java.io.File;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class SdkToolsLocator
{
  public static final String PLATFORM_EXECUTABLE_EXTENSION = SdkConstants.CURRENT_PLATFORM == 2 ? ".exe" : "";
  public static final String PLATFORM_SCRIPT_EXTENSION = SdkConstants.CURRENT_PLATFORM == 2 ? ".bat" : "";
  public static final String FN_HPROF_CONV = "hprof-conv" + PLATFORM_EXECUTABLE_EXTENSION;
  public static final String FN_TRACEVIEW = "traceview" + PLATFORM_SCRIPT_EXTENSION;
  private final File mSdkFolder;
  
  public SdkToolsLocator(File paramFile)
  {
    mSdkFolder = paramFile;
  }
  
  public String getAdbLocation()
  {
    return new File(getSdkPlatformToolsFolder(), SdkConstants.FN_ADB).getAbsolutePath();
  }
  
  public String getTraceViewLocation()
  {
    return new File(getSdkToolsFolder(), FN_TRACEVIEW).getAbsolutePath();
  }
  
  public String getHprofConvLocation()
  {
    return new File(getSdkToolsFolder(), FN_HPROF_CONV).getAbsolutePath();
  }
  
  private String getSdkToolsFolder()
  {
    return new File(mSdkFolder, "tools").getAbsolutePath();
  }
  
  private String getSdkPlatformToolsFolder()
  {
    return new File(mSdkFolder, "platform-tools").getAbsolutePath();
  }
  
  public SdkInstallStatus isValidInstallation()
  {
    List localList = Arrays.asList(new String[] { getTraceViewLocation(), getHprofConvLocation() });
    Iterator localIterator = localList.iterator();
    while (localIterator.hasNext())
    {
      String str = (String)localIterator.next();
      File localFile = new File(str);
      if (!localFile.exists()) {
        return SdkInstallStatus.invalidInstallation(str + " not present.");
      }
      if (!localFile.canExecute()) {
        return SdkInstallStatus.invalidInstallation(str + " is not executable.");
      }
    }
    return SdkInstallStatus.VALID;
  }
  
  public static class SdkInstallStatus
  {
    private boolean mValid;
    private String mCause;
    public static final SdkInstallStatus VALID = new SdkInstallStatus(true, "");
    
    private SdkInstallStatus(boolean paramBoolean, String paramString)
    {
      mValid = paramBoolean;
      mCause = paramString;
    }
    
    public boolean isValid()
    {
      return mValid;
    }
    
    public String getErrorMessage()
    {
      return mCause;
    }
    
    public static SdkInstallStatus invalidInstallation(String paramString)
    {
      return new SdkInstallStatus(false, paramString);
    }
  }
}

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

import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Control;

public class SwtUtils
{
  public static int getFontWidth(Control paramControl)
  {
    GC localGC = new GC(paramControl);
    int i = localGC.getFontMetrics().getAverageCharWidth();
    localGC.dispose();
    return i;
  }
}

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

import com.android.ide.eclipse.ddms.IToolsLocator;

public class ToolsLocator
  implements IToolsLocator
{
  private SdkToolsLocator mLocator = new SdkToolsLocator(MonitorPlugin.getDefault().getSdkFolder());
  
  public String getAdbLocation()
  {
    return mLocator.getAdbLocation();
  }
  
  public String getTraceViewLocation()
  {
    return mLocator.getTraceViewLocation();
  }
  
  public String getHprofConvLocation()
  {
    return mLocator.getHprofConvLocation();
  }
}

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

public class AvdManagerAction
  extends SdkManagerAction
{
  protected String getAndroidBatArgument()
  {
    return "avd";
  }
}

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

import com.android.SdkConstants;
import com.android.ide.eclipse.monitor.MonitorPlugin;
import java.io.File;
import java.io.IOException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PlatformUI;

public class SdkManagerAction
  implements IWorkbenchWindowActionDelegate
{
  public void run(IAction paramIAction)
  {
    File localFile1 = MonitorPlugin.getDefault().getSdkFolder();
    if (localFile1 != null)
    {
      File localFile2 = new File(localFile1, "tools");
      File localFile3 = new File(localFile2, SdkConstants.androidCmdName());
      if (localFile3.exists())
      {
        String[] arrayOfString = { localFile3.getAbsolutePath(), getAndroidBatArgument() };
        try
        {
          Runtime.getRuntime().exec(arrayOfString);
        }
        catch (IOException localIOException)
        {
          IWorkbenchWindow localIWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
          if (localIWorkbenchWindow != null) {
            ErrorDialog.openError(localIWorkbenchWindow.getShell(), "Monitor", "Error while launching SDK Manager", new Status(4, "com.android.ide.eclipse.monitor", "Error while launching SDK Manager", localIOException));
          }
        }
      }
    }
  }
  
  protected String getAndroidBatArgument()
  {
    return "sdk";
  }
  
  public void selectionChanged(IAction paramIAction, ISelection paramISelection) {}
  
  public void dispose() {}
  
  public void init(IWorkbenchWindow paramIWorkbenchWindow) {}
}

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

import com.android.ddmlib.DebugPortManager.IDebugPortProvider;
import com.android.ddmlib.IDevice;
import com.android.ide.eclipse.ddms.DdmsPlugin;
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 paramIDevice, String paramString)
  {
    if (mMap != null)
    {
      Map localMap = (Map)mMap.get(paramIDevice.getSerialNumber());
      if (localMap != null)
      {
        Integer localInteger = (Integer)localMap.get(paramString);
        if (localInteger != null) {
          return localInteger.intValue();
        }
      }
    }
    return -1;
  }
  
  public Map<String, Map<String, Integer>> getPortList()
  {
    return mMap;
  }
  
  private void computePortList()
  {
    mMap = new HashMap();
    IPreferenceStore localIPreferenceStore = DdmsPlugin.getDefault().getPreferenceStore();
    String str1 = localIPreferenceStore.getString("android.staticPortList");
    if ((str1 != null) && (str1.length() > 0))
    {
      String[] arrayOfString1 = str1.split("\\|");
      String[] arrayOfString2;
      int j = (arrayOfString2 = arrayOfString1).length;
      for (int i = 0; i < j; i++)
      {
        String str2 = arrayOfString2[i];
        String[] arrayOfString3 = str2.split(":");
        String str3 = null;
        if (arrayOfString3.length == 3) {
          str3 = arrayOfString3[2];
        } else {
          str3 = "emulator-5554";
        }
        Object localObject = (Map)mMap.get(str3);
        if (localObject == null)
        {
          localObject = new HashMap();
          mMap.put(str3, localObject);
        }
        ((Map)localObject).put(arrayOfString3[0], Integer.valueOf(arrayOfString3[1]));
      }
    }
  }
  
  public void setPortList(Map<String, Map<String, Integer>> paramMap)
  {
    mMap.clear();
    mMap.putAll(paramMap);
    StringBuilder localStringBuilder = new StringBuilder();
    Set localSet1 = paramMap.keySet();
    Object localObject = localSet1.iterator();
    while (((Iterator)localObject).hasNext())
    {
      str1 = (String)((Iterator)localObject).next();
      Map localMap = (Map)paramMap.get(str1);
      if (localMap != null)
      {
        Set localSet2 = localMap.keySet();
        Iterator localIterator = localSet2.iterator();
        while (localIterator.hasNext())
        {
          String str2 = (String)localIterator.next();
          Integer localInteger = (Integer)localMap.get(str2);
          if (localInteger != null) {
            localStringBuilder.append(str2).append(':').append(localInteger.intValue()).append(':').append(str1).append('|');
          }
        }
      }
    }
    String str1 = localStringBuilder.toString();
    localObject = DdmsPlugin.getDefault().getPreferenceStore();
    ((IPreferenceStore)localObject).setValue("android.staticPortList", str1);
  }
}

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

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class StaticPortConfigDialog$1
  implements Listener
{
  StaticPortConfigDialog$1(StaticPortConfigDialog paramStaticPortConfigDialog) {}
  
  public void handleEvent(Event paramEvent)
  {
    doit = true;
  }
}

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

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

class StaticPortConfigDialog$2
  extends SelectionAdapter
{
  StaticPortConfigDialog$2(StaticPortConfigDialog paramStaticPortConfigDialog) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    StaticPortEditDialog localStaticPortEditDialog = new StaticPortEditDialog(StaticPortConfigDialog.access$0(this$0), StaticPortConfigDialog.access$1(this$0));
    if (localStaticPortEditDialog.open())
    {
      String str1 = localStaticPortEditDialog.getDeviceSN();
      String str2 = localStaticPortEditDialog.getAppName();
      int i = localStaticPortEditDialog.getPortNumber();
      StaticPortConfigDialog.access$2(this$0, str1, str2, i);
    }
  }
}

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

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

class StaticPortConfigDialog$3
  extends SelectionAdapter
{
  StaticPortConfigDialog$3(StaticPortConfigDialog paramStaticPortConfigDialog) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    int i = StaticPortConfigDialog.access$3(this$0).getSelectionIndex();
    String str1 = StaticPortConfigDialog.access$4(this$0, i);
    String str2 = StaticPortConfigDialog.access$5(this$0, i);
    String str3 = StaticPortConfigDialog.access$6(this$0, i);
    StaticPortEditDialog localStaticPortEditDialog = new StaticPortEditDialog(StaticPortConfigDialog.access$0(this$0), StaticPortConfigDialog.access$1(this$0), str1, str2, str3);
    if (localStaticPortEditDialog.open())
    {
      String str4 = localStaticPortEditDialog.getDeviceSN();
      String str5 = localStaticPortEditDialog.getAppName();
      int j = localStaticPortEditDialog.getPortNumber();
      StaticPortConfigDialog.access$7(this$0, i, str4, str5, j);
    }
  }
}

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

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

class StaticPortConfigDialog$4
  extends SelectionAdapter
{
  StaticPortConfigDialog$4(StaticPortConfigDialog paramStaticPortConfigDialog) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    int i = StaticPortConfigDialog.access$3(this$0).getSelectionIndex();
    StaticPortConfigDialog.access$8(this$0, i);
  }
}

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

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

class StaticPortConfigDialog$5
  extends SelectionAdapter
{
  StaticPortConfigDialog$5(StaticPortConfigDialog paramStaticPortConfigDialog) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    StaticPortConfigDialog.access$9(this$0);
    StaticPortConfigDialog.access$0(this$0).close();
  }
}

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

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

class StaticPortConfigDialog$6
  extends SelectionAdapter
{
  StaticPortConfigDialog$6(StaticPortConfigDialog paramStaticPortConfigDialog) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    StaticPortConfigDialog.access$0(this$0).close();
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Table;

class StaticPortConfigDialog$7
  extends SelectionAdapter
{
  StaticPortConfigDialog$7(StaticPortConfigDialog paramStaticPortConfigDialog, Button paramButton1, Button paramButton2) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
1 2

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