// $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;
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;
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;
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;
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() {
}
- class SessionsTreeLabelProvider extends StyledCellLabelProvider {
+ class SessionsTreeLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
@Override
public void update(ViewerCell cell) {
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();
+ }
}
}