Search in sources :

Example 1 with JavaExtension

use of org.eclipse.sirius.viewpoint.description.JavaExtension in project InformationSystem by ObeoNetwork.

the class ClassDiagramGenerator method addJavaExtensions.

private void addJavaExtensions(Configuration configuration, Viewpoint viewpointFromTemplate) {
    Collection<String> javaExtensions = new LinkedHashSet<String>(configuration.getJavaExtensions());
    for (JavaExtension javaExtensionFromTemplate : viewpointFromTemplate.getOwnedJavaExtensions()) {
        javaExtensions.add(javaExtensionFromTemplate.getQualifiedClassName());
    }
    if (javaExtensions.isEmpty() == false) {
        for (String javaExtension : javaExtensions) {
            if (containsJavaExtension(configuration.getViewpoint().getOwnedJavaExtensions(), javaExtension) == false) {
                JavaExtension extension = DescriptionFactory.eINSTANCE.createJavaExtension();
                extension.setQualifiedClassName(javaExtension);
                AddCommand addCommand = new AddCommand(editingDomain, configuration.getViewpoint(), DescriptionPackage.Literals.VIEWPOINT__OWNED_JAVA_EXTENSIONS, extension);
                editingDomain.getCommandStack().execute(addCommand);
            }
        }
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) JavaExtension(org.eclipse.sirius.viewpoint.description.JavaExtension) AddCommand(org.eclipse.emf.edit.command.AddCommand)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)1 AddCommand (org.eclipse.emf.edit.command.AddCommand)1 JavaExtension (org.eclipse.sirius.viewpoint.description.JavaExtension)1