コード例 #1
0
 @Override
 public void onContextRenameParameter(
     IContextManager contextManager, String oldName, String newName) {
   if (contextManager instanceof JobContextManager) {
     JobContextManager manager = (JobContextManager) contextManager;
     manager.addNewName(newName, oldName);
     // record the modified operation.
     setModifiedFlag(contextManager);
   }
   getCommandStack().execute(new ContextRenameParameterCommand(contextManager, oldName, newName));
   // update variable reference for current job, for 2608
   switchSettingsView(oldName, newName);
 }
  private void setPropertyValue(
      IContextModelManager manager,
      Object dataElement,
      String contextParaName,
      int columnIndex,
      Object newValue) {
    String currentColumnName = getColumnProperty(columnIndex);
    if (this.groupModel.isPartOfAGroup(columnIndex)) {
      String columnGroupName = this.groupModel.getColumnGroupByIndex(columnIndex).getName();
      IContextManager contextManger = manager.getContextManager();
      if (contextManger != null) {
        // change the property of context such as prompt,promptyNeeded,value etc.
        List<Object> list = new ArrayList<Object>();
        list.add(dataElement);

        IContextParameter para = null;
        para = getRealParameter(contextManger, columnGroupName, dataElement);
        if (para == null) {
          return;
        }
        Command cmd =
            new SetContextGroupParameterCommand(manager, para, currentColumnName, newValue);
        runCommand(cmd, manager);
        if (currentColumnName.equals(ContextTableConstants.COLUMN_CHECK_PROPERTY)) {
          manager.refresh();
        }
      }
    } else {
      if (currentColumnName.equals(ContextTableConstants.COLUMN_TYPE_PROPERTY)) {
        ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
        IContextParameter contextPara = parent.getContextParameter();
        if (contextPara.getType() == ((String) newValue)) {
          return;
        }
        String newType = getRealType((String) newValue);
        contextPara.setType(newType);

        Command cmd = new SetContextTypeCommand(manager, contextPara, newType);
        runCommand(cmd, manager);
      } else if (currentColumnName.equals(ContextTableConstants.COLUMN_NAME_PROPERTY)) {
        ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
        IContextParameter contextPara = parent.getContextParameter();
        String sourceId = contextPara.getSource();
        String newParaName = (String) newValue;

        if (manager.getContextManager() instanceof JobContextManager) {
          // in case joblet rename will propagate to the job,just record it
          JobContextManager contextManager = (JobContextManager) manager.getContextManager();
          contextManager.addNewName(newParaName, contextPara.getName());
          contextManager.setModified(true);
        }
        Command cmd = new SetContextNameCommand(manager, contextPara, newParaName, sourceId);
        runCommand(cmd, manager);
      } else if (currentColumnName.equals(ContextTableConstants.COLUMN_COMMENT_PROPERTY)) {
        ContextTableTabParentModel parent = (ContextTableTabParentModel) dataElement;
        IContextParameter contextPara = parent.getContextParameter();
        if (contextPara.getComment() == ((String) newValue)) {
          return;
        }
        Command cmd = new setContextCommentCommand(manager, contextPara, (String) newValue);
        runCommand(cmd, manager);
      }
    }
  }