sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi/src/com/nokia/carbide/cpp/pi/editors/PIPageEditor.java
changeset 5 844b047e260d
parent 2 b9ab3b238396
child 12 ae255c9aa552
equal deleted inserted replaced
4:615035072f7e 5:844b047e260d
   107 	public static final int THREADS_PAGE   = 0;
   107 	public static final int THREADS_PAGE   = 0;
   108 	public static final int BINARIES_PAGE  = 1;
   108 	public static final int BINARIES_PAGE  = 1;
   109 	public static final int FUNCTIONS_PAGE = 2;
   109 	public static final int FUNCTIONS_PAGE = 2;
   110 	public static final int NEXT_AVAILABLE_PAGE = -1;
   110 	public static final int NEXT_AVAILABLE_PAGE = -1;
   111 	
   111 	
       
   112 	public static Font helvetica_7;
   112 	public static Font helvetica_8;
   113 	public static Font helvetica_8;
   113 	public static Font helvetica_9;
   114 	public static Font helvetica_9;
   114 	public static Font helvetica_10;
   115 	public static Font helvetica_10;
   115 	public static Font helvetica_12;
   116 	public static Font helvetica_12;
   116 	public static Font helvetica_14;
   117 	public static Font helvetica_14;
   174 		ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
   175 		ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
   175 	}
   176 	}
   176 	
   177 	
   177 	protected static void createFonts(Display display) {
   178 	protected static void createFonts(Display display) {
   178 		if (helvetica_8 == null) {
   179 		if (helvetica_8 == null) {
       
   180 			helvetica_7  = new Font(display, "Helvetica",  7, SWT.NORMAL); //$NON-NLS-1$
   179 			helvetica_8  = new Font(display, "Helvetica",  8, SWT.NORMAL); //$NON-NLS-1$
   181 			helvetica_8  = new Font(display, "Helvetica",  8, SWT.NORMAL); //$NON-NLS-1$
   180 			helvetica_9  = new Font(display, "Helvetica",  9, SWT.NORMAL); //$NON-NLS-1$
   182 			helvetica_9  = new Font(display, "Helvetica",  9, SWT.NORMAL); //$NON-NLS-1$
   181 			helvetica_10 = new Font(display, "Helvetica", 10, SWT.NORMAL); //$NON-NLS-1$
   183 			helvetica_10 = new Font(display, "Helvetica", 10, SWT.NORMAL); //$NON-NLS-1$
   182 			helvetica_12 = new Font(display, "Helvetica", 12, SWT.NORMAL); //$NON-NLS-1$
   184 			helvetica_12 = new Font(display, "Helvetica", 12, SWT.NORMAL); //$NON-NLS-1$
   183 			helvetica_14 = new Font(display, "Helvetica", 14, SWT.NORMAL); //$NON-NLS-1$
   185 			helvetica_14 = new Font(display, "Helvetica", 14, SWT.NORMAL); //$NON-NLS-1$
   326 	  		
   328 	  		
   327 	  		index = addPage(page);
   329 	  		index = addPage(page);
   328 	  		setPageText(index, myPv.getPageName());
   330 	  		setPageText(index, myPv.getPageName());
   329 	  		
   331 	  		
   330 	  		// set the composite page's data to its page number
   332 	  		// set the composite page's data to its page number
   331 	  		page.setData("pageIndex", new Integer(index)); //$NON-NLS-1$
   333 	  		page.setData("pageIndex", Integer.valueOf(index)); //$NON-NLS-1$
   332 	  		page.setData("pageEditor", this); //$NON-NLS-1$
   334 	  		page.setData("pageEditor", this); //$NON-NLS-1$
   333 	  		page.setData("pageUID", new Integer(uid)); //$NON-NLS-1$
   335 	  		page.setData("pageUID", Integer.valueOf(uid)); //$NON-NLS-1$
   334 
   336 
   335 	  		page.addFocusListener(new FocusAdapter() {
   337 	  		page.addFocusListener(new FocusAdapter() {
   336 
   338 
   337 				public void focusGained(FocusEvent e) {
   339 				public void focusGained(FocusEvent e) {
   338 					Object data;
   340 					Object data;
   688 				NpiInstanceRepository.getInstance().switchActiveUid(currentPageEditor().uid);
   690 				NpiInstanceRepository.getInstance().switchActiveUid(currentPageEditor().uid);
   689 				addTabMenuItems(currentPageEditor().uid);
   691 				addTabMenuItems(currentPageEditor().uid);
   690 				currentPageEditor.setActiveActions(true);
   692 				currentPageEditor.setActiveActions(true);
   691 			}
   693 			}
   692 
   694 
       
   695 			/* (non-Javadoc)
       
   696 			 * @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
       
   697 			 */
   693 			public void partActivated(IWorkbenchPart part) {
   698 			public void partActivated(IWorkbenchPart part) {
   694 				setMenus(part);
   699 				setMenus(part);
       
   700 				if (part instanceof PIPageEditor){
       
   701 					PIPageEditor editor = (PIPageEditor) part;
       
   702 					if (PIPageEditor.this.getActivePage() >= 0){
       
   703 						//update status line with time interval
       
   704 						ProfileVisualiser profVis = NpiInstanceRepository.getInstance().activeUidGetProfilePages().get(editor.getActivePage());
       
   705 						profVis.updateStatusBarTimeInterval(editor.getStartTime(),editor.getEndTime());		
       
   706 						profVis.initialiseGraphs();
       
   707 					}
       
   708 				}				
   695 			}
   709 			}
   696 
   710 
   697 			public void partBroughtToTop(IWorkbenchPart part) {
   711 			public void partBroughtToTop(IWorkbenchPart part) {
   698 				setMenus(part);
   712 				setMenus(part);
   699 			}
   713 			}
   703 
   717 
   704 			public void partDeactivated(IWorkbenchPart part) {
   718 			public void partDeactivated(IWorkbenchPart part) {
   705 			}
   719 			}
   706 
   720 
   707 			public void partOpened(IWorkbenchPart part) {
   721 			public void partOpened(IWorkbenchPart part) {
       
   722 				//notify plugins to execute any actions to be done on open
       
   723 				if (part instanceof PIPageEditor && PIPageEditor.this == part){
       
   724 					for (AbstractPiPlugin plugin : NpiInstanceRepository.getInstance().getPlugins(uid)) {
       
   725 						if (plugin instanceof IFinalizeTrace) {
       
   726 							((IFinalizeTrace)plugin).runOnPartOpened();
       
   727 						}
       
   728 					}
       
   729 				}
   708 			}
   730 			}
   709 		});
   731 		});
   710 
   732 
   711 		setSite(site);
   733 		setSite(site);
   712 		setInput(editorInput);
   734 		setInput(editorInput);