]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.annotation.ui/src/org/simantics/annotation/ui/wizard/Preferences.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.annotation.ui / src / org / simantics / annotation / ui / wizard / Preferences.java
index 38deda6218c54560e64df8bcc3c322666b13e89f..55dc62607a4051bc3a75f18d93304a4ab6e82cd0 100644 (file)
@@ -1,69 +1,69 @@
-/*******************************************************************************\r
- * Copyright (c) 2012 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.annotation.ui.wizard;\r
-\r
-import java.util.Deque;\r
-import java.util.Iterator;\r
-import java.util.LinkedList;\r
-import java.util.Set;\r
-import java.util.TreeSet;\r
-\r
-import org.eclipse.ui.IMemento;\r
-import org.simantics.utils.ui.workbench.StringMemento;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public final class Preferences {\r
-\r
-    public static final String  RECENT_ANNOTATION_TYPE_IMPORT_LOCATIONS = "RECENT_ANNOTATION_TYPE_IMPORT_LOCATIONS";\r
-    public static final String  RECENT_ANNOTATION_TYPE_EXPORT_LOCATIONS = "RECENT_ANNOTATION_TYPE_EXPORT_LOCATIONS";\r
-    public static final String  ANNOTATION_TYPE_EXPORT_OVERWRITE = "ANNOTATION_TYPE_EXPORT_OVERWRITE";\r
-\r
-    private static final String TAG_PATH                = "path";\r
-    private static final String ATTR_NAME               = "name";\r
-\r
-    public static Deque<String> decodePaths(String recentPathsPref) {\r
-        Deque<String> result = new LinkedList<String>();\r
-        try {\r
-            StringMemento sm = new StringMemento(recentPathsPref);\r
-            for (IMemento m : sm.getChildren(TAG_PATH)) {\r
-                String name = m.getString(ATTR_NAME);\r
-                if (name != null && !name.isEmpty())\r
-                    result.add(name);\r
-            }\r
-        } catch (IllegalArgumentException e) {\r
-        }\r
-        return result;\r
-    }\r
-\r
-    public static String encodePaths(Deque<String> recentPaths) {\r
-        StringMemento sm = new StringMemento();\r
-        for (String path : recentPaths) {\r
-            IMemento m = sm.createChild(TAG_PATH);\r
-            m.putString(ATTR_NAME, path);\r
-        }\r
-        return sm.toString();\r
-    }\r
-\r
-    public static <T> void removeDuplicates(Iterable<String> iter) {\r
-        // Remove duplicates\r
-        Set<String> dups = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);\r
-        for (Iterator<String> it = iter.iterator(); it.hasNext();) {\r
-            String path = it.next();\r
-            if (!dups.add(path)) {\r
-                it.remove();\r
-            }\r
-        }\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012 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.annotation.ui.wizard;
+
+import java.util.Deque;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.eclipse.ui.IMemento;
+import org.simantics.utils.ui.workbench.StringMemento;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public final class Preferences {
+
+    public static final String  RECENT_ANNOTATION_TYPE_IMPORT_LOCATIONS = "RECENT_ANNOTATION_TYPE_IMPORT_LOCATIONS";
+    public static final String  RECENT_ANNOTATION_TYPE_EXPORT_LOCATIONS = "RECENT_ANNOTATION_TYPE_EXPORT_LOCATIONS";
+    public static final String  ANNOTATION_TYPE_EXPORT_OVERWRITE = "ANNOTATION_TYPE_EXPORT_OVERWRITE";
+
+    private static final String TAG_PATH                = "path";
+    private static final String ATTR_NAME               = "name";
+
+    public static Deque<String> decodePaths(String recentPathsPref) {
+        Deque<String> result = new LinkedList<String>();
+        try {
+            StringMemento sm = new StringMemento(recentPathsPref);
+            for (IMemento m : sm.getChildren(TAG_PATH)) {
+                String name = m.getString(ATTR_NAME);
+                if (name != null && !name.isEmpty())
+                    result.add(name);
+            }
+        } catch (IllegalArgumentException e) {
+        }
+        return result;
+    }
+
+    public static String encodePaths(Deque<String> recentPaths) {
+        StringMemento sm = new StringMemento();
+        for (String path : recentPaths) {
+            IMemento m = sm.createChild(TAG_PATH);
+            m.putString(ATTR_NAME, path);
+        }
+        return sm.toString();
+    }
+
+    public static <T> void removeDuplicates(Iterable<String> iter) {
+        // Remove duplicates
+        Set<String> dups = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
+        for (Iterator<String> it = iter.iterator(); it.hasNext();) {
+            String path = it.next();
+            if (!dups.add(path)) {
+                it.remove();
+            }
+        }
+    }
+
+}