Refactor SWT directory structure.
[lgpl/argeo-commons.git] / swt / rcp / org.argeo.swt.specific.rcp / src / org / argeo / eclipse / ui / specific / EclipseUiSpecificUtils.java
diff --git a/swt/rcp/org.argeo.swt.specific.rcp/src/org/argeo/eclipse/ui/specific/EclipseUiSpecificUtils.java b/swt/rcp/org.argeo.swt.specific.rcp/src/org/argeo/eclipse/ui/specific/EclipseUiSpecificUtils.java
new file mode 100644 (file)
index 0000000..d1acbcf
--- /dev/null
@@ -0,0 +1,40 @@
+package org.argeo.eclipse.ui.specific;
+
+import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Widget;
+
+/** Static utilities to bridge differences between RCP and RAP */
+public class EclipseUiSpecificUtils {
+       private final static String CSS_CLASS = "org.eclipse.e4.ui.css.CssClassName";
+
+       public static void setStyleData(Widget widget, Object data) {
+               widget.setData(CSS_CLASS, data);
+       }
+
+       public static Object getStyleData(Widget widget) {
+               return widget.getData(CSS_CLASS);
+       }
+
+       public static void setMarkupData(Widget widget) {
+               // does nothing
+       }
+
+       public static void setMarkupValidationDisabledData(Widget widget) {
+               // does nothing
+       }
+
+       /**
+        * TootlTip support is supported for {@link ColumnViewer} in RCP
+        * 
+        * @see ColumnViewerToolTipSupport#enableFor(Viewer)
+        */
+       public static void enableToolTipSupport(Viewer viewer) {
+               if (viewer instanceof ColumnViewer)
+                       ColumnViewerToolTipSupport.enableFor((ColumnViewer) viewer);
+       }
+
+       private EclipseUiSpecificUtils() {
+       }
+}