/**
   * @see
   *     org.eclipse.emf.ecoretools.tabbedproperties.sections.AbstractTabbedPropertySection#createWidgets(org.eclipse.swt.widgets.Composite)
   */
  protected void createWidgets(Composite composite) {
    labelText = getWidgetFactory().createCLabel(composite, getLabelText());

    fileChooser = new FileChooser(composite, getWidgetFactory(), SWT.NONE);
    fileChooser.setEditable(true);

    if (getFeature() != null) {
      fileChooser.setChangeable(getFeature().isChangeable());
    }
  }
 /**
  * Handler called to verify the file path on user text modification. By default it checks the file
  * existence is the property checkFileExistence is set to true
  *
  * @return true is the file matches
  */
 protected List<IStatus> verifyFile() {
   List<IStatus> statusList = new ArrayList<IStatus>();
   if (isCheckFileExistence()) {
     String selection = fileChooser.getSelection();
     if (selection != null && !"".equals(selection)) { // $NON-NLS-1$
       File file = new File(selection);
       if (!file.exists()) {
         statusList.add(
             new Status(
                 IStatus.ERROR,
                 TabbedPropertiesPlugin.PLUGIN_ID,
                 getLabelText() + Messages.AbstractFileChooserPropertySection_NotExist));
       }
       if (!file.isFile()) {
         statusList.add(
             new Status(
                 IStatus.ERROR,
                 TabbedPropertiesPlugin.PLUGIN_ID,
                 getLabelText() + Messages.AbstractFileChooserPropertySection_NotADirectory));
       }
     } else if (cannotBeBlank()) {
       statusList.add(
           new Status(
               IStatus.ERROR,
               TabbedPropertiesPlugin.PLUGIN_ID,
               getLabelText() + Messages.AbstractFileChooserPropertySection_NotBlank));
     }
   }
   List<IStatus> emptyList = Collections.emptyList();
   return statusList.isEmpty() ? emptyList : statusList;
 }
 /** Handle the combo modified event. */
 protected void handleTextModified() {
   if (!isRefreshing && getFeatureValue() != fileChooser.getSelection()) {
     List<IStatus> status = verifyFile();
     fileChooser.setStatus(status);
     if (status.isEmpty()) {
       EditingDomain editingDomain = getEditingDomain();
       if (getEObjectList().size() == 1) {
         /* apply the property change to single selected object */
         editingDomain
             .getCommandStack()
             .execute(
                 SetCommand.create(
                     editingDomain, getEObject(), getFeature(), fileChooser.getSelection()));
       }
     }
   }
 }
  /** Adds the listeners on the widgets */
  protected void hookListeners() {
    fileChooser.addModifyListener(
        new ModifyListener() {

          public void modifyText(ModifyEvent e) {
            handleTextModified();
          }
        });
  }
  /**
   * @see
   *     org.eclipse.emf.ecoretools.tabbedproperties.sections.AbstractTabbedPropertySection#setSectionData(org.eclipse.swt.widgets.Composite)
   */
  protected void setSectionData(Composite composite) {
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(fileChooser, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    labelText.setLayoutData(data);

    data = new FormData();
    data.left =
        new FormAttachment(0, getStandardLabelWidth(composite, new String[] {getLabelText()}));
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(labelText, 0, SWT.CENTER);
    fileChooser.setLayoutData(data);
  }
 /** @see org.eclipse.ui.views.properties.tabbed.ISection#refresh() */
 public void refresh() {
   isRefreshing = true;
   fileChooser.setChangeable(!isReadOnly());
   fileChooser.setSelection(getFeatureValue());
   isRefreshing = false;
 }