/******************************************************************************* * Copyright (c) 2007- VTT Technical Research Centre of Finland. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.proconf.g3d.tools; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.simantics.layer0.utils.viewpoints.TraversalPath; import org.simantics.proconf.browsing.MutableCachedGraphTreeNode; /** * SelectionListener for OntologyExplorer * * Returns Selection as TraversalPath * * @author Marko Luukkainen * */ public abstract class OEPathSelectionListener implements ISelectionChangedListener{ @SuppressWarnings("unchecked") public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection s = (IStructuredSelection)event.getSelection(); List paths = new ArrayList(); Iterator i = s.iterator(); while(i.hasNext()) { MutableCachedGraphTreeNode node = i.next(); TraversalPath path = (TraversalPath)node.getObject(); paths.add(path); } pathSelectionUpdated(paths); } protected abstract void pathSelectionUpdated(List paths); }