## com.ibm.lab.soln.jdt
Class JavaMetricsView

    java.lang.Object
      |
      +--org.eclipse.ui.part.WorkbenchPart
            |
            +--org.eclipse.ui.part.ViewPart
                  |
                  +--com.ibm.lab.soln.jdt.JavaMetricsView

All Implemented Interfaces:
  org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, IJavaMetricsListener, org.eclipse.ui.ISelectionListener, org.eclipse.ui.IViewPart, org.eclipse.ui.IWorkbenchPart

public class JavaMetricsView
extends org.eclipse.ui.part.ViewPart
implements org.eclipse.ui.ISelectionListener, IJavaMetricsListener

This class will work with a `JavaMetrics` to enable the user to see basic code metrics updated in real-time as the underlying Java model is changed. This view shows the metrics of the currently selected `ICompilationUnit`, whether it is in the Package Explorer, Outline, or Hierarchy view.

See Also:
  `JavaMetrics`

Field Summary

Fields inherited from interface org.eclipse.ui.IWorkbenchPart
`PROP_TITLE`

Constructor Summary
`JavaMetricsView()` Return a new instance of `JavaMetricsView`.

Method Summary
`void` | `createPartControl(org.eclipse.swt.widgets.Composite parent)` Create a very simple view to display the Java metrics.
`void` | `dispose()`
`void` | `refresh(JavaMetrics unused)` Update the view to reflect changes in the metrics.
`void` | `selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection)` Update the view to match the selection, if it is an `ICompilationUnit`.
`void` | `setFocus()`

Methods inherited from class org.eclipse.ui.part.ViewPart
`getViewSite, init, init, saveState`

Methods inherited from class org.eclipse.ui.part.WorkbenchPart
`addPropertyListener, firePropertyChange, getAdapter, getConfigurationElement, getDefaultImage, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener, setInitializationData, setSite, setTitle, setTitleImage, setTitleToolTip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.ui.IWorkbenchPart
`addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener`

Methods inherited from interface org.eclipse.core.runtime.IAdaptable
`getAdapter`

Constructor Detail

### JavaMetricsView

    public JavaMetricsView()

  Return a new instance of `JavaMetricsView`.

Method Detail

### createPartControl

    public void createPartControl(org.eclipse.swt.widgets.Composite parent)

  Create a very simple view to display the Java metrics. This is intentionally a trivial view, since the focus of this solution is the interaction with the Java model.

  Specified by:
    `createPartControl` in interface `org.eclipse.ui.IWorkbenchPart`
  Specified by:
    `createPartControl` in class `org.eclipse.ui.part.WorkbenchPart`
  See Also:
    `IWorkbenchPart.createPartControl(Composite)`

### dispose

    public void dispose()

  Specified by:
    `dispose` in interface `org.eclipse.ui.IWorkbenchPart`
  Overrides:
    `dispose` in class `org.eclipse.ui.part.WorkbenchPart`

### refresh

    public void refresh(JavaMetrics unused)

  Update the view to reflect changes in the metrics.

  Specified by:
    `refresh` in interface `IJavaMetricsListener`
  Parameters:
    `unused` - instance that has changed.
  See Also:
    `IJavaMetricsListener.refresh(JavaMetrics)`

### selectionChanged

    public void selectionChanged(org.eclipse.ui.IWorkbenchPart part,
                                 org.eclipse.jface.viewers.ISelection selection)

  Update the view to match the selection, if it is an `ICompilationUnit`.

  Specified by:
    `selectionChanged` in interface `org.eclipse.ui.ISelectionListener`
  See Also:
    `ISelectionService.addSelectionListener(org.eclipse.ui.ISelectionListener)`

### setFocus

    public void setFocus()

  Specified by:
    `setFocus` in interface `org.eclipse.ui.IWorkbenchPart`
  Specified by:
    `setFocus` in class `org.eclipse.ui.part.WorkbenchPart`