package edu.oregonstate.cope.eclipse.listeners;

import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IExecutionListener;
import org.eclipse.core.commands.NotHandledException;

public class SaveCommandExecutionListener implements IExecutionListener {

	private static long lastSaveAction = 0;

	/**
	 * Returns the time (in milliseconds since The Epoch) of the last save
	 * action.
	 * 
	 * @return
	 */
	public static long getLastSaveAction() {
		return lastSaveAction;
	}

	@Override
	public void preExecute(String commandId, ExecutionEvent event) {
		if (isFileSave(commandId)) {
			lastSaveAction = System.currentTimeMillis();
		}
	}

	private boolean isFileSave(String commandId) {
		return commandId.equals("org.eclipse.ui.file.save");
	}

	@Override
	public void postExecuteSuccess(String commandId, Object returnValue) {
	}

	@Override
	public void postExecuteFailure(String commandId,
			ExecutionException exception) {
	}

	@Override
	public void notHandled(String commandId, NotHandledException exception) {
	}
}
@@ -816,16 +816,77 @@
 e.save%22)
+ %7C%7C commandId.equalsIgnoreCase(%22org.eclipse.ui.file.saveAll%22)
 ;%0A%09%7D%0A%0A%09@

Save All is also a save action