1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.sysdyn.ui.handlers.newComponents;
\r
14 import org.eclipse.core.commands.ExecutionEvent;
\r
15 import org.eclipse.core.commands.ExecutionException;
\r
16 import org.eclipse.jface.viewers.ISelection;
\r
17 import org.eclipse.ui.handlers.HandlerUtil;
\r
18 import org.simantics.browsing.ui.common.node.AbstractNode;
\r
19 import org.simantics.db.Resource;
\r
20 import org.simantics.utils.ui.AdaptionUtils;
\r
23 * Creates a new shared function library.
\r
25 * @author Teemu Lempinen
\r
28 public class NewSharedFunctionLibraryHandler extends NewFunctionLibraryHandler {
\r
31 public Object execute(ExecutionEvent event) throws ExecutionException {
\r
33 ISelection sel = HandlerUtil.getCurrentSelection(event);
\r
35 @SuppressWarnings("unchecked")
\r
36 AbstractNode<Resource> node = AdaptionUtils.adaptToSingle(sel, AbstractNode.class);
\r
40 createLibrary(node.data, true);
\r