hierarchyviewer2

16:36:25.962 INFO  jd.cli.Main - Decompiling hierarchyviewer2.jar
package com.android.hierarchyviewer;

import com.android.ddmuilib.ImageLoader;
import com.android.hierarchyviewerlib.HierarchyViewerDirector;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class AboutDialog
  extends Dialog
{
  private Image mAboutImage;
  private Image mSmallImage;
  
  public AboutDialog(Shell shell)
  {
    super(shell);
    ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class);
    mSmallImage = imageLoader.loadImage("sdk-hierarchyviewer-16.png", Display.getDefault());
    mAboutImage = imageLoader.loadImage("sdk-hierarchyviewer-128.png", Display.getDefault());
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    createButton(parent, 0, IDialogConstants.OK_LABEL, true);
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite control = new Composite(parent, 0);
    control.setLayout(new GridLayout(2, true));
    Composite imageControl = new Composite(control, 2048);
    imageControl.setLayout(new FillLayout());
    imageControl.setLayoutData(new GridData(1040));
    Label imageLabel = new Label(imageControl, 16777216);
    imageLabel.setImage(mAboutImage);
    
    CLabel textLabel = new CLabel(control, 0);
    
    textLabel.setText("Hierarchy Viewer\nCopyright 2012, The Android Open Source Project\nAll Rights Reserved.");
    textLabel.setLayoutData(new GridData(1, 2, true, true));
    getShell().setText("About...");
    getShell().setImage(mSmallImage);
    return control;
  }
}

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

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;

class HierarchyViewerApplication$1
  implements Runnable
{
  HierarchyViewerApplication$1(HierarchyViewerApplication paramHierarchyViewerApplication, String paramString) {}
  
  public void run()
  {
    if ((HierarchyViewerApplication.access$000(this$0) != null) && (HierarchyViewerApplication.access$100(this$0) != null))
    {
      HierarchyViewerApplication.access$000(this$0).setText(val$taskName);
      HierarchyViewerApplication.access$000(this$0).setVisible(true);
      HierarchyViewerApplication.access$100(this$0).setVisible(true);
      HierarchyViewerApplication.access$200(this$0).layout();
    }
  }
}

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

import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import org.eclipse.swt.widgets.Button;

class HierarchyViewerApplication$10$1
  implements Runnable
{
  HierarchyViewerApplication$10$1(HierarchyViewerApplication.10 param10) {}
  
  public void run()
  {
    if (PixelPerfectModel.getModel().getImage() == null)
    {
      HierarchyViewerApplication.access$500(this$1.this$0).setEnabled(false);
      this$1.this$0.showDeviceSelector();
    }
    else
    {
      HierarchyViewerApplication.access$500(this$1.this$0).setEnabled(true);
      this$1.this$0.showPixelPerfect();
    }
  }
}

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

import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import com.android.hierarchyviewerlib.models.PixelPerfectModel.IImageChangeListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;

class HierarchyViewerApplication$10
  implements PixelPerfectModel.IImageChangeListener
{
  HierarchyViewerApplication$10(HierarchyViewerApplication paramHierarchyViewerApplication) {}
  
  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)
        {
          HierarchyViewerApplication.access$500(this$0).setEnabled(false);
          this$0.showDeviceSelector();
        }
        else
        {
          HierarchyViewerApplication.access$500(this$0).setEnabled(true);
          this$0.showPixelPerfect();
        }
      }
    });
  }
  
  public void overlayChanged() {}
  
  public void overlayTransparencyChanged() {}
  
  public void selectionChanged() {}
  
  public void zoomChanged() {}
}

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

import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;

class HierarchyViewerApplication$2
  implements Runnable
{
  HierarchyViewerApplication$2(HierarchyViewerApplication paramHierarchyViewerApplication) {}
  
  public void run()
  {
    if ((HierarchyViewerApplication.access$000(this$0) != null) && (HierarchyViewerApplication.access$100(this$0) != null))
    {
      HierarchyViewerApplication.access$000(this$0).setVisible(false);
      HierarchyViewerApplication.access$100(this$0).setVisible(false);
    }
  }
}

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

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;

class HierarchyViewerApplication$3
  implements SelectionListener
{
  HierarchyViewerApplication$3(HierarchyViewerApplication paramHierarchyViewerApplication) {}
  
  public void widgetDefaultSelected(SelectionEvent e) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    HierarchyViewerApplication.access$300(this$0).setSelection(true);
    this$0.showDeviceSelector();
  }
}

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

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;

class HierarchyViewerApplication$4
  implements SelectionListener
{
  HierarchyViewerApplication$4(HierarchyViewerApplication paramHierarchyViewerApplication) {}
  
  public void widgetDefaultSelected(SelectionEvent e) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    HierarchyViewerApplication.access$400(this$0).setSelection(true);
    this$0.showTreeView();
  }
}

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

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;

class HierarchyViewerApplication$5
  implements SelectionListener
{
  HierarchyViewerApplication$5(HierarchyViewerApplication paramHierarchyViewerApplication) {}
  
  public void widgetDefaultSelected(SelectionEvent e) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    HierarchyViewerApplication.access$500(this$0).setSelection(true);
    this$0.showPixelPerfect();
  }
}

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

import com.android.hierarchyviewerlib.ui.LayoutViewer;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;

class HierarchyViewerApplication$6
  implements SelectionListener
{
  HierarchyViewerApplication$6(HierarchyViewerApplication paramHierarchyViewerApplication) {}
  
  public void widgetDefaultSelected(SelectionEvent e) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    if (HierarchyViewerApplication.access$600(this$0).getOnBlack())
    {
      HierarchyViewerApplication.access$600(this$0).setOnBlack(false);
      HierarchyViewerApplication.access$800(this$0).setImage(HierarchyViewerApplication.access$700(this$0));
    }
    else
    {
      HierarchyViewerApplication.access$600(this$0).setOnBlack(true);
      HierarchyViewerApplication.access$800(this$0).setImage(HierarchyViewerApplication.access$900(this$0));
    }
  }
}

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

import com.android.hierarchyviewerlib.ui.LayoutViewer;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;

class HierarchyViewerApplication$7
  implements SelectionListener
{
  HierarchyViewerApplication$7(HierarchyViewerApplication paramHierarchyViewerApplication) {}
  
  public void widgetDefaultSelected(SelectionEvent e) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    HierarchyViewerApplication.access$600(this$0).setShowExtras(HierarchyViewerApplication.access$1000(this$0).getSelection());
  }
}

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

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;

class HierarchyViewerApplication$8
  implements SelectionListener
{
  HierarchyViewerApplication$8(HierarchyViewerApplication paramHierarchyViewerApplication) {}
  
  public void widgetDefaultSelected(SelectionEvent e) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    HierarchyViewerApplication.access$1000(this$0).setSelection(true);
    HierarchyViewerApplication.access$1100(this$0).widgetSelected(null);
  }
}

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

import com.android.hierarchyviewerlib.models.TreeViewModel;
import org.eclipse.swt.widgets.Button;

class HierarchyViewerApplication$9$1
  implements Runnable
{
  HierarchyViewerApplication$9$1(HierarchyViewerApplication.9 param9) {}
  
  public void run()
  {
    if (TreeViewModel.getModel().getTree() == null)
    {
      this$1.this$0.showDeviceSelector();
      HierarchyViewerApplication.access$400(this$1.this$0).setEnabled(false);
    }
    else
    {
      this$1.this$0.showTreeView();
      HierarchyViewerApplication.access$400(this$1.this$0).setEnabled(true);
    }
  }
}

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

import com.android.hierarchyviewerlib.models.TreeViewModel;
import com.android.hierarchyviewerlib.models.TreeViewModel.ITreeChangeListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;

class HierarchyViewerApplication$9
  implements TreeViewModel.ITreeChangeListener
{
  HierarchyViewerApplication$9(HierarchyViewerApplication paramHierarchyViewerApplication) {}
  
  public void selectionChanged() {}
  
  public void treeChanged()
  {
    Display.getDefault().syncExec(new Runnable()
    {
      public void run()
      {
        if (TreeViewModel.getModel().getTree() == null)
        {
          this$0.showDeviceSelector();
          HierarchyViewerApplication.access$400(this$0).setEnabled(false);
        }
        else
        {
          this$0.showTreeView();
          HierarchyViewerApplication.access$400(this$0).setEnabled(true);
        }
      }
    });
  }
  
  public void viewportChanged() {}
  
  public void zoomChanged() {}
}

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

import com.android.ddmlib.Log;

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

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

import com.android.ddmlib.Log;
import com.android.ddmuilib.ImageLoader;
import com.android.hierarchyviewer.actions.AboutAction;
import com.android.hierarchyviewer.actions.LoadAllViewsAction;
import com.android.hierarchyviewer.actions.QuitAction;
import com.android.hierarchyviewer.actions.ShowOverlayAction;
import com.android.hierarchyviewer.util.ActionButton;
import com.android.hierarchyviewerlib.HierarchyViewerDirector;
import com.android.hierarchyviewerlib.actions.CapturePSDAction;
import com.android.hierarchyviewerlib.actions.DisplayViewAction;
import com.android.hierarchyviewerlib.actions.DumpDisplayListAction;
import com.android.hierarchyviewerlib.actions.InspectScreenshotAction;
import com.android.hierarchyviewerlib.actions.InvalidateAction;
import com.android.hierarchyviewerlib.actions.LoadOverlayAction;
import com.android.hierarchyviewerlib.actions.LoadViewHierarchyAction;
import com.android.hierarchyviewerlib.actions.PixelPerfectAutoRefreshAction;
import com.android.hierarchyviewerlib.actions.ProfileNodesAction;
import com.android.hierarchyviewerlib.actions.RefreshPixelPerfectAction;
import com.android.hierarchyviewerlib.actions.RefreshPixelPerfectTreeAction;
import com.android.hierarchyviewerlib.actions.RefreshViewAction;
import com.android.hierarchyviewerlib.actions.RefreshWindowsAction;
import com.android.hierarchyviewerlib.actions.RequestLayoutAction;
import com.android.hierarchyviewerlib.actions.SavePixelPerfectAction;
import com.android.hierarchyviewerlib.actions.SaveTreeViewAction;
import com.android.hierarchyviewerlib.device.IHvDevice;
import com.android.hierarchyviewerlib.models.DeviceSelectionModel;
import com.android.hierarchyviewerlib.models.PixelPerfectModel;
import com.android.hierarchyviewerlib.models.PixelPerfectModel.IImageChangeListener;
import com.android.hierarchyviewerlib.models.TreeViewModel;
import com.android.hierarchyviewerlib.models.TreeViewModel.ITreeChangeListener;
import com.android.hierarchyviewerlib.ui.DeviceSelector;
import com.android.hierarchyviewerlib.ui.InvokeMethodPrompt;
import com.android.hierarchyviewerlib.ui.LayoutViewer;
import com.android.hierarchyviewerlib.ui.PixelPerfect;
import com.android.hierarchyviewerlib.ui.PixelPerfectControls;
import com.android.hierarchyviewerlib.ui.PixelPerfectLoupe;
import com.android.hierarchyviewerlib.ui.PixelPerfectPixelPanel;
import com.android.hierarchyviewerlib.ui.PixelPerfectTree;
import com.android.hierarchyviewerlib.ui.PropertyViewer;
import com.android.hierarchyviewerlib.ui.TreeView;
import com.android.hierarchyviewerlib.ui.TreeViewControls;
import com.android.hierarchyviewerlib.ui.TreeViewOverview;
import com.android.menubar.IMenuBarEnhancer;
import com.android.menubar.IMenuBarEnhancer.MenuBarMode;
import com.android.menubar.MenuBarEnhancer;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;

public class HierarchyViewerApplication
  extends ApplicationWindow
{
  private static final String APP_NAME = "Hierarchy Viewer";
  private static final int INITIAL_WIDTH = 1280;
  private static final int INITIAL_HEIGHT = 800;
  private static HierarchyViewerApplication sMainWindow;
  private Image mDeviceViewImage;
  private Image mPixelPerfectImage;
  private Image mTreeViewImage;
  private Image mDeviceViewSelectedImage;
  private Image mPixelPerfectSelectedImage;
  private Image mTreeViewSelectedImage;
  private Button mTreeViewButton;
  private Button mPixelPerfectButton;
  private Button mDeviceViewButton;
  private Label mProgressLabel;
  private ProgressBar mProgressBar;
  private String mProgressString;
  private Composite mDeviceSelectorPanel;
  private Composite mTreeViewPanel;
  private Composite mPixelPerfectPanel;
  private StackLayout mMainWindowStackLayout;
  private DeviceSelector mDeviceSelector;
  private Composite mStatusBar;
  private TreeView mTreeView;
  private Composite mMainWindow;
  private Image mOnBlackImage;
  private Image mOnWhiteImage;
  private Button mOnBlackWhiteButton;
  private Button mShowExtras;
  private LayoutViewer mLayoutViewer;
  private PixelPerfectLoupe mPixelPerfectLoupe;
  private Composite mTreeViewControls;
  private InvokeMethodPrompt mInvokeMethodPrompt;
  private ActionButton dumpDisplayList;
  private HierarchyViewerDirector mDirector;
  
  private static class UncaughtHandler
    implements Thread.UncaughtExceptionHandler
  {
    public void uncaughtException(Thread t, Throwable e)
    {
      Log.e("HierarchyViewer", "shutting down due to uncaught exception");
      Log.e("HierarchyViewer", e);
      System.exit(1);
    }
  }
  
  public static final HierarchyViewerApplication getMainWindow()
  {
    return sMainWindow;
  }
  
  public HierarchyViewerApplication()
  {
    super(null);
    
    sMainWindow = this;
    
    addMenuBar();
  }
  
  protected void configureShell(Shell shell)
  {
    super.configureShell(shell);
    shell.setText("Hierarchy Viewer");
    ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class);
    Image image = imageLoader.loadImage("sdk-hierarchyviewer-128.png", Display.getDefault());
    shell.setImage(image);
  }
  
  public MenuManager createMenuManager()
  {
    return new MenuManager();
  }
  
  public void run()
  {
    setBlockOnOpen(true);
    try
    {
      open();
    }
    catch (SWTException e)
    {
      if (!getShell().isDisposed()) {
        throw e;
      }
    }
    TreeViewModel.getModel().removeTreeChangeListener(mTreeChangeListener);
    PixelPerfectModel.getModel().removeImageChangeListener(mImageChangeListener);
    
    ImageLoader.dispose();
    mDirector.stopListenForDevices();
    mDirector.stopDebugBridge();
    mDirector.terminate();
  }
  
  protected void initializeBounds()
  {
    Rectangle monitorArea = Display.getDefault().getPrimaryMonitor().getBounds();
    getShell().setSize(Math.min(width, 1280), Math.min(height, 800));
    
    getShell().setLocation(x + (width - 1280) / 2, y + (height - 800) / 2);
  }
  
  private void loadResources()
  {
    ImageLoader imageLoader = ImageLoader.getLoader(HierarchyViewerDirector.class);
    mTreeViewImage = imageLoader.loadImage("tree-view.png", Display.getDefault());
    mTreeViewSelectedImage = imageLoader.loadImage("tree-view-selected.png", Display.getDefault());
    
    mPixelPerfectImage = imageLoader.loadImage("pixel-perfect-view.png", Display.getDefault());
    mPixelPerfectSelectedImage = imageLoader.loadImage("pixel-perfect-view-selected.png", Display.getDefault());
    
    mDeviceViewImage = imageLoader.loadImage("device-view.png", Display.getDefault());
    mDeviceViewSelectedImage = imageLoader.loadImage("device-view-selected.png", Display.getDefault());
    
    mOnBlackImage = imageLoader.loadImage("on-black.png", Display.getDefault());
    mOnWhiteImage = imageLoader.loadImage("on-white.png", Display.getDefault());
  }
  
  protected Control createContents(Composite parent)
  {
    mDirector = HierarchyViewerApplicationDirector.createDirector();
    mDirector.initDebugBridge();
    mDirector.startListenForDevices();
    mDirector.populateDeviceSelectionModel();
    
    TreeViewModel.getModel().addTreeChangeListener(mTreeChangeListener);
    PixelPerfectModel.getModel().addImageChangeListener(mImageChangeListener);
    
    loadResources();
    
    Composite control = new Composite(parent, 0);
    GridLayout mainLayout = new GridLayout();
    marginHeight = (marginWidth = 0);
    verticalSpacing = (horizontalSpacing = 0);
    control.setLayout(mainLayout);
    mMainWindow = new Composite(control, 0);
    mMainWindow.setLayoutData(new GridData(1808));
    mMainWindowStackLayout = new StackLayout();
    mMainWindow.setLayout(mMainWindowStackLayout);
    
    buildDeviceSelectorPanel(mMainWindow);
    buildTreeViewPanel(mMainWindow);
    buildPixelPerfectPanel(mMainWindow);
    
    buildStatusBar(control);
    
    showDeviceSelector();
    
    return control;
  }
  
  private void buildStatusBar(Composite parent)
  {
    mStatusBar = new Composite(parent, 0);
    mStatusBar.setLayoutData(new GridData(768));
    
    FormLayout statusBarLayout = new FormLayout();
    marginHeight = (marginWidth = 2);
    
    mStatusBar.setLayout(statusBarLayout);
    
    mDeviceViewButton = new Button(mStatusBar, 2);
    mDeviceViewButton.setImage(mDeviceViewImage);
    mDeviceViewButton.setToolTipText("Switch to the window selection view");
    mDeviceViewButton.addSelectionListener(deviceViewButtonSelectionListener);
    FormData deviceViewButtonFormData = new FormData();
    left = new FormAttachment();
    mDeviceViewButton.setLayoutData(deviceViewButtonFormData);
    
    mTreeViewButton = new Button(mStatusBar, 2);
    mTreeViewButton.setImage(mTreeViewImage);
    mTreeViewButton.setEnabled(false);
    mTreeViewButton.setToolTipText("Switch to the tree view");
    mTreeViewButton.addSelectionListener(treeViewButtonSelectionListener);
    FormData treeViewButtonFormData = new FormData();
    left = new FormAttachment(mDeviceViewButton, 2);
    mTreeViewButton.setLayoutData(treeViewButtonFormData);
    
    mPixelPerfectButton = new Button(mStatusBar, 2);
    mPixelPerfectButton.setImage(mPixelPerfectImage);
    mPixelPerfectButton.setEnabled(false);
    mPixelPerfectButton.setToolTipText("Switch to the pixel perfect view");
    mPixelPerfectButton.addSelectionListener(pixelPerfectButtonSelectionListener);
    FormData pixelPerfectButtonFormData = new FormData();
    left = new FormAttachment(mTreeViewButton, 2);
    mPixelPerfectButton.setLayoutData(pixelPerfectButtonFormData);
    
    mTreeViewControls = new TreeViewControls(mStatusBar);
    FormData treeViewControlsFormData = new FormData();
    left = new FormAttachment(mPixelPerfectButton, 2);
    top = new FormAttachment(mTreeViewButton, 0, 16777216);
    width = 552;
    mTreeViewControls.setLayoutData(treeViewControlsFormData);
    
    mProgressLabel = new Label(mStatusBar, 131072);
    
    mProgressBar = new ProgressBar(mStatusBar, 65794);
    FormData progressBarFormData = new FormData();
    right = new FormAttachment(100, 0);
    top = new FormAttachment(mTreeViewButton, 0, 16777216);
    mProgressBar.setLayoutData(progressBarFormData);
    
    FormData progressLabelFormData = new FormData();
    right = new FormAttachment(mProgressBar, -2);
    top = new FormAttachment(mTreeViewButton, 0, 16777216);
    mProgressLabel.setLayoutData(progressLabelFormData);
    if (mProgressString == null)
    {
      mProgressLabel.setVisible(false);
      mProgressBar.setVisible(false);
    }
    else
    {
      mProgressLabel.setText(mProgressString);
    }
  }
  
  private void buildDeviceSelectorPanel(Composite parent)
  {
    mDeviceSelectorPanel = new Composite(parent, 0);
    GridLayout gridLayout = new GridLayout();
    marginWidth = (marginHeight = 0);
    horizontalSpacing = (verticalSpacing = 0);
    mDeviceSelectorPanel.setLayout(gridLayout);
    
    Composite buttonPanel = new Composite(mDeviceSelectorPanel, 0);
    buttonPanel.setLayoutData(new GridData(768));
    
    GridLayout buttonLayout = new GridLayout();
    marginWidth = (marginHeight = 0);
    horizontalSpacing = (verticalSpacing = 0);
    buttonPanel.setLayout(buttonLayout);
    
    Composite innerButtonPanel = new Composite(buttonPanel, 0);
    innerButtonPanel.setLayoutData(new GridData(1040));
    GridLayout innerButtonPanelLayout = new GridLayout(3, true);
    marginWidth = (marginHeight = 2);
    horizontalSpacing = (verticalSpacing = 2);
    innerButtonPanel.setLayout(innerButtonPanelLayout);
    
    ActionButton refreshWindows = new ActionButton(innerButtonPanel, RefreshWindowsAction.getAction());
    
    refreshWindows.setLayoutData(new GridData(1808));
    
    ActionButton loadViewHierarchyButton = new ActionButton(innerButtonPanel, LoadViewHierarchyAction.getAction());
    
    loadViewHierarchyButton.setLayoutData(new GridData(1808));
    
    ActionButton inspectScreenshotButton = new ActionButton(innerButtonPanel, InspectScreenshotAction.getAction());
    
    inspectScreenshotButton.setLayoutData(new GridData(1808));
    
    Composite deviceSelectorContainer = new Composite(mDeviceSelectorPanel, 2048);
    deviceSelectorContainer.setLayoutData(new GridData(1808));
    deviceSelectorContainer.setLayout(new FillLayout());
    mDeviceSelector = new DeviceSelector(deviceSelectorContainer, true, true);
  }
  
  public void buildTreeViewPanel(Composite parent)
  {
    mTreeViewPanel = new Composite(parent, 0);
    GridLayout gridLayout = new GridLayout();
    marginWidth = (marginHeight = 0);
    horizontalSpacing = (verticalSpacing = 0);
    mTreeViewPanel.setLayout(gridLayout);
    
    Composite buttonPanel = new Composite(mTreeViewPanel, 0);
    buttonPanel.setLayoutData(new GridData(768));
    
    GridLayout buttonLayout = new GridLayout();
    marginWidth = (marginHeight = 0);
    horizontalSpacing = (verticalSpacing = 0);
    buttonPanel.setLayout(buttonLayout);
    
    Composite innerButtonPanel = new Composite(buttonPanel, 0);
    innerButtonPanel.setLayoutData(new GridData(1040));
    GridLayout innerButtonPanelLayout = new GridLayout(8, true);
    marginWidth = (marginHeight = 2);
    horizontalSpacing = (verticalSpacing = 2);
    innerButtonPanel.setLayout(innerButtonPanelLayout);
    
    ActionButton saveTreeView = new ActionButton(innerButtonPanel, SaveTreeViewAction.getAction(getShell()));
    
    saveTreeView.setLayoutData(new GridData(1808));
    
    ActionButton capturePSD = new ActionButton(innerButtonPanel, CapturePSDAction.getAction(getShell()));
    
    capturePSD.setLayoutData(new GridData(1808));
    
    ActionButton refreshViewAction = new ActionButton(innerButtonPanel, RefreshViewAction.getAction());
    
    refreshViewAction.setLayoutData(new GridData(1808));
    
    ActionButton displayView = new ActionButton(innerButtonPanel, DisplayViewAction.getAction(getShell()));
    
    displayView.setLayoutData(new GridData(1808));
    
    ActionButton invalidate = new ActionButton(innerButtonPanel, InvalidateAction.getAction());
    invalidate.setLayoutData(new GridData(1808));
    
    ActionButton requestLayout = new ActionButton(innerButtonPanel, RequestLayoutAction.getAction());
    
    requestLayout.setLayoutData(new GridData(1808));
    
    dumpDisplayList = new ActionButton(innerButtonPanel, DumpDisplayListAction.getAction());
    
    dumpDisplayList.setLayoutData(new GridData(1808));
    
    ActionButton profileNodes = new ActionButton(innerButtonPanel, ProfileNodesAction.getAction());
    
    profileNodes.setLayoutData(new GridData(1808));
    
    SashForm mainSash = new SashForm(mTreeViewPanel, 65792);
    mainSash.setLayoutData(new GridData(1808));
    Composite treeViewContainer = new Composite(mainSash, 2048);
    treeViewContainer.setLayout(new FillLayout());
    mTreeView = new TreeView(treeViewContainer);
    
    SashForm sideSash = new SashForm(mainSash, 66048);
    
    SASH_WIDTH = 4;
    mainSash.setWeights(new int[] { 7, 3 });
    
    Composite treeViewOverviewContainer = new Composite(sideSash, 2048);
    treeViewOverviewContainer.setLayout(new FillLayout());
    new TreeViewOverview(treeViewOverviewContainer);
    
    Composite propertyViewerContainer = new Composite(sideSash, 2048);
    propertyViewerContainer.setLayout(new GridLayout());
    
    PropertyViewer pv = new PropertyViewer(propertyViewerContainer);
    pv.setLayoutData(new GridData(1808));
    
    mInvokeMethodPrompt = new InvokeMethodPrompt(propertyViewerContainer);
    mInvokeMethodPrompt.setLayoutData(new GridData(768));
    
    Composite layoutViewerContainer = new Composite(sideSash, 0);
    GridLayout layoutViewerLayout = new GridLayout();
    marginWidth = (marginHeight = 0);
    horizontalSpacing = (verticalSpacing = 1);
    layoutViewerContainer.setLayout(layoutViewerLayout);
    
    Composite fullButtonBar = new Composite(layoutViewerContainer, 0);
    fullButtonBar.setLayoutData(new GridData(768));
    GridLayout fullButtonBarLayout = new GridLayout(2, false);
    marginWidth = (marginHeight = 0);
    marginRight = 2;
    horizontalSpacing = (verticalSpacing = 0);
    fullButtonBar.setLayout(fullButtonBarLayout);
    
    Composite buttonBar = new Composite(fullButtonBar, 0);
    buttonBar.setLayoutData(new GridData(1040));
    RowLayout rowLayout = new RowLayout(256);
    marginLeft = (marginRight = marginTop = marginBottom = 0);
    
    pack = true;
    center = true;
    buttonBar.setLayout(rowLayout);
    
    mOnBlackWhiteButton = new Button(buttonBar, 8);
    mOnBlackWhiteButton.setImage(mOnWhiteImage);
    mOnBlackWhiteButton.addSelectionListener(onBlackWhiteSelectionListener);
    mOnBlackWhiteButton.setToolTipText("Change layout viewer background color");
    
    mShowExtras = new Button(buttonBar, 32);
    mShowExtras.setText("Show Extras");
    mShowExtras.addSelectionListener(showExtrasSelectionListener);
    mShowExtras.setToolTipText("Show images");
    
    ActionButton loadAllViewsButton = new ActionButton(fullButtonBar, LoadAllViewsAction.getAction());
    
    loadAllViewsButton.setLayoutData(new GridData(3, 2, true, true));
    loadAllViewsButton.addSelectionListener(loadAllViewsSelectionListener);
    
    Composite layoutViewerMainContainer = new Composite(layoutViewerContainer, 2048);
    layoutViewerMainContainer.setLayoutData(new GridData(1808));
    layoutViewerMainContainer.setLayout(new FillLayout());
    mLayoutViewer = new LayoutViewer(layoutViewerMainContainer);
    
    SASH_WIDTH = 4;
    sideSash.setWeights(new int[] { 238, 332, 416 });
  }
  
  private void buildPixelPerfectPanel(Composite parent)
  {
    mPixelPerfectPanel = new Composite(parent, 0);
    GridLayout gridLayout = new GridLayout();
    marginWidth = (marginHeight = 0);
    horizontalSpacing = (verticalSpacing = 0);
    mPixelPerfectPanel.setLayout(gridLayout);
    
    Composite buttonPanel = new Composite(mPixelPerfectPanel, 0);
    buttonPanel.setLayoutData(new GridData(768));
    
    GridLayout buttonLayout = new GridLayout();
    marginWidth = (marginHeight = 0);
    horizontalSpacing = (verticalSpacing = 0);
    buttonPanel.setLayout(buttonLayout);
    
    Composite innerButtonPanel = new Composite(buttonPanel, 0);
    innerButtonPanel.setLayoutData(new GridData(1040));
    GridLayout innerButtonPanelLayout = new GridLayout(6, true);
    marginWidth = (marginHeight = 2);
    horizontalSpacing = (verticalSpacing = 2);
    innerButtonPanel.setLayout(innerButtonPanelLayout);
    
    ActionButton saveTreeView = new ActionButton(innerButtonPanel, SavePixelPerfectAction.getAction(getShell()));
    
    saveTreeView.setLayoutData(new GridData(1808));
    
    ActionButton refreshPixelPerfect = new ActionButton(innerButtonPanel, RefreshPixelPerfectAction.getAction());
    
    refreshPixelPerfect.setLayoutData(new GridData(1808));
    
    ActionButton refreshPixelPerfectTree = new ActionButton(innerButtonPanel, RefreshPixelPerfectTreeAction.getAction());
    
    refreshPixelPerfectTree.setLayoutData(new GridData(1808));
    
    ActionButton loadOverlay = new ActionButton(innerButtonPanel, LoadOverlayAction.getAction(getShell()));
    
    loadOverlay.setLayoutData(new GridData(1808));
    
    ActionButton showInLoupe = new ActionButton(innerButtonPanel, ShowOverlayAction.getAction());
    
    showInLoupe.setLayoutData(new GridData(1808));
    
    ActionButton autoRefresh = new ActionButton(innerButtonPanel, PixelPerfectAutoRefreshAction.getAction());
    
    autoRefresh.setLayoutData(new GridData(1808));
    
    SashForm mainSash = new SashForm(mPixelPerfectPanel, 65792);
    mainSash.setLayoutData(new GridData(1808));
    SASH_WIDTH = 4;
    
    Composite pixelPerfectTreeContainer = new Composite(mainSash, 2048);
    pixelPerfectTreeContainer.setLayout(new FillLayout());
    new PixelPerfectTree(pixelPerfectTreeContainer);
    
    Composite pixelPerfectLoupeContainer = new Composite(mainSash, 0);
    GridLayout loupeLayout = new GridLayout();
    marginWidth = (marginHeight = 0);
    horizontalSpacing = (verticalSpacing = 0);
    pixelPerfectLoupeContainer.setLayout(loupeLayout);
    
    Composite pixelPerfectLoupeBorder = new Composite(pixelPerfectLoupeContainer, 2048);
    pixelPerfectLoupeBorder.setLayoutData(new GridData(1808));
    GridLayout pixelPerfectLoupeBorderGridLayout = new GridLayout();
    marginWidth = (marginHeight = 0);
    
    horizontalSpacing = (verticalSpacing = 0);
    
    pixelPerfectLoupeBorder.setLayout(pixelPerfectLoupeBorderGridLayout);
    
    mPixelPerfectLoupe = new PixelPerfectLoupe(pixelPerfectLoupeBorder);
    mPixelPerfectLoupe.setLayoutData(new GridData(1808));
    
    PixelPerfectPixelPanel pixelPerfectPixelPanel = new PixelPerfectPixelPanel(pixelPerfectLoupeBorder);
    
    pixelPerfectPixelPanel.setLayoutData(new GridData(768));
    
    PixelPerfectControls pixelPerfectControls = new PixelPerfectControls(pixelPerfectLoupeContainer);
    
    pixelPerfectControls.setLayoutData(new GridData(768));
    
    Composite pixelPerfectContainer = new Composite(mainSash, 2048);
    pixelPerfectContainer.setLayout(new FillLayout());
    new PixelPerfect(pixelPerfectContainer);
    
    mainSash.setWeights(new int[] { 272, 376, 346 });
  }
  
  public void showOverlayInLoupe(boolean value)
  {
    mPixelPerfectLoupe.setShowOverlay(value);
  }
  
  public void startTask(final String taskName)
  {
    mProgressString = taskName;
    Display.getDefault().syncExec(new Runnable()
    {
      public void run()
      {
        if ((mProgressLabel != null) && (mProgressBar != null))
        {
          mProgressLabel.setText(taskName);
          mProgressLabel.setVisible(true);
          mProgressBar.setVisible(true);
          mStatusBar.layout();
        }
      }
    });
  }
  
  public void endTask()
  {
    mProgressString = null;
    Display.getDefault().syncExec(new Runnable()
    {
      public void run()
      {
        if ((mProgressLabel != null) && (mProgressBar != null))
        {
          mProgressLabel.setVisible(false);
          mProgressBar.setVisible(false);
        }
      }
    });
  }
  
  public void showDeviceSelector()
  {
    MenuManager mm = getMenuBarManager();
    mm.removeAll();
    
    MenuManager file = new MenuManager("&File");
    IMenuBarEnhancer enhancer = MenuBarEnhancer.setupMenuManager("Hierarchy Viewer", getShell().getDisplay(), file, AboutAction.getAction(getShell()), null, QuitAction.getAction());
    if (enhancer.getMenuBarMode() == IMenuBarEnhancer.MenuBarMode.GENERIC) {
      mm.add(file);
    }
    MenuManager device = new MenuManager("&Devices");
    mm.add(device);
    
    device.add(RefreshWindowsAction.getAction());
    device.add(LoadViewHierarchyAction.getAction());
    device.add(InspectScreenshotAction.getAction());
    
    mm.updateAll(true);
    
    mDeviceViewButton.setSelection(true);
    mDeviceViewButton.setImage(mDeviceViewSelectedImage);
    
    mTreeViewButton.setSelection(false);
    mTreeViewButton.setImage(mTreeViewImage);
    
    mPixelPerfectButton.setSelection(false);
    mPixelPerfectButton.setImage(mPixelPerfectImage);
    
    mMainWindowStackLayout.topControl = mDeviceSelectorPanel;
    
    mMainWindow.layout();
    
    mDeviceSelector.setFocus();
    
    mTreeViewControls.setVisible(false);
  }
  
  public void showTreeView()
  {
    MenuManager mm = getMenuBarManager();
    mm.removeAll();
    
    MenuManager file = new MenuManager("&File");
    IMenuBarEnhancer enhancer = MenuBarEnhancer.setupMenuManager("Hierarchy Viewer", getShell().getDisplay(), file, AboutAction.getAction(getShell()), null, QuitAction.getAction());
    if (enhancer.getMenuBarMode() == IMenuBarEnhancer.MenuBarMode.GENERIC) {
      mm.add(file);
    }
    MenuManager treeViewMenu = new MenuManager("&Tree View");
    mm.add(treeViewMenu);
    
    treeViewMenu.add(SaveTreeViewAction.getAction(getShell()));
    treeViewMenu.add(CapturePSDAction.getAction(getShell()));
    treeViewMenu.add(new Separator());
    treeViewMenu.add(RefreshViewAction.getAction());
    treeViewMenu.add(DisplayViewAction.getAction(getShell()));
    
    IHvDevice hvDevice = DeviceSelectionModel.getModel().getSelectedDevice();
    if (hvDevice.supportsDisplayListDump())
    {
      treeViewMenu.add(DumpDisplayListAction.getAction());
      dumpDisplayList.setVisible(true);
    }
    else
    {
      dumpDisplayList.setVisible(false);
    }
    treeViewMenu.add(new Separator());
    treeViewMenu.add(InvalidateAction.getAction());
    treeViewMenu.add(RequestLayoutAction.getAction());
    
    mm.updateAll(true);
    
    mDeviceViewButton.setSelection(false);
    mDeviceViewButton.setImage(mDeviceViewImage);
    
    mTreeViewButton.setSelection(true);
    mTreeViewButton.setImage(mTreeViewSelectedImage);
    
    mInvokeMethodPrompt.setEnabled(hvDevice.isViewUpdateEnabled());
    
    mPixelPerfectButton.setSelection(false);
    mPixelPerfectButton.setImage(mPixelPerfectImage);
    
    mMainWindowStackLayout.topControl = mTreeViewPanel;
    
    mMainWindow.layout();
    
    mTreeView.setFocus();
    
    mTreeViewControls.setVisible(true);
  }
  
  public void showPixelPerfect()
  {
    MenuManager mm = getMenuBarManager();
    mm.removeAll();
    
    MenuManager file = new MenuManager("&File");
    IMenuBarEnhancer enhancer = MenuBarEnhancer.setupMenuManager("Hierarchy Viewer", getShell().getDisplay(), file, AboutAction.getAction(getShell()), null, QuitAction.getAction());
    if (enhancer.getMenuBarMode() == IMenuBarEnhancer.MenuBarMode.GENERIC) {
      mm.add(file);
    }
    MenuManager pixelPerfect = new MenuM
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-2017. Infinite Loop Ltd