Sirius – Provide a resource strategy


The resource strategy registry,, centralizes all behaviors related to resource used in Sirius Session that can be overridden.
The extension point org.eclipse.sirius.resourceStrategy allows to contribute a new behavior for each resource strategy type.
When you contribute a new ResourceStrategy, you need to handle one or more of the by using canHandle methods. For each type, there is one or more methods to override from The methods to override are documented in javadoc of each ResourceStrategyType.

To know all behaviors that can be overridden, you must refer to


Here is an example that ignore “*.genmodel” files as semantic model of Sirius Session.

You have to add your resource strategy contribution in the plugin.xml file.

<extension point="org.eclipse.sirius.resourceStrategy">

The class references a class extending the AbstractResourceStrategyImpl. The corresponding code is:

 * This class overrides AbstractResourceStrategyImpl and also ignores genmodel
 * files.
public class TestResourceStrategyToIgnoreGenModelFile extends AbstractResourceStrategyImpl {

    public boolean isPotentialSemanticResource(URI uri) {
        boolean result = super.isPotentialSemanticResource(uri);
        if (result && uri != null) {
            result = !"genmodel".equals(uri.fileExtension());
        return result;

    public boolean canHandle(URI resourceURI, ResourceStrategyType resourceStrategyType) {
        return ResourceStrategyType.SEMANTIC_RESOURCE.equals(resourceStrategyType);