/* $Id: SaveActionListener.java 351 2011-09-15 17:17:46Z shayashi $ */
package smart_gs.swingui.toolbar.action;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.Stack;

import smart_gs.GSConstants;
import smart_gs.logical.Preference;
import smart_gs.swingui.WorkspaceWindow;
import webdav.WebDavChooser;
import webdav.WebDavDownLoadEvent;
import webdav.WebDavListenerAction;
import webdav.WebDavProcessor;
import webdav.WebDavUploadLoadEvent;

public class SaveActionListener implements ActionListener {
	protected int mode = 0;
	
	public SaveActionListener(int mode){
		this.mode = mode;
	}

	public void actionPerformed(ActionEvent e) {		
		if(mode == 1){
			WebDavListenerAction webDavListenerAction = new WebDavListenerAction();
			webDavListenerAction.save();
		}else{
			WorkspaceWindow window = WorkspaceWindow.getInstance();
//			20101107 shayashi introduced the assignment for clarity
			boolean ans = window.saveAll();
			if( ans == false ) return;
			window.unlock();
			window.setLastsave(0);
		}
	}
}
