]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.ui/src/org/simantics/document/ui/contribution/DocumentVersionImageDecorationRule.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.document.ui / src / org / simantics / document / ui / contribution / DocumentVersionImageDecorationRule.java
index 0454025682d775faf6d9c3abe4123011bb22bb85..6948c2f3fea070c9030eaf1c4bd00cc0e929c6bb 100644 (file)
@@ -1,64 +1,64 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2012 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.document.ui.contribution;\r
-\r
-import org.eclipse.jface.resource.ImageDescriptor;\r
-import org.eclipse.jface.viewers.IDecoration;\r
-import org.simantics.browsing.ui.content.ImageDecorator;\r
-import org.simantics.browsing.ui.model.imagedecorators.ImageDecorationRule;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.document.DocumentResource;\r
-import org.simantics.document.ui.Activator;\r
-import org.simantics.utils.ui.gfx.DecorationOverlayIcon;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class DocumentVersionImageDecorationRule implements ImageDecorationRule {\r
-       \r
-    @Override\r
-    public boolean isCompatible(Class<?> contentType) {\r
-        return contentType.equals(Resource.class);\r
-    }\r
-\r
-    @Override\r
-    public ImageDecorator getImageDecorator(ReadGraph graph, Object content) throws DatabaseException {\r
-       \r
-        DocumentResource DOC = DocumentResource.getInstance(graph);\r
-        if (graph.hasStatement((Resource)content, DOC.HasNewerVersion))\r
-               return new Dec(Activator.getDefault().clock_red);\r
-        \r
-        return null;\r
-        \r
-    }\r
-    \r
-       private class Dec implements ImageDecorator {\r
-               private ImageDescriptor decorator;\r
-               \r
-               public Dec(ImageDescriptor decorator) {\r
-                       this.decorator = decorator;\r
-               }\r
-               @SuppressWarnings("unchecked")\r
-               public <Image extends Object> Image decorateImage(Image image, String column, int itemIndex) {\r
-                       return (Image) getDecoration((ImageDescriptor) image,decorator);\r
-               };\r
-       }\r
-\r
-    private ImageDescriptor getDecoration(ImageDescriptor original, ImageDescriptor img) {\r
-        //ImageDescriptor img = Activator.getDefault().DOCUMENT_DECORATION_ICON;\r
-        return (original == null) ? img\r
-                : new DecorationOverlayIcon(original, img, IDecoration.BOTTOM_RIGHT);\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 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.document.ui.contribution;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IDecoration;
+import org.simantics.browsing.ui.content.ImageDecorator;
+import org.simantics.browsing.ui.model.imagedecorators.ImageDecorationRule;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.document.DocumentResource;
+import org.simantics.document.ui.Activator;
+import org.simantics.utils.ui.gfx.DecorationOverlayIcon;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class DocumentVersionImageDecorationRule implements ImageDecorationRule {
+       
+    @Override
+    public boolean isCompatible(Class<?> contentType) {
+        return contentType.equals(Resource.class);
+    }
+
+    @Override
+    public ImageDecorator getImageDecorator(ReadGraph graph, Object content) throws DatabaseException {
+       
+        DocumentResource DOC = DocumentResource.getInstance(graph);
+        if (graph.hasStatement((Resource)content, DOC.HasNewerVersion))
+               return new Dec(Activator.getDefault().clock_red);
+        
+        return null;
+        
+    }
+    
+       private class Dec implements ImageDecorator {
+               private ImageDescriptor decorator;
+               
+               public Dec(ImageDescriptor decorator) {
+                       this.decorator = decorator;
+               }
+               @SuppressWarnings("unchecked")
+               public <Image extends Object> Image decorateImage(Image image, String column, int itemIndex) {
+                       return (Image) getDecoration((ImageDescriptor) image,decorator);
+               };
+       }
+
+    private ImageDescriptor getDecoration(ImageDescriptor original, ImageDescriptor img) {
+        //ImageDescriptor img = Activator.getDefault().DOCUMENT_DECORATION_ICON;
+        return (original == null) ? img
+                : new DecorationOverlayIcon(original, img, IDecoration.BOTTOM_RIGHT);
+    }
+
+}