/**
   * get a string status indicator for the modelName status label, given the modelName
   *
   * @param modelName the model name to test
   * @return the status of the supplied model name
   */
  private String getModelNameStatus(String sModelName) {
    // Check for null or zero-length
    if (sModelName == null || sModelName.length() == 0) {
      return MODEL_CREATE_ERROR_NO_NAME;
      // Check for valid model name
    }
    String fileNameMessage = ModelUtilities.validateModelName(sModelName, FILE_EXT);
    if (fileNameMessage != null) {
      return MODEL_CREATE_ERROR_INVALID_NAME;
    }
    // Check if already exists
    String sFileName = getFileName(sModelName);
    IPath modelFullPath = null;
    IPath modelRelativePath = null;

    if (newModelParent != null) {
      modelFullPath = newModelParent.getFullPath().append(sFileName);
      modelRelativePath = newModelParent.getProjectRelativePath().append(sFileName);
    }

    if (newModelParent != null && newModelParent.getProject().exists(modelRelativePath)) {
      return MODEL_CREATE_ERROR_ALREADY_EXISTS;
    }

    if (targetFilePath != null && targetFilePath.equals(modelFullPath)) {
      return MODEL_CREATE_ERROR_SAME_NAME_AS;
    }

    // success
    return MODEL_CREATE_ERROR_IS_VALID;
  }
  private boolean isValidModelResource(Object oSelection) {
    boolean bResult = false;
    if (oSelection instanceof IResource) {
      try {

        IResource resource = (IResource) oSelection;

        if (ModelUtilities.isModelFile(resource)) {
          ModelResource mr = ModelUtil.getModelResource((IFile) resource, true);
          if (mr.getModelType() != null) {
            if (mr.getModelType().equals(newModelInfo.getModelType())) {
              if (mr.getPrimaryMetamodelDescriptor() != null) {
                if (mr.getPrimaryMetamodelDescriptor()
                    .getNamespaceURI()
                    .equals(newModelInfo.getModelURI())) {
                  bResult = true;
                }
              }
            }
          }
        }
      } catch (ModelWorkspaceException mwe) {
        ModelerCore.Util.log(IStatus.ERROR, mwe, mwe.getMessage());
      }
    }
    return bResult;
  }
  /**
   * test whether the supplied modelName is valid
   *
   * @param modelName the model name to test
   * @return 'true' if the name is valid, 'false' if not.
   */
  private boolean isValidModelName(String sModelName) {

    // Check for null or zero-length
    if (sModelName == null || sModelName.length() == 0) {
      return false;
    }
    // Check for valid model name
    String fileNameMessage = ModelUtilities.validateModelName(sModelName, FILE_EXT);
    if (fileNameMessage != null) {
      return false;
    }

    // Check if already exists
    String sFileName = getFileName(sModelName);
    IPath modelFullPath = null;
    IPath modelRelativePath = null;
    if (newModelParent != null) {
      modelFullPath = newModelParent.getFullPath().append(sFileName);
      modelRelativePath = newModelParent.getProjectRelativePath().append(sFileName);
    }

    if (newModelParent != null && newModelParent.getProject().exists(modelRelativePath)) {
      return false;
    }

    // Check if it is the same path as the relational model being generated
    if (targetFilePath != null && targetFilePath.equals(modelFullPath)) {
      return false;
    }

    // success
    return true;
  }
Пример #4
0
 public Collection getEPR_queryValue() {
   return ModelUtilities.getOwnSlotValues(this, "EPR_query");
 }
Пример #5
0
 public void setEPR_queryValue(Collection EPR_query) {
   ModelUtilities.setOwnSlotValues(this, "EPR_query", EPR_query);
 }
Пример #6
0
 public String getoperatorValue() {
   return ((String) ModelUtilities.getOwnSlotValue(this, "operator"));
 }
Пример #7
0
 public void setoperatorValue(String operator) {
   ModelUtilities.setOwnSlotValue(this, "operator", operator);
 }
Пример #8
0
 public Instance getsecond_argumentValue() {
   return ((Instance) ModelUtilities.getOwnSlotValue(this, "second_argument"));
 }
Пример #9
0
 public void setsecond_argumentValue(Instance second_argument) {
   ModelUtilities.setOwnSlotValue(this, "second_argument", second_argument);
 }
Пример #10
0
 public void setfirst_argumentValue(Instance first_argument) {
   ModelUtilities.setOwnSlotValue(this, "first_argument", first_argument);
 }
Пример #11
0
 public Instance getcompletion_criteriaValue() {
   return ((Instance) ModelUtilities.getOwnSlotValue(this, "completion_criteria"));
 }
Пример #12
0
 public void setdeferedValue(boolean defered) {
   ModelUtilities.setOwnSlotValue(this, "defered", new Boolean(defered));
 }
Пример #13
0
 public Instance getfirst_stepValue() {
   return ((Instance) ModelUtilities.getOwnSlotValue(this, "first_step"));
 }
Пример #14
0
 public void setfirst_stepValue(Instance first_step) {
   ModelUtilities.setOwnSlotValue(this, "first_step", first_step);
 }
Пример #15
0
 public void setlast_stepValue(Instance last_step) {
   ModelUtilities.setOwnSlotValue(this, "last_step", last_step);
 }
Пример #16
0
 public Collection getstepsValue() {
   return ModelUtilities.getOwnSlotValues(this, "steps");
 }
Пример #17
0
 public void setstepsValue(Collection steps) {
   ModelUtilities.setOwnSlotValues(this, "steps", steps);
 }
Пример #18
0
 public boolean isdeferedValue() {
   if (ModelUtilities.getOwnSlotValue(this, "defered") == null) return false;
   else return ((Boolean) ModelUtilities.getOwnSlotValue(this, "defered")).booleanValue();
 }
Пример #19
0
 public void setcompletion_criteriaValue(Instance completion_criteria) {
   ModelUtilities.setOwnSlotValue(this, "completion_criteria", completion_criteria);
 }