sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.power/src/com/nokia/carbide/cpp/pi/power/PowerTraceGraph.java
changeset 5 844b047e260d
parent 2 b9ab3b238396
child 12 ae255c9aa552
--- a/sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.power/src/com/nokia/carbide/cpp/pi/power/PowerTraceGraph.java	Tue Apr 20 14:41:43 2010 +0300
+++ b/sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.power/src/com/nokia/carbide/cpp/pi/power/PowerTraceGraph.java	Wed Apr 21 15:14:16 2010 +0300
@@ -31,6 +31,7 @@
 import org.eclipse.draw2d.MouseEvent;
 import org.eclipse.draw2d.MouseMotionListener;
 import org.eclipse.draw2d.Panel;
+import org.eclipse.jface.action.Action;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -49,6 +50,7 @@
 import com.nokia.carbide.cpp.internal.pi.interfaces.ISaveSamples;
 import com.nokia.carbide.cpp.internal.pi.model.GenericSampledTrace;
 import com.nokia.carbide.cpp.internal.pi.plugin.model.IContextMenu;
+import com.nokia.carbide.cpp.internal.pi.plugin.model.ITitleBarMenu;
 import com.nokia.carbide.cpp.internal.pi.power.actions.PowerSettingsDialog;
 import com.nokia.carbide.cpp.internal.pi.power.actions.PowerStatisticsDialog;
 import com.nokia.carbide.cpp.internal.pi.visual.GenericTraceGraph;
@@ -60,12 +62,14 @@
 import com.nokia.carbide.cpp.pi.address.GppTrace;
 import com.nokia.carbide.cpp.pi.editors.PIPageEditor;
 import com.nokia.carbide.cpp.pi.util.ColorPalette;
+import com.nokia.carbide.cpp.pi.visual.IGenericTraceGraph;
 
 
 public class PowerTraceGraph extends GenericTraceGraph implements ActionListener,
 																  PIEventListener,
 																  MouseMotionListener,
-																  IContextMenu
+																  IContextMenu,
+																  ITitleBarMenu
 {
 	
     private int[] DTrace; // used for synchronizing the power and gpptraces.
@@ -341,7 +345,7 @@
 
 		case PIEvent.SCROLLED:
 			Event event = ((Event)be.getValueObject());
-			this.parentComponent.setScrolledOrigin(event.x, event.y);
+			this.parentComponent.setScrolledOrigin(event.x, event.y, (FigureCanvas)event.data);
 			this.repaint();
 			break;
 
@@ -349,10 +353,6 @@
         	break;
 	    }
 	}
-	
-	public void refreshDataFromTrace()
-	{
-	}
 
 	public void enablePowerLine( boolean state )
 	{
@@ -702,7 +702,7 @@
 
 		// this does cause some overhead and could be removed since it only provides some aesthetics.
 		updateVisibleBorders();
-		leftBorder = this.parentComponent.getScrolledOrigin().x;
+		leftBorder = this.parentComponent.getScrolledOrigin(this).x;
 //		leftBorder = this.getVisibleLeftBorder();
 		if( leftBorder < 0 )
 			leftBorder = 0;	
@@ -914,8 +914,8 @@
 						                  + (sample.thread.threadName != null ? sample.thread.threadName
 											   : Messages.getString("PowerTraceGraph.11")) + Messages.getString("PowerTraceGraph.12") //$NON-NLS-1$ //$NON-NLS-2$
 					   							   + sample.thread.threadId + Messages.getString("PowerTraceGraph.13") //$NON-NLS-1$
-					   							   + sample.currentFunctionSym.functionName + Messages.getString("PowerTraceGraph.14") //$NON-NLS-1$
-					   							   + Long.toHexString(sample.currentFunctionSym.startAddress.longValue()) ),
+					   							   + sample.getCurrentFunctionSym().getFunctionName() + Messages.getString("PowerTraceGraph.14") //$NON-NLS-1$
+					   							   + Long.toHexString(sample.getCurrentFunctionSym().getStartAddress().longValue()) ),
 					   			Messages.getString("PowerTraceGraph.15") ) == null ) //$NON-NLS-1$
 			{
 				numTransitions++;
@@ -1138,11 +1138,11 @@
 			
 			Point extent = gc.stringExtent(legend);
 			
-			gc.drawLine(GenericTraceGraph.yLegendWidth - 3, (int)y + 1, GenericTraceGraph.yLegendWidth, (int)y + 1);
+			gc.drawLine(IGenericTraceGraph.Y_LEGEND_WIDTH - 3, (int)y + 1, IGenericTraceGraph.Y_LEGEND_WIDTH, (int)y + 1);
 
 			if (y >= previousBottom)
 			{
-				gc.drawString(legend, GenericTraceGraph.yLegendWidth - extent.x - 4, (int)y);
+				gc.drawString(legend, IGenericTraceGraph.Y_LEGEND_WIDTH - extent.x - 4, (int)y);
 				previousBottom = (int)y + extent.y;
 			}
 		}
@@ -1152,4 +1152,26 @@
 			figureCanvas.redraw();
 		}
 	}
+
+	/* (non-Javadoc)
+	 * @see com.nokia.carbide.cpp.pi.visual.IGenericTraceGraph#getTitle()
+	 */
+	@Override
+	public String getTitle() {
+		return Messages.getString("PowerPlugin.pluginTitle"); //$NON-NLS-1$
+	}
+
+	/* (non-Javadoc)
+	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITitleBarMenu#addTitleBarMenuItems()
+	 */
+	public Action[] addTitleBarMenuItems() {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITitleBarMenu#getContextHelpId()
+	 */
+	public String getContextHelpId() {
+		return PowerPlugin.HELP_CONTEXT_ID_MAIN_PAGE;
+	}
 }