crashanalysis/crashanalyser/com.nokia.s60tools.crashanalyser/src/com/nokia/s60tools/crashanalyser/ui/viewers/CrashAnalyserTableViewer.java
changeset 0 5ad7ad99af01
equal deleted inserted replaced
-1:000000000000 0:5ad7ad99af01
       
     1 /*
       
     2 * Copyright (c) 2008 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 "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.s60tools.crashanalyser.ui.viewers;
       
    19 
       
    20 import org.eclipse.jface.viewers.CellLabelProvider;
       
    21 import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
       
    22 import org.eclipse.jface.viewers.TableViewer;
       
    23 import org.eclipse.jface.viewers.ViewerCell;
       
    24 import org.eclipse.jface.window.ToolTip;
       
    25 import org.eclipse.swt.graphics.Point;
       
    26 import org.eclipse.swt.widgets.Table;
       
    27 
       
    28 /**
       
    29  * Base table viewer for table viewers used in Crash Analyser project.
       
    30  * Providers tooltip functionality and settings for all table viewers. 
       
    31  *
       
    32  */
       
    33 public class CrashAnalyserTableViewer extends TableViewer {
       
    34 	CellLabelProvider labelProvider;
       
    35 	protected CrashAnalyserTableViewer(Table table) {
       
    36 		super(table);
       
    37 		ColumnViewerToolTipSupport.enableFor(this,ToolTip.NO_RECREATE);
       
    38 		
       
    39 		labelProvider = new CellLabelProvider() {
       
    40 
       
    41 			public String getToolTipText(Object element) {
       
    42 				if ("".equals(element.toString()))
       
    43 					return null;
       
    44 				else
       
    45 					return element.toString();
       
    46 			}
       
    47 
       
    48 			public Point getToolTipShift(Object object) {
       
    49 				return new Point(10, 10);
       
    50 			}
       
    51 
       
    52 			public int getToolTipDisplayDelayTime(Object object) {
       
    53 				return 200;
       
    54 			}
       
    55 
       
    56 			public int getToolTipTimeDisplayed(Object object) {
       
    57 				return 5000;
       
    58 			}
       
    59 
       
    60 			public void update(ViewerCell cell) {
       
    61 				cell.setText(cell.getElement().toString());
       
    62 			}
       
    63 		};		
       
    64 		
       
    65 	}
       
    66 }