| package org.eclipse.epp.installer.core.operations; |
| |
| import java.util.List; |
| |
| import org.eclipse.epp.installer.core.model.SequentialOperation; |
| import org.eclipse.epp.installer.internal.core.InstallLog; |
| import org.eclipse.epp.installer.internal.core.InstallLogEntry; |
| import org.eclipse.epp.installer.internal.core.operations.RollbackOperation; |
| |
| |
| /** |
| * UndoInstallOperation used then you need to undo partly complited |
| * installation. |
| * |
| * Used from |
| * {@link com.instantiations.installer.internal.ui.steps.RunOperationsStepWizard } |
| * to undo installation then error are happend. |
| */ |
| public class UndoInstallOperation extends SequentialOperation { |
| |
| /** |
| * Installation log. |
| */ |
| private InstallLog log; |
| |
| /** |
| * Construct new instanceof UndoInstallOperation with current install log. |
| * |
| * @param log |
| * InstallLog to undo form. |
| */ |
| public UndoInstallOperation(InstallLog log) { |
| if (log == null) { |
| throw new IllegalArgumentException(); |
| } |
| this.log = log; |
| } |
| |
| /** |
| * Prepare undo. |
| */ |
| protected void prepare() { |
| List entries = log.getEntries(); |
| int i = entries.size(); |
| while (--i >= 0) { |
| add(new RollbackOperation((InstallLogEntry) entries.get(i))); |
| } |
| } |
| |
| /** |
| * Method toString. |
| * |
| * @return String |
| */ |
| public String toString() { |
| return "Undoing installation..."; |
| } |
| } |