Merge branch 'develop' of wp5.e-taxonomy.eu:/var/git/taxeditor into remoting-4.0
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / sessions / InspectSessionsDialog.java
index 82db7c539083a2a6d45bffcd11bee736002f9c3f..003ecb2157cdcc707662c5028ed0ecdf079fa124 100644 (file)
@@ -1,12 +1,12 @@
 // $Id$
 /**
-* Copyright (C) 2015 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2015 EDIT
+ * European Distributed Institute of Taxonomy
+ * http://www.e-taxonomy.eu
+ *
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
 package eu.etaxonomy.taxeditor.view.sessions;
 
 import java.util.List;
@@ -14,6 +14,7 @@ import java.util.List;
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.Element;
 
+import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.StyledCellLabelProvider;
 import org.eclipse.jface.viewers.StyledString;
@@ -24,6 +25,7 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.SashForm;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
@@ -33,7 +35,8 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
 import org.eclipse.wb.swt.SWTResourceManager;
 
 import eu.etaxonomy.taxeditor.remoting.cache.CdmModelFieldPropertyFromClass;
@@ -111,21 +114,25 @@ public class InspectSessionsDialog extends Dialog {
         sashForm = new SashForm(shlInspectSessions, SWT.VERTICAL);
         sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
 
-                treeViewer = new TreeViewer(sashForm, SWT.BORDER);
-                Tree tree = treeViewer.getTree();
+        PatternFilter filter = new PatternFilter();
+        FilteredTree tree = new FilteredTree(sashForm, SWT.MULTI | SWT.H_SCROLL | SWT.BORDER
+                | SWT.V_SCROLL, filter, true);
+        treeViewer = tree.getViewer();
+        //treeViewer = new TreeViewer(sashForm, SWT.BORDER);
+        //Tree tree = treeViewer.getTree();
 
-                                compositeDebug = new Composite(sashForm, SWT.NONE);
-                                                        compositeDebug.setLayout(new GridLayout(1, false));
+        compositeDebug = new Composite(sashForm, SWT.NONE);
+        compositeDebug.setLayout(new GridLayout(1, false));
 
-                                                        lblDebugInformation = new Label(compositeDebug, SWT.NONE);
-                                                        lblDebugInformation.setAlignment(SWT.CENTER);
-                                                        lblDebugInformation.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
-                                                        lblDebugInformation.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
-                                                        lblDebugInformation.setText("Debug Information");
+        lblDebugInformation = new Label(compositeDebug, SWT.NONE);
+        lblDebugInformation.setAlignment(SWT.CENTER);
+        lblDebugInformation.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1));
+        lblDebugInformation.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL));
+        lblDebugInformation.setText("Debug Information");
 
-                                                                                        txtDebugInfo = new Text(compositeDebug, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
-                                                                                        txtDebugInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
-                                sashForm.setWeights(new int[] {338, 184});
+        txtDebugInfo = new Text(compositeDebug, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
+        txtDebugInfo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+        sashForm.setWeights(new int[] {338, 184});
 
         btnClose = new Button(shlInspectSessions, SWT.NONE);
         btnClose.addSelectionListener(new SelectionAdapter() {
@@ -221,7 +228,7 @@ public class InspectSessionsDialog extends Dialog {
 
     }
 
-    class SessionsTreeLabelProvider extends StyledCellLabelProvider {
+    class SessionsTreeLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
 
         @Override
         public void update(ViewerCell cell) {
@@ -234,6 +241,24 @@ public class InspectSessionsDialog extends Dialog {
             cell.setStyleRanges(text.getStyleRanges());
             super.update(cell);
         }
+
+        /* (non-Javadoc)
+         * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+         */
+        @Override
+        public Image getImage(Object element) {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        /* (non-Javadoc)
+         * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+         */
+        @Override
+        public String getText(Object element) {
+            CdmEntityInfo cei = (CdmEntityInfo)element;
+            return cei.getLabel();
+        }
     }
 }