blob: a62226e2bdf67d7f06a9071a186d073690baec5e [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.wst.server.ui.internal.task;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
import org.eclipse.wst.server.core.TaskModel;
import org.eclipse.wst.server.core.util.Task;
/**
*
*/
public class TempSaveRuntimeTask extends Task {
public TempSaveRuntimeTask() {
// do nothing
}
/* (non-Javadoc)
* @see com.ibm.wtp.server.ui.internal.task.ITask#doTask()
*/
public void execute(IProgressMonitor monitor) throws CoreException {
IRuntime runtime = (IRuntime) getTaskModel().getObject(TaskModel.TASK_RUNTIME);
if (runtime != null && runtime instanceof IRuntimeWorkingCopy) {
IRuntimeWorkingCopy workingCopy = (IRuntimeWorkingCopy) runtime;
if (!workingCopy.isDirty())
return;
runtime = workingCopy.save(false, monitor);
getTaskModel().putObject(TaskModel.TASK_RUNTIME, runtime.createWorkingCopy());
}
}
}