Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
e8a30c00
Commit
e8a30c00
authored
Dec 20, 2019
by
Simon Barner
Browse files
Merge branch 'master' of
https://git.fortiss.org/af3/af3.git
into 3884
parents
b7ebaa91
c9362d0d
Changes
225
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/properties/.ratings
View file @
e8a30c00
ComponentSpecificationPropertySection.java
1f757e659828a61ae79f41d33255523019bb518d
GREEN
ComponentSpecificationPropertySection.java
fb5b6d82090f7ae063a8876b421529075d072939
GREEN
PortDataPropagation.java 9305d9fd7bb52398bdf227ddf7e1b54adac15808 GREEN
PortInitValueSection.java c25ad3fd1998f35c10a541caad3211f1333ae420 GREEN
PortSpecificationPropertySection.java 180ea52f0c50c4fd3d3ee2a7e59d22d0e3e05c75 RED
...
...
org.fortiss.af3.component.ui/src/org/fortiss/af3/component/ui/properties/ComponentSpecificationPropertySection.java
View file @
e8a30c00
...
...
@@ -16,16 +16,10 @@
package
org.fortiss.af3.component.ui.properties
;
import
static
org
.
fortiss
.
af3
.
component
.
model
.
AF3ComponentPackage
.
Literals
.
CAUSALITY_COMPONENT_SPECIFICATION__STRONGLY_CAUSAL
;
import
static
org
.
fortiss
.
af3
.
mira
.
model
.
MiraPackage
.
Literals
.
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
observeSelection
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
ObservableUtils
.
observeValue
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
pickInstanceOf
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
LoggingUtils
.
error
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang.StringUtils
;
import
org.eclipse.core.databinding.observable.value.IObservableValue
;
import
org.eclipse.jface.viewers.ArrayContentProvider
;
import
org.eclipse.jface.viewers.ComboViewer
;
...
...
@@ -46,7 +40,6 @@ import org.fortiss.af3.component.model.ComponentArchitecture;
import
org.fortiss.af3.component.model.VerifBehaviourComponentSpecification
;
import
org.fortiss.af3.component.model.VerificationBehaviour
;
import
org.fortiss.af3.component.ui.AF3ComponentUIActivator
;
import
org.fortiss.af3.mira.model.ExternalRelationSpecification
;
import
org.fortiss.tooling.kernel.extension.data.ITopLevelElement
;
import
org.fortiss.tooling.kernel.service.IPersistencyService
;
import
org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase
;
...
...
@@ -60,27 +53,15 @@ public final class ComponentSpecificationPropertySection extends PropertySection
/** Stores the current input. */
private
Component
component
;
/** Store the traces. */
private
Set
<
String
>
traces
;
/** Text section showing the traces */
private
Text
showTraces
;
/** The selected {@link CausalityComponentSpecification}. */
private
CausalityComponentSpecification
specification
;
/** for capturing the external relation specification */
ExternalRelationSpecification
spec
;
/** Stores causality flag button. */
private
Button
stronglyCausalButton
;
/** Stores component implement the requirement correctly flag button. */
private
Button
componentImplReqButton
;
/** Label for the "component implement requirement" text. */
private
Label
componentImplreqLabel
;
/** The selected {@link VerifBehaviourComponentSpecification}. */
private
VerifBehaviourComponentSpecification
verifBehaviourSpec
;
...
...
@@ -107,9 +88,6 @@ public final class ComponentSpecificationPropertySection extends PropertySection
showTraces
.
setEditable
(
false
);
stronglyCausalButton
=
getWidgetFactory
().
createButton
(
composite
,
""
,
SWT
.
CHECK
);
stronglyCausalLabel
=
createFormEntry
(
stronglyCausalButton
,
"Strongly Causal"
);
componentImplReqButton
=
getWidgetFactory
().
createButton
(
composite
,
""
,
SWT
.
CHECK
);
componentImplreqLabel
=
createFormEntry
(
componentImplReqButton
,
"Correctly Implement Req.:"
);
verifBehaviourCombo
=
createFormComboViewer
(
"Verif. behaviour"
);
verifBehaviourCombo
.
setContentProvider
(
new
ArrayContentProvider
());
verifBehaviourCombo
.
setLabelProvider
(
new
LabelProvider
()
{
...
...
@@ -161,25 +139,6 @@ public final class ComponentSpecificationPropertySection extends PropertySection
}
else
{
component
=
(
Component
)
input
;
}
traces
=
pickInstanceOf
(
ExternalRelationSpecification
.
class
,
component
.
getSpecifications
())
.
stream
().
map
(
e
->
e
.
getExternalRelation
().
getSourceRequirement
().
getReqId
())
.
collect
(
Collectors
.
toSet
());
showTraces
.
setText
(
StringUtils
.
join
(
traces
,
", "
));
// if traces size is 0 (i.e., Traced To) disable the button
if
(
traces
.
size
()
==
0
)
{
componentImplReqButton
.
setEnabled
(
false
);
componentImplreqLabel
.
setEnabled
(
false
);
}
else
{
componentImplReqButton
.
setEnabled
(
true
);
componentImplreqLabel
.
setEnabled
(
true
);
// check if the first instance of externalRelationSpecification is not null using get(0)
if
(
pickInstanceOf
(
ExternalRelationSpecification
.
class
,
component
.
getSpecifications
())
.
get
(
0
)
!=
null
)
{
// get(0) is to get the first instance of the externalRelationSpecification
spec
=
pickInstanceOf
(
ExternalRelationSpecification
.
class
,
component
.
getSpecifications
()).
get
(
0
);
}
}
enableStronglyCausal
(
component
.
getContainedElements
().
isEmpty
());
specification
=
component
.
getCausalitySpecification
();
...
...
@@ -202,6 +161,7 @@ public final class ComponentSpecificationPropertySection extends PropertySection
}
/** {@inheritDoc} */
@SuppressWarnings
(
"unchecked"
)
@Override
public
void
refresh
()
{
super
.
refresh
();
...
...
@@ -211,10 +171,5 @@ public final class ComponentSpecificationPropertySection extends PropertySection
IObservableValue
<?>
modelObservable
=
observeValue
(
specification
,
CAUSALITY_COMPONENT_SPECIFICATION__STRONGLY_CAUSAL
);
dbc
.
bindValue
(
observeSelection
(
stronglyCausalButton
),
modelObservable
,
null
,
null
);
if
(
spec
!=
null
)
{
IObservableValue
<?>
modelObservable1
=
observeValue
(
spec
,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY
);
dbc
.
bindValue
(
observeSelection
(
componentImplReqButton
),
modelObservable1
,
null
,
null
);
}
}
}
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/perspective/dashboard/projectwizard/.ratings
View file @
e8a30c00
DashboardWizard.java
4ff1ce284e9d90b239d4b647fc5eb40c8eb7c75b
GREEN
DashboardWizard.java
327a5ae84e8c8c0e48bfa9694e4827fc14f000a0
GREEN
DashboardWizardRootElementSelectionBase.java 1fe550598f11da4cdcf1ecc02173dfc2b992b669 GREEN
DashboardWizardSelectAllocation.java 1a9a0db43c3d8e2247804be2de6eccbd0a9aa48c GREEN
DashboardWizardSelectComponentArchitecture.java 26ee0bd9412f05dfad0903d86bda159b0629b722 GREEN
DashboardWizardSelectDataDictionary.java 8322cfbd0c0b0019b67de766303137f2fab77a2d GREEN
DashboardWizardSelectPlatformArchitecture.java be7a3b016564cf2cd16f14efbe75c58aca3dbc79 GREEN
DashboardWizardSelectProjectSource.java 9463d2a5fc69c015ae487606fa529b888b4f9e7c GREEN
DashboardWizardSelectReqirements.java d6bf47af1bcdea062d58f653c1cc1c99f7f790de GREEN
DashboardWizardSelectTaskArchitecture.java 8e52e852435047dba0f68d8dc454a8eb3159e461 GREEN
DashboardWizardSelectTimingSpecification.java 26bceb07a6e7aaa0f82e1162886b0d9091ad3398 GREEN
IDashboardWizardImportPage.java a8bbcbdadd8747a1099875230e359d6925a79f20 GREEN
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/perspective/dashboard/projectwizard/DashboardWizard.java
View file @
e8a30c00
...
...
@@ -101,7 +101,6 @@ public class DashboardWizard extends Wizard {
addPage
(
new
DashboardWizardSelectProjectSource
());
// Add the actual importer wizard pages.
registerConverter
(
new
DashboardWizardSelectDataDictionary
());
registerConverter
(
new
DashboardWizardSelectReqirements
());
registerConverter
(
new
DashboardWizardSelectComponentArchitecture
());
registerConverter
(
new
DashboardWizardSelectTaskArchitecture
());
registerConverter
(
new
DashboardWizardSelectAllocation
());
...
...
org.fortiss.af3.exploration.ui/src/org/fortiss/af3/exploration/ui/perspective/dashboard/projectwizard/DashboardWizardSelectReqirements.java
deleted
100644 → 0
View file @
b7ebaa91
/*-------------------------------------------------------------------------+
| Copyright 2019 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.exploration.ui.perspective.dashboard.projectwizard
;
import
static
org
.
fortiss
.
af3
.
exploration
.
util
.
ModelSnapshotExtractUtils
.
createRequirementModelSnapshot
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
getFirstChildWithType
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
pickInstanceOf
;
import
java.util.List
;
import
java.util.function.Function
;
import
org.eclipse.emf.ecore.EObject
;
import
org.fortiss.af3.exploration.model.project.ModelSnapshot
;
import
org.fortiss.af3.mira.model.Analysis
;
import
org.fortiss.af3.mira.model.Requirement
;
import
org.fortiss.af3.mira.model.SafetyLevelRequirementSpecification
;
import
org.fortiss.tooling.kernel.model.IProjectRootElement
;
/**
* Wizard page for selecting the {@link Requirement} {@link Analysis}. Currently, only
* safety-relevant Requirements are imported.
*
* @author eder
*/
public
class
DashboardWizardSelectReqirements
extends
DashboardWizardRootElementSelectionBase
<
Analysis
>
{
/** Constructor. */
public
DashboardWizardSelectReqirements
()
{
super
(
"Requirements"
,
Analysis
.
class
);
}
/** {@inheritDoc} */
@Override
protected
boolean
isRelevantElement
(
EObject
element
)
{
if
(
element
instanceof
Requirement
)
{
Requirement
req
=
(
Requirement
)
element
;
return
req
.
getSpecifications
().
stream
()
.
anyMatch
(
s
->
s
instanceof
SafetyLevelRequirementSpecification
);
}
return
false
;
}
/** {@inheritDoc} */
@Override
protected
boolean
isRelevantRootElement
(
Analysis
requirements
)
{
return
getFirstChildWithType
(
requirements
,
SafetyLevelRequirementSpecification
.
class
)
!=
null
;
}
/** {@inheritDoc} */
@Override
public
Function
<
Analysis
,
ModelSnapshot
>
getModelToSnapShotConverter
()
{
return
new
Function
<
Analysis
,
ModelSnapshot
>()
{
@Override
public
ModelSnapshot
apply
(
Analysis
t
)
{
return
createRequirementModelSnapshot
(
t
);
}
};
}
/** {@inheritDoc} */
@Override
public
boolean
inputsAvailable
(
List
<?
extends
IProjectRootElement
>
rootElements
)
{
List
<
Analysis
>
reqNodes
=
pickInstanceOf
(
Analysis
.
class
,
rootElements
);
for
(
Analysis
reqNode
:
reqNodes
)
{
if
(
isRelevantRootElement
(
reqNode
))
{
return
true
;
}
}
return
false
;
}
/** {@inheritDoc} */
@Override
public
boolean
isRequired
()
{
return
false
;
}
}
org.fortiss.af3.exploration/src/org/fortiss/af3/exploration/util/.ratings
View file @
e8a30c00
...
...
@@ -5,5 +5,5 @@ DSMLUtils.java c07eeef09787cea9db98533d346e3e384a232593 GREEN
ExplorationModelElementFactory.java bb48b2d09b92efcb1b2d3e382555089bb7ed5db5 GREEN
ExplorationReflectionUtils.java 62731e1cef32fe93f2c2017f93f5ba1f054d5197 GREEN
ExplorationUtils.java 79f8960b63762045008d27def3752d735dad43f0 GREEN
ModelSnapshotExtractUtils.java
940c5f0e2859519522ae8edfda63e05112870776
GREEN
ModelSnapshotExtractUtils.java
4f023e1247701c0e8f329575caddbbcac0066200
GREEN
PatternFactoryUtils.java bcb1d325aecfef12d29d4eb53b28fe59dbd20e9a GREEN
org.fortiss.af3.exploration/src/org/fortiss/af3/exploration/util/ModelSnapshotExtractUtils.java
View file @
e8a30c00
...
...
@@ -40,9 +40,6 @@ import org.fortiss.af3.exploration.dseml.model.expression.SuperSet;
import
org.fortiss.af3.exploration.model.SuperSetMap
;
import
org.fortiss.af3.exploration.model.project.ModelSnapshot
;
import
org.fortiss.af3.expression.model.DataDictionary
;
import
org.fortiss.af3.mira.model.Analysis
;
import
org.fortiss.af3.mira.model.Requirement
;
import
org.fortiss.af3.mira.model.SafetyLevelRequirementSpecification
;
import
org.fortiss.af3.platform.model.ExecutionUnit
;
import
org.fortiss.af3.platform.model.GatewayUnit
;
import
org.fortiss.af3.platform.model.MemoryUnit
;
...
...
@@ -222,17 +219,4 @@ public class ModelSnapshotExtractUtils {
public
static
ModelSnapshot
createTimingSpecificationSnapshot
(
TimingSpecification
timingSpec
)
{
return
createModelSnapshot
(
timingSpec
,
null
);
}
/** Creates a {@link ModelSnapshot} of {@link Requirement}s relevant for the DSE. */
public
static
ModelSnapshot
createRequirementModelSnapshot
(
Analysis
requirements
)
{
Collection
<
SafetyLevelRequirementSpecification
>
safetyReqSpecsCol
=
getChildrenWithType
(
requirements
,
SafetyLevelRequirementSpecification
.
class
);
SuperSet
<
SafetyLevelRequirementSpecification
>
safetyReqSpecs
=
createSuperSet
(
safetyReqSpecsCol
,
"Safety Functions"
,
SafetyLevelRequirementSpecification
.
class
);
SuperSetMap
reqSetMap
=
createSuperSetMap
();
reqSetMap
.
put
(
SafetyLevelRequirementSpecification
.
class
,
safetyReqSpecs
);
return
createModelSnapshot
(
requirements
,
reqSetMap
);
}
}
org.fortiss.af3.expression.ui/META-INF/MANIFEST.MF
View file @
e8a30c00
...
...
@@ -8,7 +8,8 @@ Bundle-Activator: org.fortiss.af3.expression.ui.AF3ExpressionUIActivator
Bundle-ClassPath: .
Require-Bundle: org.fortiss.af3.expression;visibility:=reexport,
org.fortiss.af3.project.ui;visibility:=reexport,
org.fortiss.af3.mira
org.fortiss.af3.mira,
org.fortiss.af3.component
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: fortiss GmbH
...
...
org.fortiss.af3.expression.ui/plugin.xml
View file @
e8a30c00
...
...
@@ -126,16 +126,6 @@
type=
"org.fortiss.af3.expression.model.definitions.StructureMember"
>
</input>
</propertySection>
<propertySection
afterSection=
"org.fortiss.tooling.kernel.ui.internal.properties.NamedCommentedPropertySection"
class=
"org.fortiss.af3.expression.ui.properties.EnumerationMemberPropertySection"
enablesFor=
"1"
id=
"org.fortiss.af3.micro.ui.typesystem.properties.EnumerationMemberPropertySection"
tab=
"org.fortiss.tooling.kernel.ui.property.tab.general"
>
<input
type=
"org.fortiss.af3.expression.model.definitions.EnumerationMember"
>
</input>
</propertySection>
<propertySection
afterSection=
"org.fortiss.tooling.kernel.ui.internal.properties.NamedCommentedPropertySection"
class=
"org.fortiss.af3.expression.ui.properties.ArrayPropertySection"
...
...
org.fortiss.af3.expression.ui/src/org/fortiss/af3/expression/ui/properties/.ratings
View file @
e8a30c00
ArrayPropertySection.java 49c7ab946be39d9ba680fc15f45a7ee635923f98 GREEN
EnumPropertySection.java f79ad25c0c0cd34e5234f8e3997787d0ed1f26d7 GREEN
EnumerationMemberPropertySection.java 2254265a406d07c089217c8e3b4993761587c7d7 GREEN
EnumPropertySection.java f6c6028c3e082314d5c3ef7c6a07de9f2f21a65e GREEN
FunctionDefinitionPropertySection.java 6b132b194a8dc7e9cd5c3645bf644aa529a8ca67 GREEN
StructureMemberPropertySection.java
f8a3d0e7f3b26fb0f6484a2598086cd1f5c949c4
GREEN
StructurePropertySection.java
b767fc1887cee6580ed3b93e78b4eefd46905af6
GREEN
StructureMemberPropertySection.java
2afb1ca630444ca323f45f6b2114a95a37c73703
GREEN
StructurePropertySection.java
3d1fe66636166447bb404a18473f9eaa844363a0
GREEN
org.fortiss.af3.expression.ui/src/org/fortiss/af3/expression/ui/properties/EnumPropertySection.java
View file @
e8a30c00
...
...
@@ -15,19 +15,9 @@
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.expression.ui.properties
;
import
static
org
.
apache
.
commons
.
lang
.
StringUtils
.
join
;
import
static
org
.
fortiss
.
af3
.
mira
.
model
.
MiraPackage
.
Literals
.
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY
;
import
static
org
.
fortiss
.
af3
.
mira
.
utils
.
MiraUtils
.
getTracesFromExternalRelSpec
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
observeSelection
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
ObservableUtils
.
observeValue
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
copy
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
pickInstanceOf
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
KernelModelElementUtils
.
getParentElement
;
import
java.util.Set
;
import
org.eclipse.core.databinding.observable.value.IObservableValue
;
import
org.eclipse.emf.common.util.EList
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.events.SelectionAdapter
;
import
org.eclipse.swt.events.SelectionEvent
;
...
...
@@ -41,7 +31,6 @@ import org.fortiss.af3.expression.model.definitions.Enumeration;
import
org.fortiss.af3.expression.model.definitions.EnumerationMember
;
import
org.fortiss.af3.expression.model.definitions.library.EnumerationRef
;
import
org.fortiss.af3.expression.utils.ExpressionModelElementFactory
;
import
org.fortiss.af3.mira.model.ExternalRelationSpecification
;
import
org.fortiss.tooling.kernel.extension.data.ITopLevelElement
;
import
org.fortiss.tooling.kernel.service.IElementCompositorService
;
import
org.fortiss.tooling.kernel.service.IPersistencyService
;
...
...
@@ -56,8 +45,6 @@ public class EnumPropertySection extends PropertySectionBase {
/** The enumeration. */
private
Enumeration
enumeration
;
/** Store the traces. */
private
Set
<
String
>
traces
;
/** Text section showing the traces */
private
Text
showTraces
;
/** The detach label. */
...
...
@@ -65,17 +52,6 @@ public class EnumPropertySection extends PropertySectionBase {
/** The detach button. */
private
Button
detachButton
;
/**
* Check button that enables the user to make the choice if enumeration implements the
* requirement.
*/
private
Button
enumerationImplReqButton
;
/** Label for the "enumeration implement requirement" text. */
private
Label
enumerationImplreqLabel
;
/** For capturing the external relation specification from the set of specifications */
ExternalRelationSpecification
spec
;
/** {@inheritDoc} */
@Override
public
void
createControls
(
Composite
parent
,
TabbedPropertySheetPage
tabbedPropertySheetPage
)
{
...
...
@@ -83,9 +59,6 @@ public class EnumPropertySection extends PropertySectionBase {
showTraces
=
createFormText
(
"Traced to:"
);
showTraces
.
setEditable
(
false
);
enumerationImplReqButton
=
getWidgetFactory
().
createButton
(
composite
,
""
,
SWT
.
CHECK
);
enumerationImplreqLabel
=
createFormEntry
(
enumerationImplReqButton
,
"Correctly Implement Req.:"
);
detachButton
=
getWidgetFactory
().
createButton
(
composite
,
"Detach from library"
,
SWT
.
NONE
);
detachLabel
=
createFormEntry
(
detachButton
,
"Name"
);
...
...
@@ -126,35 +99,12 @@ public class EnumPropertySection extends PropertySectionBase {
@Override
protected
void
setSectionInput
(
Object
input
)
{
enumeration
=
(
Enumeration
)
input
;
EList
<
ExternalRelationSpecification
>
specs
=
pickInstanceOf
(
ExternalRelationSpecification
.
class
,
enumeration
.
getSpecifications
());
traces
=
getTracesFromExternalRelSpec
(
specs
);
showTraces
.
setText
(
join
(
traces
,
", "
));
// if traces are 0 disable the check button "Correctly Implement Req."
if
(
traces
.
size
()
==
0
)
{
enumerationImplReqButton
.
setEnabled
(
false
);
enumerationImplreqLabel
.
setEnabled
(
false
);
}
else
{
enumerationImplReqButton
.
setEnabled
(
true
);
enumerationImplreqLabel
.
setEnabled
(
true
);
// check if the first instance of externalRelationSpecification is not null using get(0)
if
(
specs
.
get
(
0
)
!=
null
)
{
// get(0) is to get the first instance of the externalRelationSpecification
spec
=
specs
.
get
(
0
);
}
}
}
/** {@inheritDoc} */
@Override
public
void
refresh
()
{
super
.
refresh
();
if
(
spec
!=
null
)
{
IObservableValue
<?>
modelObservable1
=
observeValue
(
spec
,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY
);
dbc
.
bindValue
(
observeSelection
(
enumerationImplReqButton
),
modelObservable1
,
null
,
null
);
}
if
(
enumeration
instanceof
EnumerationRef
)
{
detachLabel
.
setVisible
(
true
);
detachButton
.
setVisible
(
true
);
...
...
org.fortiss.af3.expression.ui/src/org/fortiss/af3/expression/ui/properties/EnumerationMemberPropertySection.java
deleted
100644 → 0
View file @
b7ebaa91
/*-------------------------------------------------------------------------+
| Copyright 2011 fortiss GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.expression.ui.properties
;
import
static
org
.
apache
.
commons
.
lang
.
StringUtils
.
join
;
import
static
org
.
fortiss
.
af3
.
mira
.
model
.
MiraPackage
.
Literals
.
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY
;
import
static
org
.
fortiss
.
af3
.
mira
.
utils
.
MiraUtils
.
getTracesFromExternalRelSpec
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
observeSelection
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
ObservableUtils
.
observeValue
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
pickInstanceOf
;
import
java.util.Set
;
import
org.eclipse.core.databinding.observable.value.IObservableValue
;
import
org.eclipse.emf.common.util.EList
;
import
org.eclipse.jface.databinding.swt.ISWTObservableValue
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Label
;
import
org.eclipse.swt.widgets.Text
;
import
org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage
;
import
org.fortiss.af3.expression.model.definitions.EnumerationMember
;
import
org.fortiss.af3.expression.model.definitions.StructureMember
;
import
org.fortiss.af3.mira.model.ExternalRelationSpecification
;
import
org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase
;
/**
* Property section for {@link StructureMember}s.
*
* @author eder
*/
public
final
class
EnumerationMemberPropertySection
extends
PropertySectionBase
{
/** The selected {@link StructureMember}. */
protected
EnumerationMember
member
;
/** Store the traces. */
private
Set
<
String
>
traces
;
/** Text section showing the traces */
private
Text
showTraces
;
/**
* Check button that enables the user to make the choice if enumerationMember implements the
* requirement.
*/
private
Button
enumerationMemberImplReqButton
;
/** Label for the "enumeration member implement requirement" text. */
private
Label
enumerationMemberImplreqLabel
;
/** For capturing the external relation specification */
ExternalRelationSpecification
spec
;
/** {@inheritDoc} */
@Override
public
void
createControls
(
Composite
parent
,
TabbedPropertySheetPage
aTabbedPropertySheetPage
)
{
super
.
createControls
(
parent
,
aTabbedPropertySheetPage
);
showTraces
=
createFormText
(
"Traced to:"
);
showTraces
.
setEditable
(
false
);
enumerationMemberImplReqButton
=
getWidgetFactory
().
createButton
(
composite
,
""
,
SWT
.
CHECK
);
enumerationMemberImplreqLabel
=
createFormEntry
(
enumerationMemberImplReqButton
,
"Correctly Implement Req.:"
);
}
/** {@inheritDoc} */
@Override
protected
void
setSectionInput
(
Object
input
)
{
member
=
(
EnumerationMember
)
input
;
EList
<
ExternalRelationSpecification
>
specs
=
pickInstanceOf
(
ExternalRelationSpecification
.
class
,
member
.
getSpecifications
());
traces
=
getTracesFromExternalRelSpec
(
specs
);
showTraces
.
setText
(
join
(
traces
,
", "
));
if
(
traces
.
size
()
==
0
)
{
enumerationMemberImplReqButton
.
setEnabled
(
false
);
enumerationMemberImplreqLabel
.
setEnabled
(
false
);
}
else
{
enumerationMemberImplReqButton
.
setEnabled
(
true
);
enumerationMemberImplreqLabel
.
setEnabled
(
true
);
// check if the first instance of externalRelationSpecification is not null using get(0)
if
(
specs
.
get
(
0
)
!=
null
)
{
// get(0) is to get the first instance of the externalRelationSpecification
spec
=
specs
.
get
(
0
);
}
}
}
/** {@inheritDoc} */
@Override
public
void
refresh
()
{
super
.
refresh
();
if
(
spec
!=
null
)
{
IObservableValue
<?>
modelObservable
=
observeValue
(
spec
,
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY
);
ISWTObservableValue
swtObservable
=
observeSelection
(
enumerationMemberImplReqButton
);
dbc
.
bindValue
(
swtObservable
,
modelObservable
,
null
,
null
);
}
}
}
org.fortiss.af3.expression.ui/src/org/fortiss/af3/expression/ui/properties/StructureMemberPropertySection.java
View file @
e8a30c00
...
...
@@ -15,23 +15,11 @@
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.expression.ui.properties
;
import
static
org
.
apache
.
commons
.
lang
.
StringUtils
.
join
;
import
static
org
.
fortiss
.
af3
.
mira
.
model
.
MiraPackage
.
Literals
.
EXTERNAL_RELATION_SPECIFICATION__REQUIREMENT_IMPLEMENTED_CORRECTLY
;
import
static
org
.
fortiss
.
af3
.
mira
.
utils
.
MiraUtils
.
getTracesFromExternalRelSpec
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
observeSelection
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
performComplexTextBinding
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
ObservableUtils
.
observeValue
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
utils
.
EcoreUtils
.
pickInstanceOf
;
import
java.util.Set
;
import
org.eclipse.core.databinding.observable.value.IObservableValue
;
import
org.eclipse.emf.common.util.EList
;
import
org.eclipse.jface.databinding.swt.ISWTObservableValue
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.Button
;
import
org.eclipse.swt.widgets.Composite
;
import
org.eclipse.swt.widgets.Label
;
import
org.eclipse.swt.widgets.Text
;
import
org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage
;
import
org.fortiss.af3.expression.model.definitions.DefinitionsPackage
;
...
...
@@ -39,7 +27,6 @@ import org.fortiss.af3.expression.model.definitions.StructureMember;
import
org.fortiss.af3.expression.ui.databinding.convert.StringToTypeConverter
;
import
org.fortiss.af3.expression.ui.databinding.convert.TypeToStringConverter
;
import
org.fortiss.af3.expression.ui.databinding.validate.StringToTypeValidator
;
import
org.fortiss.af3.mira.model.ExternalRelationSpecification
;
import
org.fortiss.tooling.kernel.ui.extension.base.PropertySectionBase
;
/**
...
...
@@ -52,24 +39,12 @@ public final class StructureMemberPropertySection extends PropertySectionBase {
/** The selected {@link StructureMember}. */
protected
StructureMember
member
;
/** Store the traces. */
private
Se