@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); }
@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(); }
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$ }