Package org.fusesource.ide.sap.ui.properties

Source Code of org.fusesource.ide.sap.ui.properties.BasePropertySection

package org.fusesource.ide.sap.ui.properties;

import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;

@SuppressWarnings("restriction")
public abstract class BasePropertySection extends AbstractPropertySection {

  private DataBindingContext bindingContext;

  protected Composite createFlatFormComposite(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE) {
      // This is overridden to prevent issues with JFace bindings in property sections.
      @Override
      public boolean setFocus() {
        return true;
      }
    };
    composite.setBackground(getWidgetFactory().getColors().getBackground());
    getWidgetFactory().paintBordersFor(composite);
        FormLayout layout = new FormLayout();
        layout.marginWidth = ITabbedPropertyConstants.HSPACE + 2;
        layout.marginHeight = ITabbedPropertyConstants.VSPACE;
        layout.spacing = ITabbedPropertyConstants.VMARGIN + 1;
        composite.setLayout(layout);
        return composite;
  }

  protected DataBindingContext initDataBindings() {
    if (bindingContext != null) {
      bindingContext.dispose();
      bindingContext = null;
    }
   
    return bindingContext = new DataBindingContext();
  }
   
  @Override
  public void refresh() {
    bindingContext.updateTargets();
  }
 
}
TOP

Related Classes of org.fusesource.ide.sap.ui.properties.BasePropertySection

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.