@@ -0,0 +1,2609 @@
+/*%0A * EditSomeXML is a graphical XML editor%0A *%0A * Copyright (C) 2014  David Jackson%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A *%0A * You should have received a copy of the GNU General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A *%0A */%0A%0Apackage xml.commands;%0A%0Aimport utility.Command;%0Aimport xml.Element;%0A%0A/**%0A * The RenameAttributeCommand is used to make the renaming of attributes%0A * undo-able and redo-able%0A */%0Apublic class RenameAttributeCommand implements Command %7B%0A    private final String NAME = %22Rename Attribute%22;%0A%0A    private Element element;%0A    private String attributeName;%0A    private String oldAttributeName;%0A    private int attributeIndex;%0A%0A    public RenameAttributeCommand(Element element, String attributeName,%0A                                  String oldAttributeName, int attributeIndex) %7B%0A        this.element = element;%0A        this.attributeIndex = attributeIndex;%0A        this.attributeName = attributeName;%0A        this.oldAttributeName = oldAttributeName;%0A    %7D%0A%0A    @Override%0A    public void perform() %7B%0A        element.renameAttribute(attributeIndex, attributeName);%0A    %7D%0A%0A    @Override%0A    public void undo() %7B%0A        element.renameAttribute(attributeIndex, oldAttributeName);%0A    %7D%0A%0A    @Override%0A    public String getName() %7B%0A        return NAME;%0A    %7D%0A%0A    public Element getElement() %7B%0A        return element;%0A    %7D%0A%0A    public String getAttributeName() %7B%0A        return attributeName;%0A    %7D%0A%0A    @Override%0A    public boolean canCombine(Command cmd) %7B%0A        if (cmd.getClass() != getClass()) %7B%0A            return false;%0A        %7D%0A        if (((RenameAttributeCommand)cmd).getElement() != element) %7B%0A            return false;%0A        %7D%0A        return true;%0A    %7D%0A%0A    @Override%0A    public Command combine(Command cmd) %7B%0A        RenameAttributeCommand chainCommand;%0A        chainCommand = (RenameAttributeCommand) cmd;%0A%0A        RenameAttributeCommand combinedCommand;%0A        combinedCommand = new RenameAttributeCommand(element,%0A                chainCommand.getAttributeName(), oldAttributeName,%0A                attributeIndex);%0A        return combinedCommand;%0A    %7D%0A%7D%0A

Add a RenameAttributeCommand class