]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.selectionview/src/org/simantics/selectionview/ComparableTabContributor.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.selectionview / src / org / simantics / selectionview / ComparableTabContributor.java
index 29891d5ed8eac1960a0eae8b05dcdbf50f056f99..8dd72accd41729a69818f3e1b1935e6d944c5961 100644 (file)
-/*******************************************************************************\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.selectionview;\r
-\r
-import org.eclipse.swt.graphics.Image;\r
-import org.eclipse.swt.widgets.Composite;\r
-import org.eclipse.ui.IWorkbenchSite;\r
-import org.simantics.db.management.ISessionContext;\r
-\r
-/**\r
- * A wrapper for {@link PropertyTabContributor} to label/image it and make it\r
- * comparable by assigning a number to it. Used in {@link SelectionProcessor}\r
- * implementations to contribute tabs to tabbed property pages.\r
- * \r
- * @author Tuukka Lehtonen\r
- * @see PropertyTabContributor\r
- */\r
-public class ComparableTabContributor implements PropertyTabContributor, Comparable<ComparableTabContributor> {\r
-\r
-    private final PropertyTabContributor orig;\r
-    private final double                 priority;\r
-    private final Object                 input;\r
-    private final String                 label;\r
-    private final String                 id;\r
-    private final Image                  image;\r
-\r
-    public ComparableTabContributor(PropertyTabContributor orig, double priority, Object input, String label) {\r
-        this(orig, priority, input, label, null);\r
-    }\r
-\r
-    public ComparableTabContributor(PropertyTabContributor orig, double priority, Object input, String label, Image image) {\r
-       this(orig, priority, input, label, label, image);\r
-    }\r
-\r
-    public ComparableTabContributor(PropertyTabContributor orig, double priority, Object input, String label, String id, Image image) {\r
-        if (orig == null)\r
-            throw new NullPointerException("null property tab contributor");\r
-        if (input == null)\r
-            throw new NullPointerException("null input");\r
-        if (label == null)\r
-            throw new NullPointerException("null label");\r
-        this.orig = orig;\r
-        this.priority = priority;\r
-        this.input = input;\r
-        this.label = label;\r
-        this.id = id;\r
-        this.image = image;\r
-    }\r
-\r
-    @Override\r
-    public IPropertyTab create(Composite parent, IWorkbenchSite site, ISessionContext context, Object input) {\r
-        return orig.create(parent, site, context, input);\r
-    }\r
-\r
-    public String getLabel() {\r
-        return label;\r
-    }\r
-\r
-    public Image getImage() {\r
-        return image;\r
-    }\r
-\r
-    public Object getInput() {\r
-        return input;\r
-    }\r
-    \r
-    public String getId() {\r
-       return id;\r
-    }\r
-\r
-    @Override\r
-    public int compareTo(ComparableTabContributor o) {\r
-        double d = o.priority - priority;\r
-        return (d < 0) ? -1 : (d > 0) ? 1 : 0;\r
-    }\r
-\r
-    @Override\r
-    public int hashCode() {\r
-        return orig.hashCode() ^ Double.valueOf(priority).hashCode() ^ input.hashCode() ^ label.hashCode();\r
-    }\r
-\r
-    @Override\r
-    public boolean equals(Object object) {\r
-        if (this == object)\r
-            return true;\r
-        else if (object == null)\r
-            return false;\r
-        else if (!(object instanceof ComparableTabContributor))\r
-            return false;\r
-\r
-        ComparableTabContributor r = (ComparableTabContributor)object;\r
-        return orig.equals(r.orig) && priority == r.priority && input.equals(r.input) && label.equals(r.label);\r
-    }\r
-\r
-    @Override\r
-    public String toString() {\r
-        return orig + "[" + label + "] " + priority + " " + input;\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.selectionview;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchSite;
+import org.simantics.db.management.ISessionContext;
+
+/**
+ * A wrapper for {@link PropertyTabContributor} to label/image it and make it
+ * comparable by assigning a number to it. Used in {@link SelectionProcessor}
+ * implementations to contribute tabs to tabbed property pages.
+ * 
+ * @author Tuukka Lehtonen
+ * @see PropertyTabContributor
+ */
+public class ComparableTabContributor implements PropertyTabContributor, Comparable<ComparableTabContributor> {
+
+    private final PropertyTabContributor orig;
+    private final double                 priority;
+    private final Object                 input;
+    private final String                 label;
+    private final String                 id;
+    private final Image                  image;
+
+    public ComparableTabContributor(PropertyTabContributor orig, double priority, Object input, String label) {
+        this(orig, priority, input, label, null);
+    }
+
+    public ComparableTabContributor(PropertyTabContributor orig, double priority, Object input, String label, Image image) {
+       this(orig, priority, input, label, label, image);
+    }
+
+    public ComparableTabContributor(PropertyTabContributor orig, double priority, Object input, String label, String id, Image image) {
+        if (orig == null)
+            throw new NullPointerException("null property tab contributor");
+        if (input == null)
+            throw new NullPointerException("null input");
+        if (label == null)
+            throw new NullPointerException("null label");
+        this.orig = orig;
+        this.priority = priority;
+        this.input = input;
+        this.label = label;
+        this.id = id;
+        this.image = image;
+    }
+
+    @Override
+    public IPropertyTab create(Composite parent, IWorkbenchSite site, ISessionContext context, Object input) {
+        return orig.create(parent, site, context, input);
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public Image getImage() {
+        return image;
+    }
+
+    public Object getInput() {
+        return input;
+    }
+    
+    public String getId() {
+       return id;
+    }
+
+    @Override
+    public int compareTo(ComparableTabContributor o) {
+        double d = o.priority - priority;
+        return (d < 0) ? -1 : (d > 0) ? 1 : 0;
+    }
+
+    @Override
+    public int hashCode() {
+        return orig.hashCode() ^ Double.valueOf(priority).hashCode() ^ input.hashCode() ^ label.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object object) {
+        if (this == object)
+            return true;
+        else if (object == null)
+            return false;
+        else if (!(object instanceof ComparableTabContributor))
+            return false;
+
+        ComparableTabContributor r = (ComparableTabContributor)object;
+        return orig.equals(r.orig) && priority == r.priority && input.equals(r.input) && label.equals(r.label);
+    }
+
+    @Override
+    public String toString() {
+        return orig + "[" + label + "] " + priority + " " + input;
+    }
+
 }
\ No newline at end of file