/******************************************************************************* * <copyright> * * Copyright (c) 2005, 2012 SAP AG. * 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: * SAP AG - initial API, implementation and documentation * * </copyright> * *******************************************************************************/ 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; } }