1 /*******************************************************************************
\r
2 * Copyright (c) 2007 VTT Technical Research Centre of Finland and others.
\r
3 * All rights reserved. This program and the accompanying materials
\r
4 * are made available under the terms of the Eclipse Public License v1.0
\r
5 * which accompanies this distribution, and is available at
\r
6 * http://www.eclipse.org/legal/epl-v10.html
\r
9 * VTT Technical Research Centre of Finland - initial API and implementation
\r
10 *******************************************************************************/
\r
11 package org.simantics.proconf.g3d.tools;
\r
13 import java.util.ArrayList;
\r
14 import java.util.Iterator;
\r
15 import java.util.List;
\r
17 import org.eclipse.jface.viewers.ISelectionChangedListener;
\r
18 import org.eclipse.jface.viewers.IStructuredSelection;
\r
19 import org.eclipse.jface.viewers.SelectionChangedEvent;
\r
20 import org.simantics.layer0.utils.viewpoints.TraversalPath;
\r
21 import org.simantics.proconf.browsing.MutableCachedGraphTreeNode;
\r
24 * SelectionListener for OntologyExplorer
\r
26 * Returns Selection as TraversalPath
\r
28 * @author Marko Luukkainen
\r
31 public abstract class OEPathSelectionListener implements ISelectionChangedListener{
\r
32 @SuppressWarnings("unchecked")
\r
33 public void selectionChanged(SelectionChangedEvent event) {
\r
34 IStructuredSelection s = (IStructuredSelection)event.getSelection();
\r
35 List<TraversalPath> paths = new ArrayList<TraversalPath>();
\r
36 Iterator<MutableCachedGraphTreeNode> i = s.iterator();
\r
37 while(i.hasNext()) {
\r
38 MutableCachedGraphTreeNode node = i.next();
\r
39 TraversalPath path = (TraversalPath)node.getObject();
\r
42 pathSelectionUpdated(paths);
\r
45 protected abstract void pathSelectionUpdated(List<TraversalPath> paths);
\r