package org.flashtool.gui.tools;


import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Shell;
import org.flashtool.gui.TARestore;
import org.flashtool.util.XperiFirm;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class XperiFirmJob extends Job {

	Shell _parent;
	
	public XperiFirmJob(String name) {
		super(name);
	}
	
	public void setShell(Shell s) {
		_parent = s;
	}
		
    protected IStatus run(IProgressMonitor monitor) {
    	try {
    		XperiFirm.run(_parent);
			return Status.OK_STATUS;
    	}
    	catch (Exception e) {
    		e.printStackTrace();
    		return Status.CANCEL_STATUS;
    	}
    }
}
