-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.image.ui.modelBrowser.handlers;\r
-\r
-import java.io.File;\r
-import java.util.Collection;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.jface.viewers.ISelection;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.simantics.db.Resource;\r
-import org.simantics.image.ui.CreateImages;\r
-import org.simantics.image.ui.ImportImagesActionFactory;\r
-import org.simantics.image.ui.modelBrowser.ImagesNode;\r
-import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.ui.AdaptionUtils;\r
-\r
-/**\r
- * @author J-P Laine\r
- */\r
-public class ImportImageHandler extends AbstractHandler {\r
-\r
- @Override\r
- public Object execute(ExecutionEvent event) throws ExecutionException {\r
- final Shell shell = HandlerUtil.getActiveShell(event);\r
-\r
- ISelection selection = HandlerUtil.getCurrentSelection(event);\r
- ImagesNode images = AdaptionUtils.adaptToSingle(selection, ImagesNode.class);\r
- if (images == null)\r
- return null;\r
- final Resource container = images.data;\r
-\r
- Collection<File> files = ImportImagesActionFactory.requestImportedImages(shell);\r
- if (files.isEmpty())\r
- return null;\r
-\r
- SimanticsUI.getSession().asyncRequest( new CreateImages(container, files) );\r
-\r
- return null;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * 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.image.ui.modelBrowser.handlers;
+
+import java.io.File;
+import java.util.Collection;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.simantics.Simantics;
+import org.simantics.db.Resource;
+import org.simantics.image.ui.CreateImages;
+import org.simantics.image.ui.ImportImagesActionFactory;
+import org.simantics.image.ui.modelBrowser.ImagesNode;
+import org.simantics.utils.ui.AdaptionUtils;
+
+/**
+ * @author J-P Laine
+ */
+public class ImportImageHandler extends AbstractHandler {
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final Shell shell = HandlerUtil.getActiveShell(event);
+
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ ImagesNode images = AdaptionUtils.adaptToSingle(selection, ImagesNode.class);
+ if (images == null)
+ return null;
+ final Resource container = images.data;
+
+ Collection<File> files = ImportImagesActionFactory.requestImportedImages(shell);
+ if (files.isEmpty())
+ return null;
+
+ Simantics.getSession().asyncRequest( new CreateImages(container, files) );
+
+ return null;
+ }
+
+}