sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.perfcounters/src/com/nokia/carbide/cpp/pi/internal/perfcounters/PecLegendLabelProvider.java
changeset 5 844b047e260d
equal deleted inserted replaced
4:615035072f7e 5:844b047e260d
       
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: 
       
    15  *
       
    16  */
       
    17 
       
    18 package com.nokia.carbide.cpp.pi.internal.perfcounters;
       
    19 
       
    20 import com.nokia.carbide.cpp.pi.peccommon.PecCommonLegendLabelProvider;
       
    21 
       
    22 /**
       
    23  * Performance Counter Legend: LabelProvider for TableViewer 
       
    24  */
       
    25 public class PecLegendLabelProvider extends PecCommonLegendLabelProvider {
       
    26 	private static final String EMPTY_STRING = ""; //$NON-NLS-1$
       
    27 
       
    28 	@Override
       
    29 	public String getColumnText(Object element, int columnIndex) {
       
    30 		String s = null;
       
    31 		
       
    32 		if (element instanceof PecLegendElement){
       
    33 			PecLegendElement le = (PecLegendElement)element;
       
    34 			
       
    35 			switch (columnIndex) {
       
    36 							
       
    37 			case PecLegend.COLUMN_PER_A:
       
    38 				if (le.getCnt() > 0 && !le.isCoreValuesOnly()){
       
    39 					s = String.format(Messages.PecLegendLabelProvider_4, le.getxOverY(0));
       
    40 				}
       
    41 				break;
       
    42 				
       
    43 			case PecLegend.COLUMN_PER_B:
       
    44 				if (le.getCnt() > 0 && !le.isCoreValuesOnly()){
       
    45 					s = String.format(Messages.PecLegendLabelProvider_5, le.getxOverY(1));
       
    46 				}
       
    47 				break;
       
    48 				
       
    49 			case PecLegend.COLUMN_PER_C:
       
    50 				if (le.getCnt() > 0 && !le.isCoreValuesOnly()){
       
    51 					s = String.format(Messages.PecLegendLabelProvider_6, le.getxOverY(2));
       
    52 				}
       
    53 				break;
       
    54 				
       
    55 			default:
       
    56 				return super.getColumnText(element, columnIndex);
       
    57 			}
       
    58 			
       
    59 		}
       
    60 		return s == null ? EMPTY_STRING : s;
       
    61 	}
       
    62 	
       
    63 
       
    64 }