/******************************************************************************* | |
* <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.features.custom; | |
import org.eclipse.graphiti.features.IFeatureProvider; | |
import org.eclipse.graphiti.features.context.IContext; | |
import org.eclipse.graphiti.features.custom.AbstractCustomFeature; | |
/** | |
* This is the super class for all custom features. All features can be grouped | |
* by category. | |
* | |
* @author Benjamin Schmeling | |
* | |
*/ | |
public abstract class FMCCustomFeature extends AbstractCustomFeature { | |
/** | |
* The category name. | |
*/ | |
private final String category; | |
/** | |
* Default constructor. | |
* | |
* @param featureProvider The feature provider. | |
*/ | |
public FMCCustomFeature(IFeatureProvider featureProvider) { | |
super(featureProvider); | |
this.category = null; | |
} | |
/** | |
* Constructor for setting the category. | |
* | |
* @param featureProvider The feature provider. | |
* @param category The category name. | |
*/ | |
public FMCCustomFeature(IFeatureProvider featureProvider, String category) { | |
super(featureProvider); | |
this.category = category; | |
} | |
/* | |
* (non-Javadoc) | |
* | |
* @see | |
* org.eclipse.graphiti.features.custom.AbstractCustomFeature#isAvailable | |
* (org.eclipse.graphiti.features.context.IContext) | |
*/ | |
@Override | |
public boolean isAvailable(IContext context) { | |
return canExecute(context); | |
} | |
/** | |
* Getter for category. | |
* | |
* @return Category name. | |
*/ | |
public String getCategory() { | |
return category; | |
} | |
} |