]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.message.ui/src/org/simantics/message/ui/LogViewContentProvider.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.message.ui / src / org / simantics / message / ui / LogViewContentProvider.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.message.ui;
13
14 import org.eclipse.jface.viewers.ITreeContentProvider;
15 import org.eclipse.jface.viewers.Viewer;
16
17 public class LogViewContentProvider implements ITreeContentProvider {
18         private LogView logView;
19
20         public LogViewContentProvider(LogView logView) {
21                 this.logView = logView;
22         }
23
24         public void dispose() { // do nothing
25         }
26
27         public Object[] getChildren(Object element) {
28                 return ((AbstractEntry) element).getChildren(element);
29         }
30
31         public Object[] getElements(Object element) {
32                 return logView.getElements();
33         }
34
35         public Object getParent(Object element) {
36                 if (element instanceof LogSession) {
37                         return null;
38                 }
39                 return ((AbstractEntry) element).getParent(element);
40         }
41
42         public boolean hasChildren(Object element) {
43                 return ((AbstractEntry) element).getChildren(element).length > 0;
44         }
45
46         public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // do nothing
47         }
48
49         public boolean isDeleted(Object element) {
50                 return false;
51         }
52 }