/******************************************************************************* * 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.processeditor.adapters; import java.util.List; import org.simantics.proconf.g3d.base.ScenegraphAdapter; import org.simantics.proconf.g3d.base.SelectionAdapter; import org.simantics.proconf.g3d.scenegraph.IGraphicsNode; import org.simantics.proconf.g3d.scenegraph.ISelectableNode; public class ProcessEditorSelectionAdapter extends SelectionAdapter { public ProcessEditorSelectionAdapter(ScenegraphAdapter adapter) { super(adapter); } @Override public void setEditorSelection() { List sel = getSelectedObjects(); for (IGraphicsNode o : adapter.getNodes()) if (o instanceof ISelectableNode) { if (sel.contains(o)) { ((ISelectableNode)o).setSelected(true); } else { ((ISelectableNode)o).setSelected(false); } } } @Override protected void setEditorHighlightSelection() { List sel = getInteractiveSelectedObjects(); for (IGraphicsNode o : adapter.getNodes()) if (o instanceof ISelectableNode) { if (sel.contains(o)) { ((ISelectableNode)o).setHighlighted(true); } else { ((ISelectableNode)o).setHighlighted(false); } } } }