コード例 #1
0
  @Override
  protected void execute(Component parentComponent) {

    DiscardChangesVetor vetor =
        new DiscardChangesVetor(
            resources,
            new ICondition() {
              @Override
              public boolean isFulfilled() {
                return model.getTemplateEditModel().isDirty();
              }
            },
            parentComponent);
    if (vetor.vetos()) {
      return;
    }

    String salt;
    for (salt = new String();
        model
                .getDatabase()
                .loadTemplate(model.getTemplateEditModel().createTemplate().getName() + salt)
            != null;
        salt += " copy") ;

    model.getTemplateEditModel().copyNewTemplate(salt);
    model.getDatabase().saveTemplate(model.getTemplateEditModel().createTemplate());
    setEnabled(false);
  }
コード例 #2
0
 @Override
 protected void execute(Component parentComponent) {
   DiscardChangesVetor vetor =
       new DiscardChangesVetor(
           resources,
           new ICondition() {
             public boolean isFullfilled() {
               return model.getTemplateEditModel().isDirty();
             }
           },
           parentComponent);
   if (vetor.vetos()) {
     return;
   }
   model.getTemplateEditModel().setNewTemplate();
 }
コード例 #3
0
 public CopyEquipmentTemplateAction(IResources resources, IEquipmentDatabaseManagement model) {
   super(new FileUi(resources).getDuplicateFileIcon());
   this.resources = resources;
   this.model = model;
   model
       .getTemplateEditModel()
       .getDescription()
       .getName()
       .addTextChangedListener(
           new IObjectValueChangedListener<String>() {
             @Override
             public void valueChanged(String newValue) {
               setEnabled(true);
             }
           });
   setEnabled(true);
   setToolTipText(resources.getString("Equipment.Creation.Item.CopyActionTooltip")); // $NON-NLS-1$
 }