private Expression createExpression(final Data d) {
   final Expression exp = ExpressionFactory.eINSTANCE.createExpression();
   exp.setType(ExpressionConstants.VARIABLE_TYPE);
   exp.setContent(d.getName());
   exp.setName(d.getName());
   exp.setReturnType(org.bonitasoft.studio.common.DataUtil.getTechnicalTypeFor(d));
   exp.getReferencedElements().add(ExpressionHelper.createDependencyFromEObject(d));
   return exp;
 }
 protected void switchEditorType() {
   if (!control.isVisible()) {
     switchToExpressionMode();
     bindExpression();
   } else {
     if (MessageDialog.openQuestion(
         mc.getShell(), Messages.eraseExpressionTitle, Messages.eraseExpressionMsg)) {
       switchToCheckBoxMode();
       // Reset checkbox to false
       final Expression falseExp = ExpressionFactory.eINSTANCE.createExpression();
       falseExp.setName(Boolean.FALSE.toString());
       falseExp.setContent(Boolean.FALSE.toString());
       falseExp.setReturnType(Boolean.class.getName());
       falseExp.setType(ExpressionConstants.CONSTANT_TYPE);
       updateSelection(null, falseExp);
       bindExpression();
     }
   }
   mc.layout(true, true);
 }
  protected void showContent(String type) {
    IExpressionProvider provider =
        ExpressionEditorService.getInstance().getExpressionProvider(type);

    Assert.isNotNull(provider);

    for (Control c : contentComposite.getChildren()) {
      c.dispose();
    }

    if (currentExpressionEditor != null) {
      currentExpressionEditor.dispose();
    }

    currentExpressionEditor = provider.getExpressionEditor(inputExpression, context);
    currentExpressionEditor.setIsPageFlowContext(isPageFlowContext);
    if (currentExpressionEditor != null) {
      currentExpressionEditor.createExpressionEditor(contentComposite, isPassword);
      contentComposite.layout(true, true);
      if (helpControl != null) {
        //				helpControl.setVisible(currentExpressionEditor.provideDialogTray());
        helpControl.setVisible(false);
        if (currentExpressionEditor.provideDialogTray()) {
          ToolItem item = ((ToolBar) helpControl).getItem(0);
          item.setSelection(true);
          openTrayListener.handleEvent(new Event());
        } else if (getTray() != null) {
          closeTray();
        }
      }
      if (dataBindingContext != null) {
        dataBindingContext.dispose();
      }
      dataBindingContext = new EMFDataBindingContext();

      UpdateValueStrategy selectionToExpressionType = new UpdateValueStrategy();
      IConverter convert =
          new Converter(IExpressionProvider.class, String.class) {

            @Override
            public Object convert(Object arg0) {
              return ((IExpressionProvider) arg0).getExpressionType();
            }
          };
      selectionToExpressionType.setConverter(convert);

      if (domain != null) {
        domain
            .getCommandStack()
            .execute(
                SetCommand.create(
                    domain, inputExpression, ExpressionPackage.Literals.EXPRESSION__TYPE, type));
      } else {
        inputExpression.setType(type);
      }
      currentExpressionEditor.bindExpression(
          dataBindingContext, context, inputExpression, viewerTypeFilters, expressionViewer);
      currentExpressionEditor.addListener(
          new Listener() {
            @Override
            public void handleEvent(Event event) {
              Button okButton = getButton(OK);
              if (okButton != null && !okButton.isDisposed()) {
                okButton.setEnabled(currentExpressionEditor.canFinish());
              }
            }
          });
      DialogSupport.create(this, dataBindingContext);
    }
  }