/**
  * Return the SWT Widget which is wrapped to the object <code>element</code>.
  *
  * @param element
  * @return
  */
 public static Widget getWidget(Object element) {
   if (element instanceof Widget) {
     return (Widget) element;
   } else {
     if (element instanceof CSSStylableElement) {
       CSSStylableElement elt = (CSSStylableElement) element;
       Object widget = elt.getNativeWidget();
       if (widget instanceof Widget) return (Widget) widget;
     }
   }
   return null;
 }
 /**
  * Return the SWT Control which is wrapped to the object <code>element</code>.
  *
  * @param element
  * @return
  */
 public static Control getControl(Object element) {
   if (element instanceof Control) {
     return (Control) element;
   } else {
     if (element instanceof CSSStylableElement) {
       CSSStylableElement elt = (CSSStylableElement) element;
       Object widget = elt.getNativeWidget();
       if (widget instanceof Control) return (Control) widget;
     }
   }
   return null;
 }
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.e4.ui.css.core.dom.properties.providers.
  * AbstractCSSPropertyHandlerProvider
  * #getDefaultCSSStyleDeclaration(org.eclipse
  * .e4.ui.css.core.engine.CSSEngine,
  * org.eclipse.e4.ui.css.core.dom.CSSStylableElement,
  * org.w3c.dom.css.CSSStyleDeclaration)
  */
 protected CSSStyleDeclaration getDefaultCSSStyleDeclaration(
     CSSEngine engine,
     CSSStylableElement stylableElement,
     CSSStyleDeclaration newStyle,
     String pseudoE)
     throws Exception {
   if (stylableElement.getDefaultStyleDeclaration(pseudoE) != null)
     return stylableElement.getDefaultStyleDeclaration(pseudoE);
   if (newStyle != null) {
     StringBuffer style = null;
     int length = newStyle.getLength();
     for (int i = 0; i < length; i++) {
       String propertyName = newStyle.item(i);
       String[] compositePropertiesNames = engine.getCSSCompositePropertiesNames(propertyName);
       if (compositePropertiesNames != null) {
         for (int j = 0; j < compositePropertiesNames.length; j++) {
           propertyName = compositePropertiesNames[j];
           String s = getCSSPropertyStyle(engine, stylableElement, propertyName, pseudoE);
           if (s != null) {
             if (style == null) style = new StringBuffer();
             style.append(s);
           }
         }
       } else {
         String s = getCSSPropertyStyle(engine, stylableElement, propertyName, pseudoE);
         if (s != null) {
           if (style == null) style = new StringBuffer();
           style.append(s);
         }
       }
     }
     if (style != null) {
       CSSStyleDeclaration defaultStyleDeclaration =
           engine.parseStyleDeclaration(style.toString());
       stylableElement.setDefaultStyleDeclaration(pseudoE, defaultStyleDeclaration);
       return defaultStyleDeclaration;
     }
   }
   return stylableElement.getDefaultStyleDeclaration(pseudoE);
 }