1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.debug.core.logview;
13 import net.sourceforge.phpdt.internal.debug.core.PHPDegugCorePluginImages;
15 import org.eclipse.core.runtime.IStatus;
16 import org.eclipse.jface.viewers.ITableLabelProvider;
17 import org.eclipse.jface.viewers.LabelProvider;
18 import org.eclipse.swt.graphics.Image;
20 public class LogViewLabelProvider
22 implements ITableLabelProvider {
23 private Image infoImage;
24 private Image errorImage;
25 private Image warningImage;
26 private Image errorWithStackImage;
28 public LogViewLabelProvider() {
29 errorImage = PHPDegugCorePluginImages.DESC_ERROR_ST_OBJ.createImage();
30 warningImage = PHPDegugCorePluginImages.DESC_WARNING_ST_OBJ.createImage();
31 infoImage = PHPDegugCorePluginImages.DESC_INFO_ST_OBJ.createImage();
32 errorWithStackImage = PHPDegugCorePluginImages.DESC_ERROR_STACK_OBJ.createImage();
34 public void dispose() {
37 warningImage.dispose();
38 errorWithStackImage.dispose();
41 public Image getColumnImage(Object element, int columnIndex) {
42 LogEntry entry = (LogEntry) element;
43 if (columnIndex == 1) {
44 switch (entry.getSeverity()) {
47 case IStatus.WARNING :
50 return (entry.getStack() == null ? errorImage : errorWithStackImage);
56 public String getColumnText(Object element, int columnIndex) {
57 LogEntry entry = (LogEntry) element;
58 switch (columnIndex) {
60 return entry.getMessage();
62 return entry.getPluginId();
64 return entry.getDate();
66 return ""; //$NON-NLS-1$