diff --git a/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/META-INF/MANIFEST.MF b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/META-INF/MANIFEST.MF index 8288429d7..5937b0cf3 100644 --- a/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/META-INF/MANIFEST.MF +++ b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/META-INF/MANIFEST.MF @@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.gemoc.xdsmlframework.api, org.eclipse.gemoc.executionframework.ui, org.eclipse.sirius.ui, org.eclipse.ui.workbench, - org.eclipse.ui.ide;bundle-version="3.14.0" + org.eclipse.ui.ide;bundle-version="3.14.0", + org.eclipse.core.expressions Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-17 Export-Package: org.eclipse.gemoc.executionframework.engine.ui, diff --git a/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/plugin.xml b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/plugin.xml index 9704ea021..ac9f457c8 100644 --- a/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/plugin.xml +++ b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/plugin.xml @@ -1,99 +1,116 @@ - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - diff --git a/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/src/org/eclipse/gemoc/executionframework/engine/ui/concurrency/ModelingWorkbenchEarlyStartup.java b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/src/org/eclipse/gemoc/executionframework/engine/ui/ModelingWorkbenchEarlyStartup.java similarity index 92% rename from framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/src/org/eclipse/gemoc/executionframework/engine/ui/concurrency/ModelingWorkbenchEarlyStartup.java rename to framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/src/org/eclipse/gemoc/executionframework/engine/ui/ModelingWorkbenchEarlyStartup.java index 12a1ea524..4de35d206 100644 --- a/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/src/org/eclipse/gemoc/executionframework/engine/ui/concurrency/ModelingWorkbenchEarlyStartup.java +++ b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/src/org/eclipse/gemoc/executionframework/engine/ui/ModelingWorkbenchEarlyStartup.java @@ -9,7 +9,7 @@ * INRIA - initial API and implementation * I3S Laboratory - API update and bug fix *******************************************************************************/ -package org.eclipse.gemoc.executionframework.engine.ui.concurrency; +package org.eclipse.gemoc.executionframework.engine.ui; import org.eclipse.ui.IStartup; diff --git a/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/src/org/eclipse/gemoc/executionframework/engine/ui/propertytesters/GemocXDSMLPropertyTester.java b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/src/org/eclipse/gemoc/executionframework/engine/ui/propertytesters/GemocXDSMLPropertyTester.java new file mode 100644 index 000000000..fd47ca1a4 --- /dev/null +++ b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/src/org/eclipse/gemoc/executionframework/engine/ui/propertytesters/GemocXDSMLPropertyTester.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2017, 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * INRIA - initial API and implementation + * I3S Laboratory - API update and bug fix + *******************************************************************************/ + +package org.eclipse.gemoc.executionframework.engine.ui.propertytesters; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.gemoc.xdsmlframework.api.extensions.languages.LanguageDefinitionExtension; +import org.eclipse.gemoc.xdsmlframework.api.extensions.languages.LanguageDefinitionExtensionPoint; + +/** + * Property tester for context launching menu. + * + * Note: this PropertyTester seems to be fully activated only when the containing plugin is started, + * this start may be achieved either by another plguin or using the EarlyStart + */ +public class GemocXDSMLPropertyTester extends PropertyTester { + + /** + * name for the "is model" property + */ + private static final String PROPERTY_IS_MODEL = "isModel"; //$NON-NLS-1$ + + /** + * name for the "is executable domain specific model" property + */ + private static final String PROPERTY_IS_EXECUTABLE_DOMAIN_SPECIFIC_MODEL = "isExecutableDomainSpecificModel"; //$NON-NLS-1$ + + + protected boolean isModel(IAdaptable receiver){ + IFile modelFile = (IFile)(receiver).getAdapter(IFile.class); + if(modelFile !=null){ + ResourceSet rs = new ResourceSetImpl(); + URI modelURI = URI.createURI("platform:/resource/"+modelFile.getFullPath().toString()); + try{ + Resource resource = rs.getResource(modelURI, true); + if (resource != null) { + return true; + } + } catch (Exception e){ + // not a valid model, simply ignore + return false; + } + } + return false; + } + + protected boolean isExecutableDomainSpecificModel(IAdaptable receiver){ + IFile modelFile = (IFile)(receiver).getAdapter(IFile.class); + if(modelFile !=null){ + + return existsDSMLWithFileExtension(modelFile.getFileExtension()); + } + return false; + } + + + protected boolean existsDSMLWithFileExtension(String fileExtension){ + for(LanguageDefinitionExtension lde : LanguageDefinitionExtensionPoint.getSpecifications()){ + if( lde.getFileExtensions().contains(fileExtension)) return true; + } + + return false; + } + + /** + * Method runs the tests defined from extension points for Run As... and Debug As... menu items. + * + * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) + * @since 3.2 + * @return true if the specified tests pass, false otherwise + */ + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + + if(PROPERTY_IS_MODEL.equals(property)) { + if (receiver instanceof IAdaptable) { + return isModel((IAdaptable)receiver); + } + return false; + } + if(PROPERTY_IS_EXECUTABLE_DOMAIN_SPECIFIC_MODEL.equals(property)) { + if (receiver instanceof IAdaptable) { + return isExecutableDomainSpecificModel((IAdaptable)receiver); + } + return false; + } + return false; + } + +} diff --git a/framework/framework_commons/pomfirst/org.eclipse.gemoc.xdsmlframework.api/.classpath b/framework/framework_commons/pomfirst/org.eclipse.gemoc.xdsmlframework.api/.classpath index 7e3b0706c..adb49300d 100644 --- a/framework/framework_commons/pomfirst/org.eclipse.gemoc.xdsmlframework.api/.classpath +++ b/framework/framework_commons/pomfirst/org.eclipse.gemoc.xdsmlframework.api/.classpath @@ -25,7 +25,7 @@ - + @@ -35,5 +35,18 @@ + + + + + + + + + + + + + diff --git a/framework/framework_commons/pomfirst/org.eclipse.gemoc.xdsmlframework.api/.settings/org.eclipse.jdt.core.prefs b/framework/framework_commons/pomfirst/org.eclipse.gemoc.xdsmlframework.api/.settings/org.eclipse.jdt.core.prefs index 2f5cc74c3..cf2cd4590 100644 --- a/framework/framework_commons/pomfirst/org.eclipse.gemoc.xdsmlframework.api/.settings/org.eclipse.jdt.core.prefs +++ b/framework/framework_commons/pomfirst/org.eclipse.gemoc.xdsmlframework.api/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=17 diff --git a/protocols/engine_addon_protocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.classpath b/protocols/engine_addon_protocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.classpath index a7bf06493..dee8d0935 100644 --- a/protocols/engine_addon_protocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.classpath +++ b/protocols/engine_addon_protocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.classpath @@ -1,6 +1,6 @@ - + diff --git a/protocols/engine_addon_protocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.settings/org.eclipse.jdt.core.prefs b/protocols/engine_addon_protocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.settings/org.eclipse.jdt.core.prefs index 2f5cc74c3..cf2cd4590 100644 --- a/protocols/engine_addon_protocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.settings/org.eclipse.jdt.core.prefs +++ b/protocols/engine_addon_protocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.compliance=17 org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=17 diff --git a/trace/commons/plugins/org.eclipse.gemoc.trace.commons.model.editor/.classpath b/trace/commons/plugins/org.eclipse.gemoc.trace.commons.model.editor/.classpath index 1d829a7af..eca7bdba8 100644 --- a/trace/commons/plugins/org.eclipse.gemoc.trace.commons.model.editor/.classpath +++ b/trace/commons/plugins/org.eclipse.gemoc.trace.commons.model.editor/.classpath @@ -1,7 +1,7 @@ - - + + diff --git a/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons.model/.classpath b/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons.model/.classpath index 88f45ede8..d125ecdde 100644 --- a/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons.model/.classpath +++ b/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons.model/.classpath @@ -1,6 +1,6 @@ - + diff --git a/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons.model/.settings/org.eclipse.jdt.core.prefs b/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons.model/.settings/org.eclipse.jdt.core.prefs index 2f5cc74c3..2af1e7b99 100644 --- a/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons.model/.settings/org.eclipse.jdt.core.prefs +++ b/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons.model/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=11 diff --git a/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons/.classpath b/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons/.classpath index 2703514db..7fd0be2b0 100644 --- a/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons/.classpath +++ b/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons/.classpath @@ -1,6 +1,6 @@ - + diff --git a/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons/.settings/org.eclipse.jdt.core.prefs b/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons/.settings/org.eclipse.jdt.core.prefs index 2f5cc74c3..2af1e7b99 100644 --- a/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons/.settings/org.eclipse.jdt.core.prefs +++ b/trace/commons/pomfirst/org.eclipse.gemoc.trace.commons/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.release=disabled -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.source=11