hierarchyviewer2

anager("&Pixel Perfect");
    pixelPerfect.add(SavePixelPerfectAction.getAction(getShell()));
    pixelPerfect.add(RefreshPixelPerfectAction.getAction());
    pixelPerfect.add(RefreshPixelPerfectTreeAction.getAction());
    pixelPerfect.add(PixelPerfectAutoRefreshAction.getAction());
    pixelPerfect.add(new Separator());
    pixelPerfect.add(LoadOverlayAction.getAction(getShell()));
    pixelPerfect.add(ShowOverlayAction.getAction());
    
    mm.add(pixelPerfect);
    
    mm.updateAll(true);
    
    mDeviceViewButton.setSelection(false);
    mDeviceViewButton.setImage(mDeviceViewImage);
    
    mTreeViewButton.setSelection(false);
    mTreeViewButton.setImage(mTreeViewImage);
    
    mPixelPerfectButton.setSelection(true);
    mPixelPerfectButton.setImage(mPixelPerfectSelectedImage);
    
    mMainWindowStackLayout.topControl = mPixelPerfectPanel;
    
    mMainWindow.layout();
    
    mPixelPerfectLoupe.setFocus();
    
    mTreeViewControls.setVisible(false);
  }
  
  private SelectionListener deviceViewButtonSelectionListener = new SelectionListener()
  {
    public void widgetDefaultSelected(SelectionEvent e) {}
    
    public void widgetSelected(SelectionEvent e)
    {
      mDeviceViewButton.setSelection(true);
      showDeviceSelector();
    }
  };
  private SelectionListener treeViewButtonSelectionListener = new SelectionListener()
  {
    public void widgetDefaultSelected(SelectionEvent e) {}
    
    public void widgetSelected(SelectionEvent e)
    {
      mTreeViewButton.setSelection(true);
      showTreeView();
    }
  };
  private SelectionListener pixelPerfectButtonSelectionListener = new SelectionListener()
  {
    public void widgetDefaultSelected(SelectionEvent e) {}
    
    public void widgetSelected(SelectionEvent e)
    {
      mPixelPerfectButton.setSelection(true);
      showPixelPerfect();
    }
  };
  private SelectionListener onBlackWhiteSelectionListener = new SelectionListener()
  {
    public void widgetDefaultSelected(SelectionEvent e) {}
    
    public void widgetSelected(SelectionEvent e)
    {
      if (mLayoutViewer.getOnBlack())
      {
        mLayoutViewer.setOnBlack(false);
        mOnBlackWhiteButton.setImage(mOnBlackImage);
      }
      else
      {
        mLayoutViewer.setOnBlack(true);
        mOnBlackWhiteButton.setImage(mOnWhiteImage);
      }
    }
  };
  private SelectionListener showExtrasSelectionListener = new SelectionListener()
  {
    public void widgetDefaultSelected(SelectionEvent e) {}
    
    public void widgetSelected(SelectionEvent e)
    {
      mLayoutViewer.setShowExtras(mShowExtras.getSelection());
    }
  };
  private SelectionListener loadAllViewsSelectionListener = new SelectionListener()
  {
    public void widgetDefaultSelected(SelectionEvent e) {}
    
    public void widgetSelected(SelectionEvent e)
    {
      mShowExtras.setSelection(true);
      showExtrasSelectionListener.widgetSelected(null);
    }
  };
  private TreeViewModel.ITreeChangeListener mTreeChangeListener = new TreeViewModel.ITreeChangeListener()
  {
    public void selectionChanged() {}
    
    public void treeChanged()
    {
      Display.getDefault().syncExec(new Runnable()
      {
        public void run()
        {
          if (TreeViewModel.getModel().getTree() == null)
          {
            showDeviceSelector();
            mTreeViewButton.setEnabled(false);
          }
          else
          {
            showTreeView();
            mTreeViewButton.setEnabled(true);
          }
        }
      });
    }
    
    public void viewportChanged() {}
    
    public void zoomChanged() {}
  };
  private PixelPerfectModel.IImageChangeListener mImageChangeListener = new PixelPerfectModel.IImageChangeListener()
  {
    public void crosshairMoved() {}
    
    public void treeChanged() {}
    
    public void imageChanged() {}
    
    public void imageLoaded()
    {
      Display.getDefault().syncExec(new Runnable()
      {
        public void run()
        {
          if (PixelPerfectModel.getModel().getImage() == null)
          {
            mPixelPerfectButton.setEnabled(false);
            showDeviceSelector();
          }
          else
          {
            mPixelPerfectButton.setEnabled(true);
            showPixelPerfect();
          }
        }
      });
    }
    
    public void overlayChanged() {}
    
    public void overlayTransparencyChanged() {}
    
    public void selectionChanged() {}
    
    public void zoomChanged() {}
  };
  
  public static void main(String[] args)
  {
    Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler(null));
    
    Display.setAppName("HierarchyViewer");
    new HierarchyViewerApplication().run();
  }
}

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

class HierarchyViewerApplicationDirector$1
  implements Runnable
{
  HierarchyViewerApplicationDirector$1(HierarchyViewerApplicationDirector paramHierarchyViewerApplicationDirector, String paramString, Runnable paramRunnable) {}
  
  public void run()
  {
    HierarchyViewerApplication.getMainWindow().startTask(val$taskName);
    val$task.run();
    HierarchyViewerApplication.getMainWindow().endTask();
  }
}

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

import com.android.SdkConstants;
import com.android.hierarchyviewerlib.HierarchyViewerDirector;
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class HierarchyViewerApplicationDirector
  extends HierarchyViewerDirector
{
  private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
  
  public static HierarchyViewerDirector createDirector()
  {
    return sDirector = new HierarchyViewerApplicationDirector();
  }
  
  public void terminate()
  {
    super.terminate();
    mExecutor.shutdown();
  }
  
  public String getAdbLocation()
  {
    String hvParentLocation = System.getProperty("com.android.hierarchyviewer.bindir");
    if ((hvParentLocation != null) && (hvParentLocation.length() != 0))
    {
      File platformTools = new File(new File(hvParentLocation).getParent(), "platform-tools");
      if (platformTools.isDirectory()) {
        return platformTools.getAbsolutePath() + File.separator + SdkConstants.FN_ADB;
      }
      String androidOut = System.getenv("ANDROID_HOST_OUT");
      if (androidOut != null) {
        return androidOut + File.separator + "bin" + File.separator + SdkConstants.FN_ADB;
      }
    }
    return SdkConstants.FN_ADB;
  }
  
  public void executeInBackground(final String taskName, final Runnable task)
  {
    mExecutor.execute(new Runnable()
    {
      public void run()
      {
        HierarchyViewerApplication.getMainWindow().startTask(taskName);
        task.run();
        HierarchyViewerApplication.getMainWindow().endTask();
      }
    });
  }
}

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

import com.android.ddmuilib.ImageLoader;
import com.android.hierarchyviewer.AboutDialog;
import com.android.hierarchyviewerlib.HierarchyViewerDirector;
import com.android.hierarchyviewerlib.actions.ImageAction;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class AboutAction
  extends Action
  implements ImageAction
{
  private static AboutAction sAction;
  private Image mImage;
  private Shell mShell;
  
  private AboutAction(Shell shell)
  {
    super("&About");
    mShell = shell;
    setAccelerator(SWT.MOD1 + 65);
    ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class);
    mImage = imageLoader.loadImage("sdk-hierarchyviewer-16.png", Display.getDefault());
    setImageDescriptor(ImageDescriptor.createFromImage(mImage));
    setToolTipText("Shows the about dialog");
  }
  
  public static AboutAction getAction(Shell shell)
  {
    if (sAction == null) {
      sAction = new AboutAction(shell);
    }
    return sAction;
  }
  
  public void run()
  {
    new AboutDialog(mShell).open();
  }
  
  public Image getImage()
  {
    return mImage;
  }
}

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

import com.android.ddmuilib.ImageLoader;
import com.android.hierarchyviewerlib.HierarchyViewerDirector;
import com.android.hierarchyviewerlib.actions.ImageAction;
import com.android.hierarchyviewerlib.actions.TreeViewEnabledAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

public class LoadAllViewsAction
  extends TreeViewEnabledAction
  implements ImageAction
{
  private static LoadAllViewsAction sAction;
  private Image mImage;
  
  private LoadAllViewsAction()
  {
    super("Load All &Views");
    setAccelerator(SWT.MOD1 + 86);
    ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class);
    mImage = imageLoader.loadImage("load-all-views.png", Display.getDefault());
    setImageDescriptor(ImageDescriptor.createFromImage(mImage));
    setToolTipText("Load all view images");
  }
  
  public static LoadAllViewsAction getAction()
  {
    if (sAction == null) {
      sAction = new LoadAllViewsAction();
    }
    return sAction;
  }
  
  public void run()
  {
    HierarchyViewerDirector.getDirector().loadAllViews();
  }
  
  public Image getImage()
  {
    return mImage;
  }
}

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

import com.android.hierarchyviewer.HierarchyViewerApplication;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.SWT;

public class QuitAction
  extends Action
{
  private static QuitAction sAction;
  
  private QuitAction()
  {
    super("E&xit");
    setAccelerator(SWT.MOD1 + 81);
  }
  
  public static QuitAction getAction()
  {
    if (sAction == null) {
      sAction = new QuitAction();
    }
    return sAction;
  }
  
  public void run()
  {
    HierarchyViewerApplication.getMainWindow().close();
  }
}

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

import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import org.eclipse.swt.graphics.Image;

class ShowOverlayAction$1
  implements Runnable
{
  ShowOverlayAction$1(ShowOverlayAction paramShowOverlayAction) {}
  
  public void run()
  {
    Image overlayImage = PixelPerfectModel.getModel().getOverlayImage();
    this$0.setEnabled(overlayImage != null);
  }
}

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

import com.android.hierarchyviewerlib.models.PixelPerfectModel;

class ShowOverlayAction$2
  implements Runnable
{
  ShowOverlayAction$2(ShowOverlayAction paramShowOverlayAction) {}
  
  public void run()
  {
    this$0.setEnabled(PixelPerfectModel.getModel().getOverlayImage() != null);
  }
}

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

import com.android.ddmuilib.ImageLoader;
import com.android.hierarchyviewer.HierarchyViewerApplication;
import com.android.hierarchyviewerlib.HierarchyViewerDirector;
import com.android.hierarchyviewerlib.actions.ImageAction;
import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import com.android.hierarchyviewerlib.models.PixelPerfectModel.IImageChangeListener;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;

public class ShowOverlayAction
  extends Action
  implements ImageAction, PixelPerfectModel.IImageChangeListener
{
  private static ShowOverlayAction sAction;
  private Image mImage;
  
  private ShowOverlayAction()
  {
    super("Show In &Loupe", 2);
    setAccelerator(SWT.MOD1 + 76);
    ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class);
    mImage = imageLoader.loadImage("show-overlay.png", Display.getDefault());
    setImageDescriptor(ImageDescriptor.createFromImage(mImage));
    setToolTipText("Show the overlay in the loupe view");
    setEnabled(PixelPerfectModel.getModel().getOverlayImage() != null);
    PixelPerfectModel.getModel().addImageChangeListener(this);
  }
  
  public static ShowOverlayAction getAction()
  {
    if (sAction == null) {
      sAction = new ShowOverlayAction();
    }
    return sAction;
  }
  
  public void run()
  {
    HierarchyViewerApplication.getMainWindow().showOverlayInLoupe(sAction.isChecked());
  }
  
  public Image getImage()
  {
    return mImage;
  }
  
  public void crosshairMoved() {}
  
  public void treeChanged() {}
  
  public void imageChanged() {}
  
  public void imageLoaded()
  {
    Display.getDefault().syncExec(new Runnable()
    {
      public void run()
      {
        Image overlayImage = PixelPerfectModel.getModel().getOverlayImage();
        setEnabled(overlayImage != null);
      }
    });
  }
  
  public void overlayChanged()
  {
    Display.getDefault().syncExec(new Runnable()
    {
      public void run()
      {
        setEnabled(PixelPerfectModel.getModel().getOverlayImage() != null);
      }
    });
  }
  
  public void overlayTransparencyChanged() {}
  
  public void selectionChanged() {}
  
  public void zoomChanged() {}
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewer.actions.ShowOverlayAction
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.android.hierarchyviewer.util;

import com.android.hierarchyviewerlib.actions.ImageAction;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;

public class ActionButton
  implements IPropertyChangeListener, SelectionListener
{
  private Button mButton;
  private Action mAction;
  
  public ActionButton(Composite parent, ImageAction action)
  {
    mAction = ((Action)action);
    if (mAction.getStyle() == 2) {
      mButton = new Button(parent, 32);
    } else {
      mButton = new Button(parent, 8);
    }
    mButton.setText(action.getText());
    mButton.setImage(action.getImage());
    mAction.addPropertyChangeListener(this);
    mButton.addSelectionListener(this);
    mButton.setToolTipText(action.getToolTipText());
    mButton.setEnabled(mAction.isEnabled());
  }
  
  public void propertyChange(PropertyChangeEvent e)
  {
    if (e.getProperty().toUpperCase().equals("ENABLED")) {
      mButton.setEnabled(((Boolean)e.getNewValue()).booleanValue());
    } else if (e.getProperty().toUpperCase().equals("CHECKED")) {
      mButton.setSelection(mAction.isChecked());
    }
  }
  
  public void setLayoutData(Object data)
  {
    mButton.setLayoutData(data);
  }
  
  public void widgetDefaultSelected(SelectionEvent e) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    if (mAction.getStyle() == 2) {
      mAction.setChecked(mButton.getSelection());
    }
    mAction.run();
  }
  
  public void addSelectionListener(SelectionListener listener)
  {
    mButton.addSelectionListener(listener);
  }
  
  public void setVisible(boolean visible)
  {
    mButton.setVisible(visible);
  }
}

/* Location:
 * Qualified Name:     com.android.hierarchyviewer.util.ActionButton
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
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