]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.common/src/org/simantics/browsing/ui/common/comparators/LexicalComparatorFactory.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui.common / src / org / simantics / browsing / ui / common / comparators / LexicalComparatorFactory.java
index 6c55e3021bd926a3888bf21f328d64d538483836..d4927426c549f00a2aae1a69052983f1f156344b 100644 (file)
@@ -1,73 +1,73 @@
-/*******************************************************************************\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.browsing.ui.common.comparators;\r
-\r
-import org.simantics.browsing.ui.BuiltinKeys;\r
-import org.simantics.browsing.ui.NodeContext;\r
-import org.simantics.browsing.ui.NodeQueryManager;\r
-import org.simantics.browsing.ui.content.ComparableContext;\r
-import org.simantics.browsing.ui.content.ComparableContextFactory;\r
-import org.simantics.browsing.ui.content.Labeler;\r
-\r
-public class LexicalComparatorFactory implements ComparableContextFactory {\r
-\r
-    private final String column;\r
-    private final String label;\r
-\r
-    public LexicalComparatorFactory(String column) {\r
-        this.column = column;\r
-        this.label = null;\r
-    }\r
-\r
-    public LexicalComparatorFactory(String column, String label) {\r
-        this.column = column;\r
-        this.label = label;\r
-    }\r
-\r
-    @Override\r
-    public ComparableContext[] create(NodeQueryManager manager, NodeContext parent, NodeContext[] children) {\r
-        ComparableContext[] result = new ComparableContext[children.length];\r
-        for (int i = 0; i < children.length; i++) {\r
-            NodeContext child = children[i];\r
-            Labeler labeler = manager.query(child, BuiltinKeys.SELECTED_LABELER);\r
-\r
-            int category = (labeler != null) ? labeler.getCategory() : 0;\r
-            String label = (labeler != null) ? labeler.getLabels().get(column) : "";\r
-            if (label == null)\r
-                label = "";\r
-\r
-            result[i] = new ImmutableLexicalComparable(category, label, child) {\r
-                @Override\r
-                public int compareTo(ComparableContext arg0) {\r
-                    ImmutableLexicalComparable other = (ImmutableLexicalComparable) arg0;\r
-\r
-                    int catDelta = getCategory() - other.getCategory();\r
-                    if (catDelta != 0)\r
-                        return catDelta;\r
-\r
-                    String label1 = getLabel();\r
-                    String label2 = other.getLabel();\r
-\r
-                    return label1.compareToIgnoreCase(label2);\r
-                }\r
-            };\r
-        }\r
-\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return label != null ? label : "Alphabetical";\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.browsing.ui.common.comparators;
+
+import org.simantics.browsing.ui.BuiltinKeys;
+import org.simantics.browsing.ui.NodeContext;
+import org.simantics.browsing.ui.NodeQueryManager;
+import org.simantics.browsing.ui.content.ComparableContext;
+import org.simantics.browsing.ui.content.ComparableContextFactory;
+import org.simantics.browsing.ui.content.Labeler;
+
+public class LexicalComparatorFactory implements ComparableContextFactory {
+
+    private final String column;
+    private final String label;
+
+    public LexicalComparatorFactory(String column) {
+        this.column = column;
+        this.label = null;
+    }
+
+    public LexicalComparatorFactory(String column, String label) {
+        this.column = column;
+        this.label = label;
+    }
+
+    @Override
+    public ComparableContext[] create(NodeQueryManager manager, NodeContext parent, NodeContext[] children) {
+        ComparableContext[] result = new ComparableContext[children.length];
+        for (int i = 0; i < children.length; i++) {
+            NodeContext child = children[i];
+            Labeler labeler = manager.query(child, BuiltinKeys.SELECTED_LABELER);
+
+            int category = (labeler != null) ? labeler.getCategory() : 0;
+            String label = (labeler != null) ? labeler.getLabels().get(column) : "";
+            if (label == null)
+                label = "";
+
+            result[i] = new ImmutableLexicalComparable(category, label, child) {
+                @Override
+                public int compareTo(ComparableContext arg0) {
+                    ImmutableLexicalComparable other = (ImmutableLexicalComparable) arg0;
+
+                    int catDelta = getCategory() - other.getCategory();
+                    if (catDelta != 0)
+                        return catDelta;
+
+                    String label1 = getLabel();
+                    String label2 = other.getLabel();
+
+                    return label1.compareToIgnoreCase(label2);
+                }
+            };
+        }
+
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return label != null ? label : "Alphabetical";
+    }
+
+}