-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
centralize property tester and earlystartup in modeldebugging (#238)
contributes to #237
- Loading branch information
Showing
13 changed files
with
248 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
203 changes: 110 additions & 93 deletions
203
...ork/execution_framework/plugins/org.eclipse.gemoc.executionframework.engine.ui/plugin.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,116 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.4"?> | ||
<plugin> | ||
<extension | ||
point="org.eclipse.debug.ui.debugModelPresentations"> | ||
<debugModelPresentation | ||
class="org.eclipse.gemoc.executionframework.engine.ui.genericdebugmodel.GemocGenericDebugModelPresentation" | ||
id="org.eclipse.gemoc.executionframework.engine.ui.generic.debugModel"> | ||
</debugModelPresentation> | ||
</extension> | ||
<extension | ||
point="org.eclipse.debug.core.sourceLocators"> | ||
<sourceLocator | ||
class="org.eclipse.gemoc.executionframework.engine.ui.genericdebugmodel.GemocGenericSourceLocator" | ||
id="org.eclipse.gemoc.executionframework.engine.ui.generic.sourceLocator" | ||
name="GEMOC Generic Source Locator"> | ||
</sourceLocator> | ||
</extension> | ||
|
||
|
||
<extension | ||
point="org.eclipse.gemoc.gemoc_language_workbench.deciders"> | ||
<DeciderSpecification | ||
Class="org.eclipse.gemoc.executionframework.engine.ui.concurrency.deciders.StepByStepUserDecider" | ||
Icon="icons/user-shield-green-16.png" | ||
Name="Step by step user decider"> | ||
</DeciderSpecification> | ||
<DeciderSpecification | ||
Class="org.eclipse.gemoc.executionframework.engine.ui.concurrency.deciders.UserDecider" | ||
Icon="icons/user-shield-black-16.png" | ||
Name="User decider"> | ||
</DeciderSpecification> | ||
<extension | ||
point="org.eclipse.debug.ui.debugModelPresentations"> | ||
<debugModelPresentation | ||
class="org.eclipse.gemoc.executionframework.engine.ui.genericdebugmodel.GemocGenericDebugModelPresentation" | ||
id="org.eclipse.gemoc.executionframework.engine.ui.generic.debugModel"> | ||
</debugModelPresentation> | ||
</extension> | ||
|
||
<extension | ||
point="org.eclipse.ui.views"> | ||
<category | ||
id="org.eclipse.gemoc.executionframework.ui.category" | ||
name="Gemoc"> | ||
</category> | ||
|
||
<view | ||
category="org.eclipse.gemoc.executionframework.ui.category" | ||
class="org.eclipse.gemoc.executionframework.engine.ui.concurrency.views.step.LogicalStepsView" | ||
icon="icons/IconeGemocModel-16.png" | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView" | ||
name="Concurrent Logical Steps Decider"> | ||
</view> | ||
|
||
<view | ||
category="org.eclipse.gemoc.executionframework.ui.category" | ||
class="org.eclipse.gemoc.executionframework.engine.ui.concurrency.strategyselector.StrategySelectionView" | ||
icon="icons/IconeGemocModel-16.png" | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.StrategySelectionView" | ||
name="Strategy Selection"> | ||
</view> | ||
|
||
|
||
<extension | ||
point="org.eclipse.debug.core.sourceLocators"> | ||
<sourceLocator | ||
class="org.eclipse.gemoc.executionframework.engine.ui.genericdebugmodel.GemocGenericSourceLocator" | ||
id="org.eclipse.gemoc.executionframework.engine.ui.generic.sourceLocator" | ||
name="GEMOC Generic Source Locator"> | ||
</sourceLocator> | ||
</extension> | ||
|
||
|
||
<extension | ||
point="org.eclipse.gemoc.gemoc_language_workbench.deciders"> | ||
<DeciderSpecification | ||
Class="org.eclipse.gemoc.executionframework.engine.ui.concurrency.deciders.StepByStepUserDecider" | ||
Icon="icons/user-shield-green-16.png" | ||
Name="Step by step user decider"> | ||
</DeciderSpecification> | ||
<DeciderSpecification | ||
Class="org.eclipse.gemoc.executionframework.engine.ui.concurrency.deciders.UserDecider" | ||
Icon="icons/user-shield-black-16.png" | ||
Name="User decider"> | ||
</DeciderSpecification> | ||
</extension> | ||
|
||
<extension | ||
point="org.eclipse.ui.views"> | ||
<category | ||
id="org.eclipse.gemoc.executionframework.ui.category" | ||
name="Gemoc"> | ||
</category> | ||
|
||
<view | ||
category="org.eclipse.gemoc.executionframework.ui.category" | ||
class="org.eclipse.gemoc.executionframework.engine.ui.concurrency.views.step.LogicalStepsView" | ||
icon="icons/IconeGemocModel-16.png" | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView" | ||
name="Concurrent Logical Steps Decider"> | ||
</view> | ||
|
||
<view | ||
category="org.eclipse.gemoc.executionframework.ui.category" | ||
class="org.eclipse.gemoc.executionframework.engine.ui.concurrency.strategyselector.StrategySelectionView" | ||
icon="icons/IconeGemocModel-16.png" | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.StrategySelectionView" | ||
name="Strategy Selection"> | ||
</view> | ||
|
||
|
||
</extension> | ||
|
||
<extension | ||
point="org.eclipse.ui.perspectiveExtensions"> | ||
<perspectiveExtension | ||
targetID="org.eclipse.sirius.ui.tools.perspective.modeling"> | ||
|
||
<view | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView" | ||
minimized="false" | ||
relationship="stack" | ||
relative="org.eclipse.sirius.ui.tools.views.model.explorer" | ||
visible="true"> | ||
</view> | ||
|
||
<viewShortcut | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView"> | ||
</viewShortcut> | ||
|
||
</perspectiveExtension> | ||
<perspectiveExtension | ||
targetID="org.eclipse.debug.ui.DebugPerspective"> | ||
|
||
|
||
<view | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView" | ||
minimized="false" | ||
ratio="0.5" | ||
relationship="bottom" | ||
relative="org.eclipse.gemoc.executionframework.ui.views.engine.EnginesStatusView" | ||
visible="true"> | ||
</view> | ||
|
||
<viewShortcut | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView"> | ||
</viewShortcut> | ||
|
||
|
||
</perspectiveExtension> | ||
</extension> | ||
<extension | ||
point="org.eclipse.core.expressions.propertyTesters"> | ||
<propertyTester | ||
class="org.eclipse.gemoc.executionframework.engine.ui.propertytesters.GemocXDSMLPropertyTester" | ||
id="org.eclipse.gemoc.executionframework.engine.ui.propertytesters.GemocXDSMLPropertyTester" | ||
namespace="org.eclipse.gemoc.executionframework.engine.ui.propertytesters" | ||
properties="isModel, isExecutableDomainSpecificModel" | ||
type="org.eclipse.core.runtime.IAdaptable"> | ||
</propertyTester> | ||
</extension> | ||
|
||
<extension | ||
point="org.eclipse.ui.startup"> | ||
<startup | ||
class="org.eclipse.gemoc.executionframework.engine.ui.ModelingWorkbenchEarlyStartup"> | ||
</startup> | ||
</extension> | ||
|
||
<extension | ||
point="org.eclipse.ui.perspectiveExtensions"> | ||
<perspectiveExtension | ||
targetID="org.eclipse.sirius.ui.tools.perspective.modeling"> | ||
|
||
<view | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView" | ||
minimized="false" | ||
relationship="stack" | ||
relative="org.eclipse.sirius.ui.tools.views.model.explorer" | ||
visible="true"> | ||
</view> | ||
|
||
<viewShortcut | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView"> | ||
</viewShortcut> | ||
|
||
</perspectiveExtension> | ||
<perspectiveExtension | ||
targetID="org.eclipse.debug.ui.DebugPerspective"> | ||
|
||
|
||
<view | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView" | ||
minimized="false" | ||
ratio="0.5" | ||
relationship="bottom" | ||
relative="org.eclipse.gemoc.executionframework.ui.views.engine.EnginesStatusView" | ||
visible="true"> | ||
</view> | ||
|
||
<viewShortcut | ||
id="org.eclipse.gemoc.executionframework.engine.io.views.steps.LogicalStepsView"> | ||
</viewShortcut> | ||
|
||
|
||
</perspectiveExtension> | ||
</extension> | ||
</plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
.../eclipse/gemoc/executionframework/engine/ui/propertytesters/GemocXDSMLPropertyTester.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ommons/pomfirst/org.eclipse.gemoc.xdsmlframework.api/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
2 changes: 1 addition & 1 deletion
2
protocols/engine_addon_protocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.classpath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...otocol/pomfirst/org.eclipse.gemoc.protocols.eaop.api/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.