@Override
 public void refresh() {
   super.refresh();
   if (bindingContext != null) bindingContext.dispose();
   bindingContext = new EMFDataBindingContext();
   bindModel(bindingContext);
 }
 /*
  * (non-Javadoc)
  * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.AbstractModelerPropertySection#dispose()
  */
 @Override
 public void dispose() {
   super.dispose();
   if (context != null) {
     context.dispose();
   }
 }
 @Override
 public void dispose() {
   super.dispose();
   if (context != null) {
     context.dispose();
   }
   if (pageSupport != null) {
     pageSupport.dispose();
   }
 }
  protected void bindSection() {
    if (context != null) {
      context.dispose();
    }
    context = new EMFDataBindingContext();
    if (getEObject() != null && dataTableViewer != null) {
      final IObservableList dataObservableList =
          EMFEditObservables.observeList(getEditingDomain(), getEObject(), getDataFeature());
      dataTableViewer.setInput(dataObservableList);
      final UpdateValueStrategy enableStrategy = new UpdateValueStrategy();
      enableStrategy.setConverter(
          new Converter(Data.class, Boolean.class) {

            @Override
            public Object convert(final Object fromObject) {
              return fromObject != null;
            }
          });

      context.bindValue(
          SWTObservables.observeEnabled(updateDataButton),
          ViewersObservables.observeSingleSelection(dataTableViewer),
          new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
          enableStrategy);
      context.bindValue(
          SWTObservables.observeEnabled(removeDataButton),
          ViewersObservables.observeSingleSelection(dataTableViewer),
          new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
          enableStrategy);

      if (promoteDataButton != null) {
        final UpdateValueStrategy enableMoveStrategy = new UpdateValueStrategy();
        enableMoveStrategy.setConverter(
            new Converter(Data.class, Boolean.class) {

              @Override
              public Object convert(final Object fromObject) {
                return fromObject != null
                    && ModelHelper.getParentProcess(getEObject()) != null
                    && !((Data) fromObject).isTransient();
              }
            });
        context.bindValue(
            SWTObservables.observeEnabled(promoteDataButton),
            ViewersObservables.observeSingleSelection(dataTableViewer),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
            enableMoveStrategy);
      }
    }
  }
  protected void bindFields() {
    if (dataBindingContext != null) {
      dataBindingContext.dispose();
    }
    dataBindingContext = new EMFDataBindingContext();
    if (downloadOnly != null) {
      if (ModelHelper.getForm(element) instanceof ViewForm) {
        downloadOnly.setSelection(true);
        downloadOnly.setEnabled(false);
      } else {
        dataBindingContext.bindValue(
            SWTObservables.observeSelection(downloadOnly),
            EMFEditObservables.observeValue(
                editingDomain, element, FormPackage.Literals.FILE_WIDGET__DOWNLOAD_ONLY));
      }
    }

    dataBindingContext.bindValue(
        SWTObservables.observeSelection(imagePreview),
        EMFEditObservables.observeValue(
            editingDomain, element, FormPackage.Literals.FILE_WIDGET__USE_PREVIEW));

    IObservableValue value =
        EMFObservables.observeValue(element, FormPackage.Literals.DUPLICABLE__DUPLICATE);

    value.addValueChangeListener(
        new IValueChangeListener() {

          public void handleValueChange(ValueChangeEvent arg0) {
            if (useDocumentButton != null
                && !useDocumentButton.isDisposed()
                && element.getInputType() == FileWidgetInputType.DOCUMENT) {
              useDocumentButton.notifyListeners(SWT.Selection, new Event());
              /*}else if(!useResourceButton.isDisposed() && element.getInputType() == FileWidgetInputType.URL){
              useURLButton.notifyListeners(SWT.Selection,new Event());*/
            } else if (!useResourceButton.isDisposed()
                && element.getInputType() == FileWidgetInputType.RESOURCE) {
              useResourceButton.notifyListeners(SWT.Selection, new Event());
            }
            if (inputExpressionViewer != null
                && !getInputExpressionHint()
                    .equals(inputExpressionViewer.getMessage(IStatus.INFO))) {
              inputExpressionViewer.setMessage(getInputExpressionHint(), IStatus.INFO);
            }
          }
        });

    bindInputExpressionViewer();
    bindResourceText();
  }
示例#6
0
  public void dispose() {
    if (image != null) {
      image.dispose();
      image = null;
    }

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

    if (context != null) {
      context.dispose();
      context = null;
    }
  }
  public void setInput(ScaComponent input) {
    this.input = input;
    if (context != null) {
      context.dispose();
      context = null;
    }
    if (input == null) {
      return;
    }
    context = new EMFDataBindingContext();

    setTextBindings(input, "SampleRate", sampleRateText);
    setTextBindings(input, "StreamID", streamIdText);
    setTextBindings(input, "FrontendRF", frontEndRfText);
    setTextBindings(input, "InputFile", inputFileText);
    setTextBindings(input, "SpeedFactor", speedFactorText);
    setTextBindings(input, "ydelta", yDeltaText);
    setTextBindings(input, "subsize", subsizeText);

    setComboBindings(input, "complex", complexCombo);
    setComboBindings(input, "Loop", loopCombo);
  }
  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);
    }
  }
 @Override
 public void dispose() {
   super.dispose();
   context.dispose();
 }
 @Override
 public void dispose() {
   super.dispose();
   if (bindingContext != null) bindingContext.dispose();
   if (toolkit != null) toolkit.dispose();
 }
 /* (non-Javadoc)
  * @see org.bonitasoft.studio.common.properties.IExtensibleGridPropertySectionContribution#dispose()
  */
 public void dispose() {
   if (context != null) {
     context.dispose();
   }
 }
 /*
  * (non-Javadoc)
  *
  * @seeorg.bonitasoft.studio.common.properties.
  * IExtensibleGridPropertySectionContribution#dispose()
  */
 public void dispose() {
   if (dataBindingContext != null) {
     dataBindingContext.dispose();
   }
 }