Closed joeseibel closed 3 years ago
We need to find a generic solution that can be added to all existing instance model based analyses.
Going to experiment with this using the bus load analysis which was written with a new action handler, and the flow latency analysis, which was written the old way.
It sounds like people want to be able to invoke an analysis on a component implementation, and then have one of the following things happen
Work with the new bus load analysis first.
I need to
plugin.xml
so that the command is active for component implementations (basically anything that can be instantiated) (see the instantiation commands).Running an analysis on an implementation should always create a fresh instance model.
First thing I need to do is modify the InstantiationHandler
to extract an "instantiation engine" class (probably really a Job
) that can be used in multiple contexts, including the InstantiationHandler
.
ComponentImplementation
s as input.Should be abstracted to both instantiate and reinstantiate engines.
End result should be .internal.
. We want to use this in a few places, but no reason a 3rd-party should if we get the abstract handlers right.
Adding this to the 3rd-party API epic because it relates to fixing up the abstract handlers for OSATE analyses.
Created org.osate.ui.internal.instantiate.AbstractInstantiationEngine
, and then org.osate.ui.internal.instantiate.InstantiationEngine
and org.osate.ui.internal.instantiate.ReinstantiationEngine
. These replace AbstractMultiJobHandler
, which is now @deprecated
(it never should have been public).
The instantiate and reinstantiate handlers have been updated to use the engines.
Okay, back to updating NewBusLoadAnalyisHandler
. I need to
plugin.xml
so that the command is active for component implementations (basically anything that can be instantiated) (see the instantiation commands).Updated NewAbstractAaxlHandler
to find all the ComponentImplementations
in the UI selection and pass them to the instantiation engine. This was pretty easy now that we have the engine.
It was more work to update the plugin.xml
so that the bus load analysis command is available in the outline view and navigator view on component implementations. The command is not available on aadl files. I could do so easily, but I think that would be very confusing.
API Issue Should make a template in the plugin.xml
that bundles up the activation/enablement patterns for commands that operate on instance models. I forgot right now what Eclipse calls these things, but I know we have one already lying around for something else.
This is the definition
extension point
Should update the old AaxlReadOnlyHandlerAsJob
so that the old commands can benefit, but this class will be replaced in the future.
Added definitions
extenstion points to org.osate.ui
plugin to simplify command visibility and enablement for commands execute analysis over an instance model.
<!-- open AADL project or any closed project -->
<definition id="org.osate.ui.definition.private.isAADLProject">
<and>
<instanceof value="org.eclipse.core.resources.IProject" />
<or>
<test
property="org.eclipse.core.resources.projectNature"
value="org.osate.core.aadlnature" />
<not>
<test property="org.eclipse.core.resources.open" />
</not>
</or>
</and>
</definition>
<!-- folder in an AADL project -->
<definition id="org.osate.ui.definition.private.isAADLFolder">
<and>
<instanceof value="org.eclipse.core.resources.IFolder" />
<test
property="org.eclipse.core.resources.projectNature"
value="org.osate.core.aadlnature" />
</and>
</definition>
<!-- Instance model file -->
<definition id="org.osate.ui.definition.private.isAAXLFile">
<adapt
type="org.eclipse.core.resources.IFile">
<test
property="org.eclipse.core.resources.contentTypeId"
value="org.osate.core.instanceModelFile">
</test>
</adapt>
</definition>
<!-- Instantiatable ComponentImplementation as an EObjectURIWrapper (navigator view) -->
<definition id="org.osate.ui.definition.private.isInstantiatableEObjectURIWrapper">
<adapt
type="org.osate.aadl2.modelsupport.EObjectURIWrapper">
<and>
<test
property="org.osate.aadl2.modelsupport.wrapperSuperType"
value="ComponentImplementation"
forcePluginActivation="true">
</test>
<not>
<test
property="org.osate.aadl2.modelsupport.wrapperSuperType"
value="SubprogramImplementation"
forcePluginActivation="true">
</test>
</not>
<not>
<test
property="org.osate.aadl2.modelsupport.wrapperSuperType"
value="SubprogramGroupImplementation"
forcePluginActivation="true">
</test>
</not>
</and>
</adapt>
</definition>
<!-- Instantiatable ComponentImplementation as an EObjectURIWrapper (outline view) -->
<definition id="org.osate.ui.definition.private.isInstantiatableEObjectNode">
<adapt
type="org.eclipse.xtext.ui.editor.outline.impl.EObjectNode">
<and>
<test
property="org.osate.ui.superType"
value="ComponentImplementation"
forcePluginActivation="true">
</test>
<not>
<test
property="org.osate.ui.superType"
value="SubprogramImplementation"
forcePluginActivation="true">
</test>
</not>
<not>
<test
property="org.osate.ui.superType"
value="SubprogramGroupImplementation"
forcePluginActivation="true">
</test>
</not>
</and>
</adapt>
</definition>
<!-- For visibleWhen: Be visible when there are 1 or more selected objects and AT LEAST ONE of them
is a working set, AADL Project, folder in an AADL Project, an AAXL file, or an instantiatable
component implementation. -->
<definition id="org.osate.ui.definition.public.instanceAnalysisCommandVisibility">
<with
variable="selection">
<and>
<count
value="+">
</count>
<iterate
ifEmpty="false"
operator="or">
<or>
<!-- Working set -->
<instanceof value="org.eclipse.ui.IWorkingSet" />
<reference definitionId="org.osate.ui.definition.private.isAADLProject"/>
<reference definitionId="org.osate.ui.definition.private.isAADLFolder"/>
<reference definitionId="org.osate.ui.definition.private.isAAXLFile"/>
<reference definitionId="org.osate.ui.definition.private.isInstantiatableEObjectURIWrapper"/>
<reference definitionId="org.osate.ui.definition.private.isInstantiatableEObjectNode"/>
</or>
</iterate>
</and>
</with>
</definition>
<!-- For enabledWhen: Be enabled when there are 1 or more selected objects and ALL OF THEM are one of
working set, AADL Project, folder in an AADL Project, an AAXL file, or an instantiatable
component implementation. -->
<definition id="org.osate.ui.definition.public.instanceAnalysisCommandEnabled">
<with
variable="selection">
<and>
<count
value="+">
</count>
<iterate
ifEmpty="false"
operator="and">
<or>
<!-- Working set -->
<instanceof value="org.eclipse.ui.IWorkingSet" />
<reference definitionId="org.osate.ui.definition.private.isAADLProject"/>
<reference definitionId="org.osate.ui.definition.private.isAADLFolder"/>
<reference definitionId="org.osate.ui.definition.private.isAAXLFile"/>
<reference definitionId="org.osate.ui.definition.private.isInstantiatableEObjectURIWrapper"/>
<reference definitionId="org.osate.ui.definition.private.isInstantiatableEObjectNode"/>
</or>
</iterate>
</and>
</with>
</definition>
Private definitions are meant to be used internally to define public definitions. Public definitions are to be part of the 3rd party API and should be documented. The above has
org.osate.ui.definition.private.isAADLProject
— private — Tests if the currently selected object (from a with
expression) is an AADL project (or a closed project of any sort).org.osate.ui.definition.private.isAADLFolder
— private — Tests if the currently selected object (from a with
expression) is a folder inside of an AADL project.org.osate.ui.definition.private.isAAXLFile
— private — Tests if the currently selected object (from a with
expression) is an AAXL instance model file.org.osate.ui.definition.private.isInstantiatableEObjectURIWrapper
— private — Tests if the currently selected object (from a with
expression) is an EObjectURIWrapper
that can be adapted to an ComponentImplementation
that can be instantiated. That is, one that is not a subprogram or subprogram group implementation. This is mean for testing the selection in the AADL Navigator
view.org.osate.ui.definition.private.isInstantiatableEObjectNode
— private — Tests if the currently selected object (from a with
expression) is an EObjectNode
that can be adapted to an ComponentImplementation
that can be instantiated. That is, one that is not a subprogram or subprogram group implementation. This is mean for testing the selection in the Outline
view.org.osate.ui.definition.public.instanceAnalysisCommandVisibility
— public — Meant to be used in a visibleWhen
expression. Tests if there are 1 or more selected objects and at least one of them is a working set, AADL Project, folder in an AADL Project, an AAXL file, or an instantiatable component implementation.org.osate.ui.definition.public.instanceAnalysisCommandEnabled
— public — Meant to be used in an enabledWhen
expression. Tests if there are 1 or more selected objects and all of them of them are either a working set, AADL Project, folder in an AADL Project, an AAXL file, or an instantiatable component implementation.Updated the instantiate and reinstantiate commands to use the new definitions.
Added "Reinstantiate" to the instance editor and instance outline view context menus.
Added Bus load analysis to the instance editor and instance outline view context menus. Updated the NewAbstractAaxlHandler to deal with SystemInstance
selections.
Cleaned up <visibleWhen>
and <enabledWhen>
clauses in all the plugin.xml
files to make better use of definitions. Added a few more private ones. Added another public one:
<!-- For enabledWhen: Be enabled when we are in the AADL Perspective -->
<definition id="org.osate.ui.definition.public.inAadlPerspective">
<with
variable="activeWorkbenchWindow.activePerspective">
<equals
value="org.osate.ui.perspective.AadlPerspective">
</equals>
</with>
</definition>
This is used by toolbar commands.
For analyses that operate on the instance model, it should be possible to run them on an implementation. The analysis should automatically generate the instance before running the analysis. This request came up during the AADL standards committee meeting.