/*
 * EditSomeXML is a graphical XML editor
 * 
 * Copyright (C) 2014  David Jackson
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

package editor.controllers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import xml.Element;
import xml.commands.ChangeRepresentationCommand;
import editor.views.RepresentationView;

public class RepresentationController implements ActionListener {
	private RepresentationView view;
	
	public RepresentationController(RepresentationView representationView) {
		view = representationView;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
	    Element elem = view.getElement();
	    ChangeRepresentationCommand cmd;
	    cmd = new ChangeRepresentationCommand(elem,
	            view.getRepresentationType(), view.getAttributeName(),
	            view.setForAll());
	    elem.performCommand(cmd);
	    /* TODO: Delete this
		Element elem;
		boolean setForAll = false;
		
		if (!view.setForAll()) {
			elem = view.getElement();
		} else {
			elem = view.getElement().getRoot();
			setForAll = true;
		}
		
		switch(view.getRepresentationType()) {
		case TAG:
			elem.setRepresentationToTag(setForAll);
			break;
		case ATTRIBUTE_VALUE:
			String attName = view.getAttributeName();
			elem.setRepresentationToAttributeValue(attName, setForAll);
			break;
		default:
			// Do nothing
		}
		*/
		
		view.dispose();
	}
}

@@ -1479,501 +1479,8 @@
 d);%0A
-%09    /* TODO: Delete this%0A%09%09Element elem;%0A%09%09boolean setForAll = false;%0A%09%09%0A%09%09if (!view.setForAll()) %7B%0A%09%09%09elem = view.getElement();%0A%09%09%7D else %7B%0A%09%09%09elem = view.getElement().getRoot();%0A%09%09%09setForAll = true;%0A%09%09%7D%0A%09%09%0A%09%09switch(view.getRepresentationType()) %7B%0A%09%09case TAG:%0A%09%09%09elem.setRepresentationToTag(setForAll);%0A%09%09%09break;%0A%09%09case ATTRIBUTE_VALUE:%0A%09%09%09String attName = view.getAttributeName();%0A%09%09%09elem.setRepresentationToAttributeValue(attName, setForAll);%0A%09%09%09break;%0A%09%09default:%0A%09%09%09// Do nothing%0A%09%09%7D%0A%09%09*/%0A
 %09%09%0A%09

Remove commented-out code