]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.message.ui/src/org/simantics/message/ui/LogViewContentProvider.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.message.ui / src / org / simantics / message / ui / LogViewContentProvider.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
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 }