2 * Copyright 2015 Samsung Electronics All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package oic.simulator.logger;
19 import java.text.DateFormat;
20 import java.text.SimpleDateFormat;
22 import oic.simulator.clientcontroller.manager.LogManager;
24 import org.eclipse.jface.viewers.ITableLabelProvider;
25 import org.eclipse.jface.viewers.LabelProvider;
26 import org.eclipse.swt.graphics.Image;
29 * Label provider which determines what data has to be shown in the log view.
31 public class LogLabelProvider extends LabelProvider implements
34 DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss.SSS");
37 public Image getColumnImage(Object element, int columnIndex) {
38 if (columnIndex == 0) {
39 LogEntry entry = (LogEntry) element;
40 return LogManager.getSeverityIcon(entry.getSeverity());
46 public String getColumnText(Object element, int columnIndex) {
47 LogEntry entry = (LogEntry) element;
48 if (columnIndex == 0) {
49 return LogManager.getSeverityName(entry.getSeverity());
50 } else if (columnIndex == 1) {
51 return dateFormat.format(entry.getDate());
53 return entry.getMessage();