Package org.objectstyle.wolips.bindings.api

Examples of org.objectstyle.wolips.bindings.api.IApiBinding


      _bindingsTableViewer.setInput(_wodElement);
    } else {
      _bindingsTableViewer.setInput(new Object[0]);
    }

    IApiBinding selectedBinding = (IApiBinding) ((IStructuredSelection) _bindingsTableViewer.getSelection()).getFirstElement();
    if (_wodElement != null && selectedBinding != null) {
      String selectedBindingName = selectedBinding.getName();
      Wo api = _bindingsContentProvider.getApi();
      if (api != null) {
        IApiBinding newBinding = api.getBinding(selectedBindingName);
        if (newBinding != null) {
          _bindingsTableViewer.setSelection(new StructuredSelection(newBinding));
        }
      }
    }
View Full Code Here


      }
    }
  }

  protected void removeBinding() {
    IApiBinding binding = (IApiBinding) ((IStructuredSelection) _bindingsTableViewer.getSelection()).getFirstElement();
    if (binding != null) {
      RefactoringWodElement element = getRefactoringElement();
      if (element != null) {
        try {
          element.removeBindingNamed(binding.getName());
          BindingsInspector.this.refresh();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
View Full Code Here

      }
    }
  }

  protected void addKey() {
    IApiBinding binding = (IApiBinding) ((IStructuredSelection) _bindingsTableViewer.getSelection()).getFirstElement();
    if (binding != null && _cache != null) {
      try {
        BindingValueKeyPath bindingValueKeyPath = new BindingValueKeyPath(_wodElement.getBindingValue(binding.getName()), _cache);
        if (bindingValueKeyPath.canAddKey()) {
          String name = WodCompletionUtils.addKeyOrAction(bindingValueKeyPath, binding, _cache.getComponentType());
          getRefactoringElement().setValueForBinding(name, binding.getName());
          BindingsInspector.this.refresh();
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
View Full Code Here

      _addBindingButton.setEnabled(false);
      _removeBindingButton.setEnabled(false);
      _addKeyActionButton.setEnabled(false);
    } else {
      _addBindingButton.setEnabled(true);
      IApiBinding binding = (IApiBinding) ((IStructuredSelection) _bindingsTableViewer.getSelection()).getFirstElement();
      if (binding == null || _cache == null) {
        _removeBindingButton.setEnabled(false);
        _addKeyActionButton.setEnabled(false);
      } else {
        _removeBindingButton.setEnabled(true);
        try {
          BindingValueKeyPath bindingValueKeyPath = new BindingValueKeyPath(_wodElement.getBindingValue(binding.getName()), _cache);
          if (bindingValueKeyPath.canAddKey()) {
            _addKeyActionButton.setEnabled(true);
          } else {
            _addKeyActionButton.setEnabled(false);
          }
View Full Code Here

    }

    @Override
    protected Object getValue(Object element) {
      String value = null;
      IApiBinding binding = (IApiBinding) element;
      if (binding != null) {
        value = binding.getName();
      }
      if (value == null) {
        value = "<none>";
      }
      return value;
View Full Code Here

      return value;
    }

    @Override
    protected void setValue(Object element, Object value) {
      IApiBinding binding = (IApiBinding) element;
      if (binding != null) {
        IWodElement wodElement = getWodElement();
        if (wodElement != null) {
          try {
            RefactoringWodBinding wodBinding = getRefactoringElement().getBindingNamed(binding.getName());
            if (wodBinding != null) {
              wodBinding.setName((String) value);
            }
          } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

    }

    @Override
    protected Object getValue(Object element) {
      String value = null;
      IApiBinding binding = (IApiBinding) element;
      if (binding != null) {
        IWodElement wodElement = getWodElement();
        if (wodElement != null) {
          IWodBinding wodBinding = wodElement.getBindingNamed(binding.getName());
          if (wodBinding != null) {
            value = wodBinding.getValue();
          }
        }
      }
View Full Code Here

      return value;
    }

    @Override
    protected void setValue(Object element, Object value) {
      IApiBinding binding = (IApiBinding) element;
      if (binding != null) {
        IWodElement wodElement = getWodElement();
        if (wodElement != null) {
          try {
            getRefactoringElement().setValueForBinding((String) value, binding.getName());
            BindingsInspector.this.refresh();
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
View Full Code Here

    boolean dropFinished = true;
    try {
      Point controlDropPoint = getEditorControl().toControl(dropPoint);
      TableItem selectedItem = getSelectedItemAtPoint(_inspector, controlDropPoint);
      if (selectedItem != null) {
        IApiBinding binding = getBindingForItem(selectedItem);
        if (binding != null) {
          String droppedKeyPath = column.getSelectedKeyPath();
          RefactoringWodElement element = _inspector.getRefactoringElement();
          if (element != null) {
            try {
              element.setValueForBinding(droppedKeyPath, binding.getName());
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        }
View Full Code Here

  protected boolean isSelectedItemChanged(TableItem oldItem, TableItem newItem) {
    return oldItem == null || newItem == null || !getBindingForItem(oldItem).getName().equals(getBindingForItem(newItem).getName());
  }

  protected IApiBinding getBindingForItem(TableItem item) {
    IApiBinding binding;
    if (item == null) {
      binding = null;
    } else {
      TableViewer tableViewer = _inspector.getBindingsTableViewer();
      Table table = tableViewer.getTable();
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.bindings.api.IApiBinding

Copyright © 2018 www.massapicom. 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.