예제 #1
0
 protected boolean updateModel(IFile file, ModelType model) {
   if (newId == null) {
     newId = getNewIdProposal(model.getId());
     InputDialog dialog =
         new InputDialog(
             getShell(),
             Diagram_Messages.LB_ACTION_CopyVersion,
             Diagram_Messages.MSG_EnterNewID,
             newId,
             new IInputValidator() {
               public String isValid(String newText) {
                 if (newText == null || newText.length() == 0) {
                   return Diagram_Messages.MSG_NoId;
                 }
                 if (existsId(newText)) {
                   return MessageFormat.format(
                       Diagram_Messages.MSG_ANOTHER_MODEL_HIERARCHY_WITH_ID_ALREADY_EXISTS,
                       new Object[] {newText});
                 }
                 return null;
               }
             });
     if (dialog.open() == 0) {
       newId = dialog.getValue();
     } else {
       return false;
     }
   }
   model.setId(newId);
   basicFileName = newId;
   return true;
 }
예제 #2
0
  private static ModelType doCreate() {
    ModelType model = F_CWM.createModelType();
    model.setOid(0);

    long maxUsedOid = ModelUtils.getMaxUsedOid(model);
    ModelOidUtil.register(model, maxUsedOid, null);

    return model;
  }