// Path: src/main/java/edu/utah/ece/async/sboldesigner/swing/Buttons.java
// public class Buttons {
// 	public static JButton createButton(String text, Icon icon) {
// 		return setStyle(new JButton(text, icon));
// 	}
// 	
// 	public static JButton createButton(Action action) {
// 		return setStyle(new JButton(action));
// 	}
// 	
// 	public static JButton setStyle(JButton button) {
// 		button.addMouseListener(BUTTON_ROLLOVER);
// 		button.setBorderPainted(false);
// 		button.setContentAreaFilled(false);
// 		button.setFocusPainted(false);
// 		return button;
// 	}
// 	
// 	public static JToggleButton createToggleButton(String text, Icon icon) {
// 		final JToggleButton button = new JToggleButton(text, icon);
// 		return button;
// 	}
// 	
// 	public static JToggleButton createToggleButton(Action action) {
// 		final JToggleButton button = new JToggleButton(action);
// 		button.setFocusPainted(false);
// 		return button;
// 	}
// 	
// 
// 	private static final MouseListener BUTTON_ROLLOVER = new MouseAdapter() {
// 		public void mouseEntered(MouseEvent event) {
// 			AbstractButton button = (AbstractButton) event.getSource();
// 			if (button.isEnabled()) {
// 				button.setBorderPainted(true);
// 				button.setContentAreaFilled(true);
// 			}
// 		}
// 
// 		public void mouseExited(MouseEvent event) {
// 			AbstractButton button = (AbstractButton) event.getSource();
// 			button.setBorderPainted(false);
// 			button.setContentAreaFilled(false);
// 		}
// 	};
// 
// }


import java.awt.Image;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import edu.utah.ece.async.sboldesigner.swing.Buttons;

			}
		}
		return null;
	}

	public SBOLEditorAction toggle() {
		isToggle = true;
		return this;
	}

	public SBOLEditorAction precondition(Supplier<Boolean> precondition) {
		this.precondition = precondition;
		return this;
	}

	public SBOLEditorAction allowed(boolean allowed) {
		this.allowed = allowed;
		return this;
	}

	protected abstract void perform();

	public final void actionPerformed(ActionEvent e) {
		if (Boolean.TRUE.equals(precondition.get())) {
			perform();
		}
	}

	protected AbstractButton createButton() {
		Preconditions.checkState(allowed, "This action is not allowed");

// Path: src/main/java/edu/utah/ece/async/sboldesigner/swing/Buttons.java
// public class Buttons {
// 	public static JButton createButton(String text, Icon icon) {
// 		return setStyle(new JButton(text, icon));
// 	}
// 	
// 	public static JButton createButton(Action action) {
// 		return setStyle(new JButton(action));
// 	}
// 	
// 	public static JButton setStyle(JButton button) {
// 		button.addMouseListener(BUTTON_ROLLOVER);
// 		button.setBorderPainted(false);
// 		button.setContentAreaFilled(false);
// 		button.setFocusPainted(false);
// 		return button;
// 	}
// 	
// 	public static JToggleButton createToggleButton(String text, Icon icon) {
// 		final JToggleButton button = new JToggleButton(text, icon);
// 		return button;
// 	}
// 	
// 	public static JToggleButton createToggleButton(Action action) {
// 		final JToggleButton button = new JToggleButton(action);
// 		button.setFocusPainted(false);
// 		return button;
// 	}
// 	
// 
// 	private static final MouseListener BUTTON_ROLLOVER = new MouseAdapter() {
// 		public void mouseEntered(MouseEvent event) {
// 			AbstractButton button = (AbstractButton) event.getSource();
// 			if (button.isEnabled()) {
// 				button.setBorderPainted(true);
// 				button.setContentAreaFilled(true);
// 			}
// 		}
// 
// 		public void mouseExited(MouseEvent event) {
// 			AbstractButton button = (AbstractButton) event.getSource();
// 			button.setBorderPainted(false);
// 			button.setContentAreaFilled(false);
// 		}
// 	};
// 
// }


// Path: src/main/java/edu/utah/ece/async/sboldesigner/sbol/editor/SBOLEditorAction.java
import java.awt.Image;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.ImageIcon;
import javax.swing.JMenuItem;
import com.google.common.base.Preconditions;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import edu.utah.ece.async.sboldesigner.swing.Buttons;

			}
		}
		return null;
	}

	public SBOLEditorAction toggle() {
		isToggle = true;
		return this;
	}

	public SBOLEditorAction precondition(Supplier<Boolean> precondition) {
		this.precondition = precondition;
		return this;
	}

	public SBOLEditorAction allowed(boolean allowed) {
		this.allowed = allowed;
		return this;
	}

	protected abstract void perform();

	public final void actionPerformed(ActionEvent e) {
		if (Boolean.TRUE.equals(precondition.get())) {
			perform();
		}
	}

	protected AbstractButton createButton() {
		Preconditions.checkState(allowed, "This action is not allowed");

		final AbstractButton button = isToggle ? Buttons.createToggleButton(this) : Buttons.createButton(this);
