]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/contributor/labeler/ColumnLabelerContributorImpl.java
Allow column specific tooltips in the GraphExplorer
[simantics/platform.git] / bundles / org.simantics.browsing.ui.graph.impl / src / org / simantics / browsing / ui / graph / impl / contributor / labeler / ColumnLabelerContributorImpl.java
index d1dab0fb97adc521097769b14d88e115f15be79f..47dcf92c255a4b3a5015931e6d6aab7212e0d688 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 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
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *     VTT Technical Research Centre of Finland - initial API and implementation
+ *     Semantum Oy - gitlab #146 - tooltip support
  *******************************************************************************/
 package org.simantics.browsing.ui.graph.impl.contributor.labeler;
 
@@ -55,6 +56,14 @@ abstract public class ColumnLabelerContributorImpl<T> implements Contributor<Lab
         this.clazz = clazz;
     }
 
+    public boolean shouldCreateToolTip(Object event, T input) {
+        return false;
+    }
+
+    public Object createToolTipContentArea(Object event, Object parent, T input) {
+        return null;
+    }
+
     @Override
     public LabelerFactory getFactory() {
 
@@ -100,6 +109,18 @@ abstract public class ColumnLabelerContributorImpl<T> implements Contributor<Lab
                         return ColumnLabelerContributorImpl.this.toString();
                     }
 
+                    @Override
+                    public boolean createToolTip(Object event, NodeContext nodeContext) {
+                        T input = (T)context.getConstant(BuiltinKeys.INPUT);
+                        return ColumnLabelerContributorImpl.this.shouldCreateToolTip(event, input);
+                    }
+
+                    @Override
+                    public Object createToolTipContent(Object event, Object parent, NodeContext nodeContext) {
+                        T input = (T)context.getConstant(BuiltinKeys.INPUT);
+                        return ColumnLabelerContributorImpl.this.createToolTipContentArea(event, parent, input);
+                    }
+
                 };
 
             }