/******************************************************************************* | |
* <copyright> | |
* | |
* Copyright (c) 2013, 2013 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.fmc.blockdiagram.editor.diagram; | |
import org.eclipse.graphiti.dt.AbstractDiagramTypeProvider; | |
import org.eclipse.graphiti.dt.IDiagramTypeProvider; | |
import org.eclipse.graphiti.tb.IToolBehaviorProvider; | |
/** | |
* This class is a diagram provider for FMC Blockdiagrams. The diagram type of a | |
* Graphiti diagram is specified inside the model file using the diagramTypeId | |
* attribute. The binding from this type id to the diagram type provider is set | |
* via the org.eclipse.graphiti.ui.diagramTypes extension point. | |
* | |
* @author Benjamin Schmeling | |
* | |
*/ | |
public class BlockDiagramTypeProvider extends AbstractDiagramTypeProvider | |
implements IDiagramTypeProvider { | |
private static final String FMC_PROVIDER = "org.eclipse.fmc.provider"; | |
private IToolBehaviorProvider[] toolBehaviorProviders; | |
/** | |
* Constructor setting the feature provider to BlockDiagramFeatureProvider and | |
* setting the providerId. | |
*/ | |
public BlockDiagramTypeProvider() { | |
super(); | |
setFeatureProvider(new BlockDiagramFeatureProvider(this)); | |
this.setProviderId(FMC_PROVIDER); | |
} | |
/* | |
* (non-Javadoc) | |
* @see org.eclipse.graphiti.dt.AbstractDiagramTypeProvider#getAvailableToolBehaviorProviders() | |
*/ | |
@Override | |
public IToolBehaviorProvider[] getAvailableToolBehaviorProviders() { | |
if (toolBehaviorProviders == null) { | |
toolBehaviorProviders = new IToolBehaviorProvider[] { new BlockDiagramToolBehaviorProvider( | |
this) }; | |
} | |
return toolBehaviorProviders.clone(); | |
} | |
} |