gt:         	TreeItem tii = treeitems.get(scname);
context: package org.jmlspecs.openjml.eclipse;
  
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  import org.eclipse.core.resources.IFile;
  import org.eclipse.core.resources.IProject;
  import org.eclipse.core.resources.IResource;
  import org.eclipse.jdt.core.IJavaElement;
  import org.eclipse.jdt.core.IJavaProject;
  import org.eclipse.jdt.core.IMethod;
  import org.eclipse.jdt.core.IType;
  import org.eclipse.jdt.core.JavaCore;
  import org.eclipse.jface.action.Action;
  import org.eclipse.jface.action.GroupMarker;
  import org.eclipse.jface.action.IAction;
  import org.eclipse.jface.action.IMenuListener;
  import org.eclipse.jface.action.IMenuManager;
  import org.eclipse.jface.action.MenuManager;
  import org.eclipse.jface.viewers.ISelectionProvider;
  import org.eclipse.jface.viewers.TreeViewer;
  import org.eclipse.swt.SWT;
  import org.eclipse.swt.custom.ScrolledComposite;
  import org.eclipse.swt.events.MouseEvent;
  import org.eclipse.swt.events.MouseListener;
  import org.eclipse.swt.events.SelectionEvent;
  import org.eclipse.swt.events.SelectionListener;
  import org.eclipse.swt.graphics.Color;
  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.widgets.*;
  import org.eclipse.ui.IEditorInput;
  import org.eclipse.ui.IEditorPart;
  import org.eclipse.ui.IFileEditorInput;
  import org.eclipse.ui.IPartListener;
  import org.eclipse.ui.IWorkbenchActionConstants;
  import org.eclipse.ui.IWorkbenchPage;
  import org.eclipse.ui.IWorkbenchPart;
  import org.eclipse.ui.PlatformUI;
  import org.eclipse.ui.console.MessageConsole;
  import org.eclipse.ui.console.MessageConsoleStream;
  import org.eclipse.ui.internal.dialogs.ViewContentProvider;
  import org.eclipse.ui.internal.dialogs.ViewLabelProvider;
  import org.eclipse.ui.part.ViewPart;
  import org.jmlspecs.openjml.Strings;
  import org.jmlspecs.openjml.esc.MethodProverSMT.Counterexample;
  import org.jmlspecs.openjml.proverinterface.IProverResult;
  import org.jmlspecs.openjml.proverinterface.IProverResult.ICounterexample;
  import org.jmlspecs.openjml.proverinterface.IProverResult.Kind;
  import org.jmlspecs.openjml.proverinterface.ProverResult;
  import org.w3c.dom.Document;
  
  import com.sun.tools.javac.code.Symbol;
  import com.sun.tools.javac.code.Symbol.MethodSymbol;
  import com.sun.tools.javac.code.Symbol.PackageSymbol;
  
  public class OpenJMLView extends ViewPart implements SelectionListener, MouseListener {
  
  	/** Eclipse ID of the viewer - must match the ID defined in the plugin.xml file */
      public static final String ID = "org.openjml.proofview"; //$NON-NLS-1$
      
      Document doc;
      
      IJavaProject currentProject;
      IPartListener aListener;
      TreeViewer viewer;
      
      //Table tree;
      Tree tree;
      TreeItem treeroot;
      
  
      public OpenJMLView() {
      }
      
      /**
       * Create contents of the view part.
       * @param parent
       */
      @Override
      public void createPartControl(Composite parent) {
      	// FIXME - to get a context menu we need to use a TreeViewer, but that means some complex coding of
      	// a content and label provider - do it later.
          ScrolledComposite sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
          sc.setExpandHorizontal(true);
          sc.setExpandVertical(true);
  //    	viewer = new TreeViewer(parent, SWT.MULTI|SWT.V_SCROLL|SWT.H_SCROLL);
  //    	viewer.setContentProvider(new ViewContentProvider());
  ////    	viewer.setLabelProvider(new ViewLabelProvider());
  //    	viewer.setInput(getViewSite());
  
          tree = new Tree(sc, SWT.NONE);
          sc.setContent(tree);
  //    	tree = (Tree)viewer.getControl();
          treeroot = new TreeItem(tree, SWT.NONE);
          tree.addSelectionListener(this);
          tree.addMouseListener(this);
          
          aListener = new IPartListener(){
  
              @Override
              public void partActivated(IWorkbenchPart part) {
                  if(part instanceof IEditorInput){
                      if(getCurrentFileData()) {
                          refresh();
                      }
                  }
              }
  
              @Override
              public void partBroughtToTop(IWorkbenchPart part) {
                  if(part instanceof IEditorInput){
                  	refresh();
                  }
              }
  
              @Override
              public void partClosed(IWorkbenchPart part) {}
  
              @Override
              public void partDeactivated(IWorkbenchPart part) {}
  
              @Override
              public void partOpened(IWorkbenchPart part) {}
          };
          PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener(aListener);
          
          initializeToolBar();
  //        initializeMenu();
          if (viewer != null) createContextMenu(viewer);
          refresh();
          
      }
      
      private void createContextMenu(TreeViewer viewer) {
      	// Create menu manager.
      	MenuManager menuMgr = new MenuManager();
      	menuMgr.setRemoveAllWhenShown(true);
      	menuMgr.addMenuListener(new IMenuListener() {
      		public void menuAboutToShow(IMenuManager mgr) {
                  mgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
      		}
      	});
  
      	// Create menu.
      	Menu menu = menuMgr.createContextMenu(viewer.getControl());
      	viewer.getControl().setMenu(menu);
  
      	// Register menu for extension.
      	getSite().registerContextMenu(menuMgr, viewer);
      }
      
      public final static Color white = new Color(null,255,255,255);
      public final static Color red = new Color(null,255,0,0);
      public final static Color green = new Color(null,0,255,0);
      public final static Color orange = new Color(null,255,128,0);
      public final static Color yellow = new Color(null,255,255,0);
      public final static Color blue = new Color(null,0,0,255);
  
      Map<String,TreeItem> treeitems = new HashMap<String,TreeItem>();
      Map<TreeItem,ICounterexample> treece = new HashMap<TreeItem,ICounterexample>();
  
      // FIXME: Would like to update incrementally
      // FIXME: Would like to have summary colors on class names. On pacakges as well?
      // FIXME: Leave closed if all OK
      // FIXME: Select - opens editor to correct method; opens trace view if available
      // FIXME: what about multiple counterexamples (update trace and path in editor)
      // FIXME: right click menu items - open trace, rerun action on method, clear contents
      // FIXME: clearing contents 
      // FIXME: do TreeItem objects need to be disposed? YES
      public void refresh() {
      	
      	getCurrentFileData();
      	OpenJMLInterface iface = Activator.utils().getInterface(currentProject);
      	Map<String,IProverResult> results = iface.getProofResults();
  
      	this.setPartName("OpenJML: " + currentProject.getElementName());
          treeroot.setText("Static Checks for: " + currentProject.getElementName());
          
          // FIXME - would like to sort these; remember the tree is built incrementally
          for (String key : results.keySet()) {
          	refresh(key);
          }
          treeroot.setExpanded(true);
          //viewer.refresh();
      }
      
      public void refresh(String key) {
      	OpenJMLInterface iface = Activator.utils().getInterface(currentProject);
      	Map<String,IProverResult> results = iface.getProofResults();
      	IProverResult result = results.get(key);
      	Symbol sym = result.methodSymbol();
      	
          	PackageSymbol p = sym.packge();
      		String pname = p.getQualifiedName().toString();
      		if (pname.isEmpty()) pname = "<default package>";
          	TreeItem ti = treeitems.get(pname);
          	if (ti == null) {
          		ti = new TreeItem(treeroot, SWT.NONE);
          		ti.setText(pname);
          		treeitems.put(pname, ti);
          	}
      		
          	Symbol classSym = sym.owner;
          	String scname = iface.keyForSym(classSym);
          	String cname = classSym.getSimpleName().toString();
  