Package org.objectstyle.wolips.bindings.wod

Examples of org.objectstyle.wolips.bindings.wod.BindingValueKeyPath


  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) {
View Full Code Here


        _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);
          }
        } catch (Exception e) {
View Full Code Here

        selectKeyInColumn(null, column);
        column.setSelection(new StructuredSelection());
      } else {
        try {
          if (!ComparisonUtils.equals(selectedKeyPath, getSelectedKeyPath())) {
            BindingValueKeyPath bindingValueKeyPath = new BindingValueKeyPath(selectedKeyPath, _columns.get(0).getType(), WodParserCache.getTypeCache());
            disposeToColumn(0);
            if (bindingValueKeyPath != null && bindingValueKeyPath.isValid()) {
              BindingValueKey[] bindingKeys = bindingValueKeyPath.getBindingKeys();
              if (bindingKeys != null) {
                for (BindingValueKey bindingValueKey : bindingKeys) {
                  WOBrowserColumn column = _columns.get(_columns.size() - 1);
                  column.setSelection(new StructuredSelection(bindingValueKey));
   
View Full Code Here

  public void open() {
    try {
      IType elementType = BindingReflectionUtils.findElementType(_javaProject, _elementTypeName, false, _cache);
      if (elementType != null) {
        BindingValueKeyPath bindingValueKeyPath = new BindingValueKeyPath(_bindingName, elementType, elementType.getJavaProject(), WodParserCache.getTypeCache());
        if (bindingValueKeyPath.isValid()) {
          BindingValueKey lastKey = bindingValueKeyPath.getLastBindingKey();
          if (lastKey != null) {
            IMember member = lastKey.getBindingMember();
            if (member != null) {
              JavaUI.openInEditor(member, true, true);
            }
View Full Code Here

   * @param cache the TypeCache
   * @return a map of supertypes to keys
   * @throws JavaModelException if the type information cannot be loaded
   */
  public static Map<IType, Set<BindingValueKey>> getGroupedBindingValueKeys(String startingWith, IType type, TypeCache cache) throws JavaModelException {
    BindingValueKeyPath bindingValueKeyPath = new BindingValueKeyPath(startingWith, type, type.getJavaProject(), cache);
    List<BindingValueKey> bindingValueKeys = bindingValueKeyPath.getPartialMatchesForLastBindingKey(true);
    List<BindingValueKey> filteredBindingValueKeys = BindingReflectionUtils.filterSystemBindingValueKeys(bindingValueKeys, true);
    Set<BindingValueKey> uniqueBingingValueKeys = new TreeSet<BindingValueKey>(filteredBindingValueKeys);

    Map<IType, Set<BindingValueKey>> typeKeys = new TreeMap<IType, Set<BindingValueKey>>(new TypeDepthComparator(cache));
    for (BindingValueKey key : uniqueBingingValueKeys) {
View Full Code Here

import org.objectstyle.wolips.wodclipse.core.refactoring.AddKeyDialog;
import org.objectstyle.wolips.wodclipse.core.refactoring.AddKeyInfo;

public class WodCompletionUtils {
  public static void openBinding(String bindingValue, IApiBinding binding, IType componentType, boolean onlyIfMissing) throws CoreException {
    BindingValueKeyPath bindingValueKeyPath = new BindingValueKeyPath(bindingValue, componentType, componentType.getJavaProject(), WodParserCache.getTypeCache());
    if (bindingValueKeyPath.isValid()) {
      if (bindingValueKeyPath.exists()) {
        if (!onlyIfMissing) {
          IMember member = bindingValueKeyPath.getLastBindingKey().getBindingMember();
          if (member != null) {
            JavaUI.openInEditor(member, true, true);
          }
        }
      }
      else if (bindingValueKeyPath.canAddKey()) {
        WodCompletionUtils.addKeyOrAction(bindingValueKeyPath, binding, componentType);
      }
    }
  }
View Full Code Here

  }

  public static boolean fillInBindingValueCompletionProposals(IJavaProject project, IType elementType, String token, int tokenOffset, int offset, Set<WodCompletionProposal> completionProposalsSet, TypeCache cache) throws JavaModelException {
    boolean checkBindingType = false;
    String partialToken = partialToken(token, tokenOffset, offset);
    BindingValueKeyPath bindingKeyPath = new BindingValueKeyPath(partialToken, elementType, project, cache);
    List<BindingValueKey> possibleBindingKeyMatchesList = bindingKeyPath.getPartialMatchesForLastBindingKey(false);
    if (possibleBindingKeyMatchesList != null) {
      String bindingKeyName;
      if (bindingKeyPath.getOperator() != null) {
        bindingKeyName = "@" + bindingKeyPath.getOperator();
      }
      else {
        bindingKeyName = bindingKeyPath.getLastBindingKeyName();
      }
      WodCompletionUtils._fillInCompletionProposals(possibleBindingKeyMatchesList, bindingKeyName, tokenOffset + partialToken.lastIndexOf('.') + 1, offset, completionProposalsSet, true);
    }

    // Only do binding type checks if you're on the first of a keypath ...
    if (bindingKeyPath != null && bindingKeyPath.getLength() == 1) {
      checkBindingType = true;
    }
    return checkBindingType;
  }
View Full Code Here

    for (DisplayGroup displayGroup : getDisplayGroups()) {
      try {
        if (type != null) {

          // Validate WODisplayGroup variable is declared.
          BindingValueKeyPath bindingValueKeyPath = new BindingValueKeyPath(displayGroup.getName(), type, type.getJavaProject(), WodParserCache.getTypeCache());
          if (!(bindingValueKeyPath.isValid() && !bindingValueKeyPath.isAmbiguous())) {
            //XXX Walk type hierarchy and check that is a WODisplayGroup
            problems.add(new WodProblem("WODisplayGroup " + displayGroup.getName() + " is configured but not declared in class", null, 0, false));
          }

          if (!displayGroup.isHasMasterDetail()) {
          // Validate editing context
          bindingValueKeyPath = new BindingValueKeyPath(displayGroup.getEditingContext(), type, type.getJavaProject(), WodParserCache.getTypeCache());
          if (!(bindingValueKeyPath.isValid() && !bindingValueKeyPath.isAmbiguous())) {
            problems.add(new WodProblem("Editing context for display group " + displayGroup.getName() + " not found", null, 0, false));
          }
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.bindings.wod.BindingValueKeyPath

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.