blob: ec3a2f46a1579b2a8789adbaabdae2c0f7c19050 [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 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - Initial API and implementation
*******************************************************************************/
package org.eclipse.jst.server.tomcat.core.internal.command;
import org.eclipse.jst.server.tomcat.core.internal.ITomcatConfigurationWorkingCopy;
import org.eclipse.jst.server.tomcat.core.internal.Messages;
import org.eclipse.jst.server.tomcat.core.internal.WebModule;
/**
* Command to remove a web module.
*/
public class RemoveWebModuleCommand extends ConfigurationCommand {
protected int index;
protected WebModule module;
/**
* RemoveWebModuleCommand constructor comment.
*
* @param configuration a tomcat configuration
* @param index an index
*/
public RemoveWebModuleCommand(ITomcatConfigurationWorkingCopy configuration, int index) {
super(configuration, Messages.configurationEditorActionRemoveWebModule);
this.index = index;
}
/**
* Execute the command.
*/
public void execute() {
module = (WebModule) configuration.getWebModules().get(index);
configuration.removeWebModule(index);
}
/**
* Undo the command.
*/
public void undo() {
configuration.addWebModule(index, module);
}
}