]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.issues.ui/src/org/simantics/issues/ui/IssueImageRule.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.issues.ui / src / org / simantics / issues / ui / IssueImageRule.java
index d92a9ade0cb6916a70dcf66c77dd85dedfeed26d..b19a1f711ed507e7099f9258f92bc1f3e6ec2f7d 100644 (file)
@@ -1,63 +1,63 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 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.issues.ui;\r
-\r
-import java.util.Collections;\r
-import java.util.Map;\r
-\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.simantics.browsing.ui.common.ColumnKeys;\r
-import org.simantics.browsing.ui.model.images.ImageRule;\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.ontology.IssueResource;\r
-import org.simantics.silk.SilkResources;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class IssueImageRule implements ImageRule {\r
-\r
-    private final String DESCRIPTION = ColumnKeys.SINGLE;\r
-\r
-    @Override\r
-    public boolean isCompatible(Class<?> contentType) {\r
-        return contentType.equals(Variable.class);\r
-    }\r
-\r
-    @Override\r
-    public Map<String, ImageDescriptor> getImage(ReadGraph graph, Object content) throws DatabaseException {\r
-\r
-        Variable issue = (Variable)content;\r
-\r
-        IssueResource ISSUE = IssueResource.getInstance(graph);\r
-        SilkResources SILK = SilkResources.getInstance(graph);\r
-        String severity = issue.getPropertyValue(graph, "severity");\r
-\r
-        // TODO: now to do this with variables?\r
-        Resource issueResource = issue.getPossibleRepresents(graph);\r
-        boolean resolved = issueResource != null ? graph.hasStatement(issueResource, ISSUE.Resolved) : false;\r
-        if (resolved)\r
-            return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.tick, ImageDescriptor.class));\r
-\r
-        if("Fatal".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.bomb, ImageDescriptor.class));\r
-        else if("Error".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.exclamation, ImageDescriptor.class));\r
-        else if("Warning".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.error, ImageDescriptor.class));\r
-        else if("Info".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.information, ImageDescriptor.class));\r
-        else if("Note".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.note, ImageDescriptor.class));\r
-        else return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.help, ImageDescriptor.class));\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.issues.ui;
+
+import java.util.Collections;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.simantics.browsing.ui.common.ColumnKeys;
+import org.simantics.browsing.ui.model.images.ImageRule;
+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.ontology.IssueResource;
+import org.simantics.silk.SilkResources;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class IssueImageRule implements ImageRule {
+
+    private final String DESCRIPTION = ColumnKeys.SINGLE;
+
+    @Override
+    public boolean isCompatible(Class<?> contentType) {
+        return contentType.equals(Variable.class);
+    }
+
+    @Override
+    public Map<String, ImageDescriptor> getImage(ReadGraph graph, Object content) throws DatabaseException {
+
+        Variable issue = (Variable)content;
+
+        IssueResource ISSUE = IssueResource.getInstance(graph);
+        SilkResources SILK = SilkResources.getInstance(graph);
+        String severity = issue.getPropertyValue(graph, "severity");
+
+        // TODO: now to do this with variables?
+        Resource issueResource = issue.getPossibleRepresents(graph);
+        boolean resolved = issueResource != null ? graph.hasStatement(issueResource, ISSUE.Resolved) : false;
+        if (resolved)
+            return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.tick, ImageDescriptor.class));
+
+        if("Fatal".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.bomb, ImageDescriptor.class));
+        else if("Error".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.exclamation, ImageDescriptor.class));
+        else if("Warning".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.error, ImageDescriptor.class));
+        else if("Info".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.information, ImageDescriptor.class));
+        else if("Note".equals(severity)) return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.note, ImageDescriptor.class));
+        else return Collections.singletonMap(DESCRIPTION, graph.adapt(SILK.help, ImageDescriptor.class));
+
+    }
+
+}