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.util.ArrayList;
20 import java.util.List;
22 import org.eclipse.jface.viewers.ITreeContentProvider;
23 import org.eclipse.jface.viewers.Viewer;
26 * Maintains simulator log entries and provides content to the log view.
28 public class LogContentProvider implements ITreeContentProvider {
30 List<LogEntry> logEntryList = new ArrayList<LogEntry>();
32 @SuppressWarnings("unchecked")
34 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
35 logEntryList = (List<LogEntry>) newInput;
39 public Object[] getChildren(Object element) {
44 public Object[] getElements(Object input) {
45 return logEntryList.toArray();
49 public Object getParent(Object element) {
54 public boolean hasChildren(Object element) {
59 public void dispose() {
62 public synchronized void addLog(LogEntry newElement) {
63 logEntryList.add(newElement);