ScopeView.java
Go to the documentation of this file.00001 package edu.rice.cs.hpc.viewer.scope.topdown;
00002
00003 import org.eclipse.jface.action.IMenuManager;
00004 import org.eclipse.jface.viewers.CellLabelProvider;
00005 import org.eclipse.jface.viewers.ViewerCell;
00006 import org.eclipse.swt.graphics.Point;
00007 import org.eclipse.swt.widgets.Composite;
00008 import org.eclipse.swt.widgets.CoolBar;
00009 import org.eclipse.swt.widgets.Event;
00010 import org.eclipse.ui.IWorkbenchWindow;
00011 import edu.rice.cs.hpc.data.experiment.Experiment;
00012 import edu.rice.cs.hpc.data.experiment.scope.Scope;
00013 import edu.rice.cs.hpc.viewer.graph.GraphMenu;
00014 import edu.rice.cs.hpc.viewer.scope.AbstractContentProvider;
00015 import edu.rice.cs.hpc.viewer.scope.BaseScopeView;
00016 import edu.rice.cs.hpc.viewer.scope.CallingContextViewActions;
00017 import edu.rice.cs.hpc.viewer.scope.ScopeViewActions;
00018 import edu.rice.cs.hpc.viewer.scope.StyledScopeLabelProvider;
00019
00025 public class ScopeView extends BaseScopeView {
00026
00027 public static final String ID = "edu.rice.cs.hpc.viewer.scope.ScopeView";
00028
00029 private GraphMenu graphMenu;
00030 private int lastClickColumn = -1;
00031
00032
00033
00034
00035
00036
00037
00038 public int getSelectedColumn() {
00039 return lastClickColumn;
00040 }
00041
00042
00043 protected ScopeViewActions createActions(Composite parent, CoolBar coolbar) {
00044 IWorkbenchWindow window = this.getSite().getWorkbenchWindow();
00045 ScopeViewActions action = new CallingContextViewActions(this.getViewSite().getShell(), window, parent, coolbar);
00046
00047 graphMenu = new GraphMenu(getSite().getWorkbenchWindow());
00048
00049 return action;
00050 }
00051
00052
00053 protected CellLabelProvider getLabelProvider() {
00054 return new StyledScopeLabelProvider( this.getSite().getWorkbenchWindow() );
00055
00056 }
00057
00058
00059 protected void mouseDownEvent(Event event) {
00060 lastClickColumn = getColumnMouseDown(event);
00061
00062 }
00063
00070 private int getColumnMouseDown(Event event) {
00071 Point p = new Point(event.x, event.y);
00072
00073 ViewerCell cell = this.getTreeViewer().getCell(p);
00074 if(cell == null)
00075 return -1;
00076 int iPos = cell.getColumnIndex();
00077 return iPos;
00078 }
00079
00080
00081 protected void createAdditionalContextMenu(IMenuManager mgr, Scope scope) {
00082 graphMenu.createAdditionalContextMenu(mgr, database, scope);
00083 }
00084
00085
00086
00087 protected AbstractContentProvider getScopeContentProvider() {
00088 return new ScopeTreeContentProvider();
00089 }
00090
00091
00092
00093
00094
00095 protected void updateDatabase(Experiment newDatabase) {
00096 }
00097
00098 }