blob: 2d1a3c45ccd16a476f1efe7caa951f0e7897e034 [file] [log] [blame]
/******************************************************************************
* Copyright (c) 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.gmf.examples.runtime.diagram.logic.internal.edithelpers;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.examples.runtime.diagram.logic.internal.commands.ConfigureLogicElementCommand;
import org.eclipse.gmf.examples.runtime.diagram.logic.model.Gate;
import org.eclipse.gmf.examples.runtime.diagram.logic.model.SemanticPackage;
import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
/**
* Edit helper for logic gate elements.
*
* @author ldamus
* @canBeSeenBy org.eclipse.gmf.examples.runtime.diagram.logic.*
*/
public class GateEditHelper
extends LogicElementEditHelper {
/**
* Gets a command to configure a gate.
*/
protected ICommand getConfigureCommand(final ConfigureRequest req) {
return new ConfigureLogicElementCommand(req, SemanticPackage.eINSTANCE
.getGate()) {
protected CommandResult doExecute(IProgressMonitor progressMonitor) {
Gate oGate = (Gate) req.getElementToConfigure();
createInputTerminal(oGate, "A", progressMonitor); //$NON-NLS-1$
createInputTerminal(oGate, "B", progressMonitor); //$NON-NLS-1$
createOutputTerminal(oGate, "1", progressMonitor); //$NON-NLS-1$
return newOKCommandResult(oGate);
}
};
}
}