blob: 1da1a79e5d0158ae7e3f0a3f052f975cde069ec5 [file] [log] [blame]
/*********************************************************************
* Copyright (c) 2005, 2019 SAP SE
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* SAP SE - initial API, implementation and documentation
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
package org.eclipse.graphiti.ui.internal.policy;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.LayoutEditPolicy;
import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.graphiti.ui.platform.IConfigurationProvider;
/**
* An EditPolicy, which 'forbids' any Layout dependent Commands. All methods of
* this EditPolicy return null, which is different from using no EditPolicy at
* all, because it will create a visible feedback that the requests are
* forbidden. This EditPolicy can for example be used for those EditParts, which
* do not have any children.
*
* @see org.eclipse.graphiti.ui.internal.policy.IEditPolicyFactory#createShapeForbidLayoutEditPolicy()
* @noinstantiate This class is not intended to be instantiated by clients.
* @noextend This class is not intended to be subclassed by clients.
*/
public class ShapeForbidLayoutEditPolicy extends LayoutEditPolicy {
private IConfigurationProvider _configurationProvider;
/**
* Creates a new ShapeForbidLayoutEditPolicy.
*
* @param configurationProvider
* The IConfigurationProviderInternal.
*/
protected ShapeForbidLayoutEditPolicy(IConfigurationProvider configurationProvider) {
_configurationProvider = configurationProvider;
}
protected final IConfigurationProvider getConfigurationProvider() {
return _configurationProvider;
}
/**
* Returns null.
*
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#createChildEditPolicy(org.eclipse.gef.EditPart)
*/
@Override
protected EditPolicy createChildEditPolicy(EditPart child) {
return null;
}
/**
* Returns null.
*
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getCreateCommand(org.eclipse.gef.requests.CreateRequest)
*/
@Override
protected Command getCreateCommand(CreateRequest request) {
return null;
}
/**
* Returns null.
*
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getMoveChildrenCommand(org.eclipse.gef.Request)
*/
@Override
protected Command getMoveChildrenCommand(Request request) {
return null;
}
/**
* Returns null.
*
* @see org.eclipse.gef.editpolicies.LayoutEditPolicy#getDeleteDependantCommand(org.eclipse.gef.Request)
*/
@Override
protected Command getDeleteDependantCommand(Request request) {
return null;
}
}