]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.desktop.ui/src/org/simantics/desktop/ui/internal/ImportModel.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.desktop.ui / src / org / simantics / desktop / ui / internal / ImportModel.java
index 42a21d76c0eebd6a1b83f401b60ba419a6d1bd7a..25d7d3a1715922fc1a79010b633b01fb8458e9a0 100644 (file)
@@ -1,67 +1,67 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
- * 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.desktop.ui.internal;\r
-\r
-import java.io.File;\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.core.runtime.IProgressMonitor;\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.core.runtime.Status;\r
-import org.eclipse.core.runtime.jobs.Job;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.widgets.FileDialog;\r
-import org.eclipse.swt.widgets.Shell;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.simantics.DatabaseJob;\r
-import org.simantics.modeling.ModelingUtils;\r
-\r
-public class ImportModel extends AbstractHandler {\r
-\r
-    @Override\r
-    public Object execute(ExecutionEvent event) throws ExecutionException {\r
-        \r
-        // Get imported transferable graph file using FileDialog\r
-        Shell shell = HandlerUtil.getActiveShellChecked(event);\r
-        FileDialog fd = new FileDialog(shell, SWT.OPEN);\r
-        fd.setText("Import Model");\r
-\r
-        String path = Activator.getDefault().getPreferenceStore().getString("IMPORT_MODEL_PATH");\r
-        if(path.isEmpty() || !(new File(path).exists())){\r
-               path = System.getProperty("user.dir");\r
-        }\r
-        \r
-        fd.setFilterPath(path);\r
-        String[] filterExt = {"*.tg", "*.*"};\r
-        fd.setFilterExtensions(filterExt);\r
-        final String selected = fd.open();\r
-        if(selected == null) return null;\r
-\r
-        Job job = new DatabaseJob("Import model") {\r
-\r
-            @Override\r
-            protected IStatus run(IProgressMonitor monitor) {\r
-                ModelingUtils.importModel(selected);\r
-                return Status.OK_STATUS;\r
-            }\r
-        };\r
-        \r
-        job.setUser(true);\r
-        job.schedule();\r
-\r
-        return null;\r
-        \r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 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.desktop.ui.internal;
+
+import java.io.File;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.simantics.DatabaseJob;
+import org.simantics.modeling.ModelingUtils;
+
+public class ImportModel extends AbstractHandler {
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        
+        // Get imported transferable graph file using FileDialog
+        Shell shell = HandlerUtil.getActiveShellChecked(event);
+        FileDialog fd = new FileDialog(shell, SWT.OPEN);
+        fd.setText("Import Model");
+
+        String path = Activator.getDefault().getPreferenceStore().getString("IMPORT_MODEL_PATH");
+        if(path.isEmpty() || !(new File(path).exists())){
+               path = System.getProperty("user.dir");
+        }
+        
+        fd.setFilterPath(path);
+        String[] filterExt = {"*.tg", "*.*"};
+        fd.setFilterExtensions(filterExt);
+        final String selected = fd.open();
+        if(selected == null) return null;
+
+        Job job = new DatabaseJob("Import model") {
+
+            @Override
+            protected IStatus run(IProgressMonitor monitor) {
+                ModelingUtils.importModel(selected);
+                return Status.OK_STATUS;
+            }
+        };
+        
+        job.setUser(true);
+        job.schedule();
+
+        return null;
+        
+    }
+
+}