Skip to content

Commit

Permalink
Use general extension point + nature and builder refactoring (#133)
Browse files Browse the repository at this point in the history
* re-enable o.e.g.gemoc_language_workbench.xdsml extension point
* use general language extension point instead of sequential
contributes to #132
* replace use of sequential extension point by the general one
* remove org.eclipse.gemoc.execution.sequential.javaxdsml.api
     this plugin is now useless since all its content is covered by the general  org.eclipse.geomc.xdsmlframework.api
* rename getLanguageDefinition into getLanguageDefinitionExtension
* improved plugin.xml manipulation helper (+ documentation)
* move split sequential nature and builder to xdsmlframework.ide.ui
  - split the nature and the builder that was in sequential.javaxdsml.ide.ui
and create a more generic nature and builder in xdsmlframework.ide.ui
  - simplified method for configure/deconfigure/toggle nature : it now uses a single place to do the configuration
  - configure of sequential nature also enforces the general nature
* group configure action related to gemoc language projects
* move some generic popup action to xdsmlframework.ide.ui
  the following popup actions on project is now moved from sequential.javaxdsml.ide.ui to xdsmlframework.ide.ui:
* add the "Generate Multidimensional Trace Addon" on any GEMOC project
  - make sure to add the popup action on the generic nature
* move K3 DSA project creation classes to a dedicated commons plugin
  - These classes from sequential engine can now be reused by other engines such as the moccml engine
  - As this introduce dependency to k3, this plugin is in a dedicated k3 feature and not in the general common
* framework commons is now pomless
* ignore .polyglot.build.properties
* rename wizard GEMOC Sequential xDSML Project to GEMOC Java xDSML Project

Signed-off-by: Didier Vojtisek <didier.vojtisek@inria.fr>
  • Loading branch information
dvojtise authored Nov 22, 2019
1 parent 1c55a60 commit 641a6ac
Show file tree
Hide file tree
Showing 79 changed files with 1,222 additions and 1,179 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ target
build.acceleo
.DS_Store
xtend-gen
.polyglot.build.properties

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public AbstractModelExecutionContext(R runConfiguration, ExecutionMode execution
} catch (CoreException e) {
// TODO throw warning that we couldn't copy the model
}
_languageDefinition = getLanguageDefinition(_runConfiguration.getLanguageName());
_languageDefinition = getLanguageDefinitionExtension(_runConfiguration.getLanguageName());
_dslBundle = DslHelper.getDslBundle(_runConfiguration.getLanguageName());
_executionPlatform = createExecutionPlatform(); // new
// DefaultExecutionPlatform(_languageDefinition,
Expand All @@ -66,7 +66,7 @@ public AbstractModelExecutionContext(R runConfiguration, ExecutionMode execution

protected abstract P createExecutionPlatform() throws CoreException;

protected abstract L getLanguageDefinition(String languageName) throws EngineContextException;
protected abstract L getLanguageDefinitionExtension(String languageName) throws EngineContextException;

@Override
public R getRunConfiguration() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.gemoc.dsl.Dsl;
import org.eclipse.gemoc.xdsmlframework.api.extensions.languages.LanguageDefinitionExtensionPoint;
import org.osgi.framework.Bundle;

/**
* General helper for dsl file
*
*/
public class DslHelper {

/**
* Return a bundle with a .dsl declaring 'languageName'
*/
public static Bundle getDslBundle(String languageName) {
IConfigurationElement[] languages = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.gemoc.gemoc_language_workbench.sequential.xdsml");

IConfigurationElement[] languages = Platform.getExtensionRegistry().getConfigurationElementsFor(LanguageDefinitionExtensionPoint.GEMOC_LANGUAGE_EXTENSION_POINT);
for (IConfigurationElement lang : languages) {
String xdsmlPath = lang.getAttribute("xdsmlFilePath");
String xdsmlName = lang.getAttribute("name");
Expand All @@ -43,22 +44,22 @@ public static Bundle getDslBundle(String languageName) {
}
return null;
}

/**
* Return all declared Languages
*/
public static List<String> getAllLanguages(){
public static List<String> getAllLanguages() {
List<String> languagesNames = new ArrayList<String>();
IConfigurationElement[] languages = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.gemoc.gemoc_language_workbench.sequential.xdsml");
IConfigurationElement[] languages = Platform.getExtensionRegistry().getConfigurationElementsFor(LanguageDefinitionExtensionPoint.GEMOC_LANGUAGE_EXTENSION_POINT);
for (IConfigurationElement lang : languages) {
languagesNames.add(lang.getAttribute("name"));
}
return languagesNames;
}

public static Dsl load(String languageName) {
IConfigurationElement[] languages = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.gemoc.gemoc_language_workbench.sequential.xdsml");

IConfigurationElement[] languages = Platform.getExtensionRegistry().getConfigurationElementsFor(LanguageDefinitionExtensionPoint.GEMOC_LANGUAGE_EXTENSION_POINT);
for (IConfigurationElement lang : languages) {
String xdsmlPath = lang.getAttribute("xdsmlFilePath");
String xdsmlName = lang.getAttribute("name");
Expand All @@ -70,14 +71,14 @@ public static Dsl load(String languageName) {
}
return null;
}

/**
* Return the substring after the last '.' or the whole 'qualifiedName' if
* no dot character.
* Return the substring after the last '.' or the whole 'qualifiedName' if no
* dot character.
*/
public static String lastSegment(String qualifiedName){
if(qualifiedName.contains(".")) {
return qualifiedName.substring(qualifiedName.lastIndexOf(".")+1);
public static String lastSegment(String qualifiedName) {
if (qualifiedName.contains(".")) {
return qualifiedName.substring(qualifiedName.lastIndexOf(".") + 1);
} else {
return qualifiedName;
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

<plugin>

<!-- <extension-point id="org.eclipse.gemoc.gemoc_language_workbench.xdsml" name="Gemoc Language Definition" schema="schema/org.eclipse.gemoc.gemoc_language_workbench.xdsml.exsd"/>
<extension-point id="org.eclipse.gemoc.gemoc_language_workbench.deciders" name="GEMOC Decider" schema="schema/org.eclipse.gemoc.gemoc_language_workbench.decider.exsd"/>
-->
<extension-point id="org.eclipse.gemoc.gemoc_language_workbench.xdsml" name="GEMOC Language Definition" schema="schema/org.eclipse.gemoc.gemoc_language_workbench.xdsml.exsd"/>
<extension-point id="org.eclipse.gemoc.gemoc_language_workbench.engine_addon" name="Engine Addon" schema="schema/org.eclipse.gemoc.gemoc_language_workbench.engine_addon.exsd"/>
<extension-point id="org.eclipse.gemoc.gemoc_language_workbench.engine_addon_group" name="Engine AddonGroup" schema="schema/org.eclipse.gemoc.gemoc_language_workbench.engine_addon_group.exsd"/>

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2017 Inria and others.
* Copyright (c) 2016, 2019 Inria and others.
* 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
Expand All @@ -10,13 +10,15 @@
*******************************************************************************/
package org.eclipse.gemoc.xdsmlframework.api.extensions.languages;

import java.util.Collection;

import org.eclipse.gemoc.xdsmlframework.api.extensions.ExtensionPoint;

public abstract class LanguageDefinitionExtensionPoint extends ExtensionPoint<LanguageDefinitionExtension>
public class LanguageDefinitionExtensionPoint extends ExtensionPoint<LanguageDefinitionExtension>
{


// public static final String GEMOC_LANGUAGE_EXTENSION_POINT = "org.eclipse.gemoc.gemoc_language_workbench.xdsml";
public static final String GEMOC_LANGUAGE_EXTENSION_POINT = "org.eclipse.gemoc.gemoc_language_workbench.xdsml";
public static final String GEMOC_LANGUAGE_EXTENSION_POINT_XDSML_DEF = "XDSML_Definition";
public static final String GEMOC_LANGUAGE_EXTENSION_POINT_XDSML_DEF_NAME_ATT = "name";
public static final String GEMOC_LANGUAGE_EXTENSION_POINT_XDSML_DEF_LOADMODEL_ATT = "modelLoader_class";
Expand All @@ -32,41 +34,41 @@ protected LanguageDefinitionExtensionPoint()
{
super(LanguageDefinitionExtension.class);
}
//
// private static LanguageDefinitionExtensionPoint _singleton;
//
// private static LanguageDefinitionExtensionPoint getExtensionPoint()
// {
// if (_singleton == null)
// {
// _singleton = new LanguageDefinitionExtensionPoint();
// }
// return _singleton;
// }

private static LanguageDefinitionExtensionPoint _singleton;

private static LanguageDefinitionExtensionPoint getExtensionPoint()
{
if (_singleton == null)
{
_singleton = new LanguageDefinitionExtensionPoint();
}
return _singleton;
}

// static public Collection<LanguageDefinitionExtension> getSpecifications()
// {
// return getExtensionPoint().internal_getSpecifications();
// }
//
// static public LanguageDefinitionExtension findDefinition(String languageName)
// {
// for (LanguageDefinitionExtension extension : getSpecifications())
// {
// if (extension.getName().equals(languageName))
// {
// return extension;
// }
// }
// return null;
// }
static public Collection<LanguageDefinitionExtension> getSpecifications()
{
return getExtensionPoint().internal_getSpecifications();
}

static public LanguageDefinitionExtension findDefinition(String languageName)
{
for (LanguageDefinitionExtension extension : getSpecifications())
{
if (extension.getName().equals(languageName))
{
return extension;
}
}
return null;
}



// @Override
// protected String getExtensionPointName()
// {
// return GEMOC_LANGUAGE_EXTENSION_POINT;
// }
@Override
protected String getExtensionPointName()
{
return GEMOC_LANGUAGE_EXTENSION_POINT;
}

}
Loading

0 comments on commit 641a6ac

Please sign in to comment.