]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/SeverityFolderLabelRule.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.issues.ui / src / org / simantics / issues / ui / SeverityFolderLabelRule.java
index 62b2371082bb097bd72005307e774ed8477124a1..32e6683dd871f1013f15d8dd2684157fad66b424 100644 (file)
@@ -1,62 +1,62 @@
-/*******************************************************************************\r
- * Copyright (c) 2010, 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.issues.ui;\r
-\r
-import java.util.Collections;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.simantics.browsing.ui.common.ColumnKeys;\r
-import org.simantics.browsing.ui.model.labels.LabelRule;\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.issues.common.IssuesOfSeverity;\r
-import org.simantics.issues.ui.ontology.IssueUIResource;\r
-import org.simantics.layer0.Layer0;\r
-\r
-public class SeverityFolderLabelRule implements LabelRule {\r
-       \r
-    private final String DESCRIPTION = ColumnKeys.SINGLE;\r
-\r
-       final Resource rule;\r
-       \r
-       public SeverityFolderLabelRule(Resource rule) {\r
-               this.rule = rule;\r
-       }\r
-    \r
-    @Override\r
-    public boolean isCompatible(Class<?> contentType) {\r
-        return contentType.equals(Resource.class);\r
-    }\r
-\r
-    @Override\r
-    public Map<String,String> getLabel(ReadGraph graph, Object content) throws DatabaseException {\r
-       \r
-       Layer0 L0 = Layer0.getInstance(graph);\r
-        IssueUIResource UI = IssueUIResource.getInstance(graph);\r
-       Resource project = (Resource)content;\r
-       Resource severity = graph.getSingleObject(rule, UI.IssueBrowseContext_SeverityFolderLabelRule_HasSeverity);\r
-       String severityName = graph.getRelatedValue(severity, L0.HasName, Bindings.STRING);\r
-        Set<Variable> issues = graph.syncRequest(new IssuesOfSeverity(project, severity));\r
-        \r
-        if(issues.size() > 1) {\r
-               return Collections.singletonMap(DESCRIPTION, severityName + "s (" + issues.size() + " items)");\r
-        } else {\r
-               return Collections.singletonMap(DESCRIPTION, severityName + "s (1 item)");\r
-        }\r
-        \r
-    }\r
-    \r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2010, 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.issues.ui;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.simantics.browsing.ui.common.ColumnKeys;
+import org.simantics.browsing.ui.model.labels.LabelRule;
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.issues.common.IssuesOfSeverity;
+import org.simantics.issues.ui.ontology.IssueUIResource;
+import org.simantics.layer0.Layer0;
+
+public class SeverityFolderLabelRule implements LabelRule {
+       
+    private final String DESCRIPTION = ColumnKeys.SINGLE;
+
+       final Resource rule;
+       
+       public SeverityFolderLabelRule(Resource rule) {
+               this.rule = rule;
+       }
+    
+    @Override
+    public boolean isCompatible(Class<?> contentType) {
+        return contentType.equals(Resource.class);
+    }
+
+    @Override
+    public Map<String,String> getLabel(ReadGraph graph, Object content) throws DatabaseException {
+       
+       Layer0 L0 = Layer0.getInstance(graph);
+        IssueUIResource UI = IssueUIResource.getInstance(graph);
+       Resource project = (Resource)content;
+       Resource severity = graph.getSingleObject(rule, UI.IssueBrowseContext_SeverityFolderLabelRule_HasSeverity);
+       String severityName = graph.getRelatedValue(severity, L0.HasName, Bindings.STRING);
+        Set<Variable> issues = graph.syncRequest(new IssuesOfSeverity(project, severity));
+        
+        if(issues.size() > 1) {
+               return Collections.singletonMap(DESCRIPTION, severityName + "s (" + issues.size() + " items)");
+        } else {
+               return Collections.singletonMap(DESCRIPTION, severityName + "s (1 item)");
+        }
+        
+    }
+    
+}