Package org.objectstyle.wolips.bindings.api

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


    "      </and>" +
    "    </validation>" +
    "  </wo>" +
    "</wodefinitions>";
    StringReader sr = new StringReader(api);
    ApiModel model = new ApiModel(sr);
   
    Map<String, String> bindings = new HashMap<String, String>();
    bindings.put("attributeTypeName", "\"value\"");
    List<Validation> failedValidations = model.getWo().getFailedValidations(bindings);
    assertEquals(0, failedValidations.size());

    bindings.clear();
    bindings.put("addressType", "currentAddressType");
    bindings.put("key", "currentKey");
    failedValidations = model.getWo().getFailedValidations(bindings);
    assertEquals(0, failedValidations.size());

    for (Validation validation : failedValidations) {
      System.out.println("ValidationTestCase.testTest: " + validation.getMessage());
    }
View Full Code Here


        for (int i = 0; i < selectedObjects.length; i++) {
          IResource resource = (IResource) selectedObjects[i];
          WodParserCache cache = WodParserCache.parser(resource);
          List<BindingValueKey> bindingKeys = BindingReflectionUtils.getBindingKeys(cache.getJavaProject(), cache.getComponentType(), "", false, BindingReflectionUtils.MUTATORS_ONLY, false, WodParserCache.getTypeCache());
          IFile apiFile = cache.getApiFile();
          ApiModel apiModel = new ApiModel(apiFile);
          Wo wo = apiModel.getWo();
          for (BindingValueKey binding : bindingKeys) {
            if (!BindingReflectionUtils.isSystemBindingValueKey(binding, true)) {
              String bindingName = binding.getBindingName();
              wo.createBinding(bindingName);
            }
          }
          apiModel.saveChanges();
        }
      }
    } catch (Exception e) {
      WodclipsePlugin.getDefault().log(e);
    }
View Full Code Here

    gd.widthHint = 100;

    final ApiEditor apiEditor = (ApiEditor) this.getEditor();
    boolean brokenApiFile = false;
    String brokenMessage = null;
    ApiModel apiModel = null;
    try {
      apiModel = apiEditor.getModel();
    } catch (Throwable throwable) {
      brokenApiFile = true;
      ApieditorPlugin.getDefault().debug(throwable);
      brokenMessage = StringUtils.getErrorMessage(throwable);
    }
    if (apiModel == null) {
      if (brokenApiFile) {
        Label brokenLabel = new Label(client, SWT.WRAP);
        brokenLabel.setBackground(client.getBackground());
        brokenLabel.setText(brokenMessage);
        GridData labelData = new GridData(GridData.FILL_HORIZONTAL);
        labelData.horizontalSpan = 2;
        brokenLabel.setLayoutData(labelData);
      }
      Button createApiFileButton;
      if (brokenApiFile) {
        createApiFileButton = toolkit.createButton(client, "Recreate Api File", SWT.PUSH);
      }
      else {
        createApiFileButton = toolkit.createButton(client, "Create Api File", SWT.PUSH);
      }
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      createApiFileButton.setLayoutData(gd);
      createApiFileButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
          FileEditorInput fileEditorInput = (FileEditorInput) apiEditor.getEditorInput();
          try {
            IFile file = fileEditorInput.getFile();
            if (file.exists()) {
              file.delete(false, null);
            }
            new ApiModel(file);
          } catch (ApiModelException coreException) {
            throw new RuntimeException("Failed to create .api file.", coreException);
          } catch (CoreException coreException) {
            throw new RuntimeException("Failed to delete existing .api file.", coreException);
          }
View Full Code Here

    if (model == null) {
      FileEditorInput editorInput = ((FileEditorInput) this.getEditorInput());
      if (editorInput != null) {
        IFile apiFile = editorInput.getFile();
        if (apiFile != null && apiFile.exists()) {
          model = new ApiModel(((FileEditorInput) this.getEditorInput()).getFile().getLocation().toFile());
        }
      }
    }
    return model;
  }
View Full Code Here

TOP

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

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.