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
c8065ae7
Commit
c8065ae7
authored
Oct 26, 2017
by
Simon Barner
Browse files
GREEN
refs 795
parent
5f042221
Changes
1
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.refinement.ui/trunk/src/org/fortiss/af3/refinement/ui/editor/RefinementSpecificationEditor.java
View file @
c8065ae7
...
...
@@ -17,11 +17,17 @@ $Id$
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.refinement.ui.editor
;
import
static
org
.
eclipse
.
jface
.
databinding
.
swt
.
SWTObservables
.
observeSelection
;
import
static
org
.
eclipse
.
jface
.
databinding
.
swt
.
SWTObservables
.
observeVisible
;
import
static
org
.
eclipse
.
jface
.
layout
.
GridDataFactory
.
fillDefaults
;
import
static
org
.
eclipse
.
jface
.
layout
.
GridDataFactory
.
swtDefaults
;
import
static
org
.
eclipse
.
ui
.
forms
.
widgets
.
ExpandableComposite
.
NO_TITLE
;
import
static
org
.
fortiss
.
af3
.
refinement
.
model
.
RefinementPackage
.
Literals
.
REFINEMENT_PORT_PROFILE__USE_RANDOM_VALUE
;
import
static
org
.
fortiss
.
af3
.
refinement
.
ui
.
utils
.
RefinementUtils
.
openComponentDialog
;
import
static
org
.
fortiss
.
af3
.
testing
.
ui
.
method
.
random
.
editor
.
DataProfileViewer
.
createProfileControl
;
import
static
org
.
fortiss
.
tooling
.
base
.
ui
.
utils
.
TableViewerUtils
.
createWeightedColumn
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
ObservableUtils
.
observeValue
;
import
org.eclipse.jface.databinding.swt.SWTObservables
;
import
org.eclipse.jface.layout.GridDataFactory
;
import
org.eclipse.jface.viewers.ColumnLabelProvider
;
import
org.eclipse.jface.viewers.TableViewer
;
...
...
@@ -35,7 +41,6 @@ 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.forms.widgets.ExpandableComposite
;
import
org.eclipse.ui.forms.widgets.ScrolledForm
;
import
org.fortiss.af3.component.model.Component
;
import
org.fortiss.af3.component.model.InputPort
;
...
...
@@ -44,28 +49,26 @@ import org.fortiss.af3.refinement.model.MSCRefinement;
import
org.fortiss.af3.refinement.model.RefinementSpecification
;
import
org.fortiss.af3.refinement.ui.action.GenerateRefinedTestSuiteAction
;
import
org.fortiss.af3.refinement.ui.action.LayoutFunctionComponentsAction
;
import
org.fortiss.af3.testing.ui.method.random.editor.DataProfileViewer
;
import
org.fortiss.tooling.base.ui.contentprovider.TableContentProviderBase
;
import
org.fortiss.tooling.base.ui.editor.FormsEditorBase
;
import
org.fortiss.tooling.kernel.ui.util.ObservableUtils
;
/**
* Editor to edit a {@link RefinementSpecification}
* Editor to edit a {@link RefinementSpecification}
.
*
* @author kisslinger
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
YELLOW
Hash: E
5325A18741D23174679EBE7B135B734
* @ConQAT.Rating
GREEN
Hash: E
FD4398853418DB61DD307C8BC00DFBD
*/
public
class
RefinementSpecificationEditor
extends
FormsEditorBase
<
RefinementSpecification
>
{
/**
s
ingle line label grid data factory */
private
static
GridDataFactory
singleLineLabelFactory
=
GridDataFactory
.
swtDefaults
()
.
align
(
SWT
.
RIGHT
,
SWT
.
CENTER
).
grab
(
false
,
false
);
/**
S
ingle line label grid data factory
.
*/
private
static
GridDataFactory
singleLineLabelFactory
=
swtDefaults
().
align
(
SWT
.
RIGHT
,
SWT
.
CENTER
).
grab
(
false
,
false
);
/**
s
ingle line input grid data factory */
private
static
GridDataFactory
singleLineInputFactory
=
GridDataFactory
.
swtDefaults
()
.
align
(
SWT
.
FILL
,
SWT
.
CENTER
).
grab
(
true
,
false
);
/**
S
ingle line input grid data factory
.
*/
private
static
GridDataFactory
singleLineInputFactory
=
swtDefaults
().
align
(
SWT
.
FILL
,
SWT
.
CENTER
).
grab
(
true
,
false
);
/** The table viewer. */
private
TableViewer
mscsTableViewer
;
...
...
@@ -95,14 +98,15 @@ public class RefinementSpecificationEditor extends FormsEditorBase<RefinementSpe
toolkit
.
createLabel
(
refinedComponentComposite
,
"Refined Component: "
);
singleLineLabelFactory
.
applyTo
(
refinedComponentLabel
);
//
t
ext field showing the name of the refined component
//
T
ext field showing the name of the refined component
final
Text
refinedComponentText
=
toolkit
.
createText
(
refinedComponentComposite
,
""
,
SWT
.
READ_ONLY
);
singleLineInputFactory
.
applyTo
(
refinedComponentText
);
if
(
editedObject
.
getRefinedComponent
()
!=
null
)
if
(
editedObject
.
getRefinedComponent
()
!=
null
)
{
refinedComponentText
.
setText
(
editedObject
.
getRefinedComponent
().
getName
());
}
//
b
utton to select the refined component
//
B
utton to select the refined component
Button
chooseButton
=
toolkit
.
createButton
(
refinedComponentComposite
,
"Choose"
,
SWT
.
FLAT
);
chooseButton
.
addSelectionListener
(
new
SelectionAdapter
()
{
...
...
@@ -122,7 +126,7 @@ public class RefinementSpecificationEditor extends FormsEditorBase<RefinementSpe
});
}
/** Set up section to set the input port settings */
/** Set up section to set the input port settings
.
*/
private
void
createInputPortSettingsSection
()
{
final
Composite
inputPortSettingsComposite
=
createNewSection
(
"Input port settings"
,
""
);
inputPortSettingsComposite
.
setLayout
(
new
GridLayout
(
2
,
false
));
...
...
@@ -138,27 +142,27 @@ public class RefinementSpecificationEditor extends FormsEditorBase<RefinementSpe
final
Button
randomValueCheckBox
=
toolkit
.
createButton
(
inputPortSettingsComposite
,
"Use random value"
,
SWT
.
CHECK
);
dbc
.
bindValue
(
SWTObservables
.
observeSelection
(
randomValueCheckBox
),
ObservableUtils
.
observeValue
(
editedObject
.
getPortProfileMap
().
get
(
inputPort
),
dbc
.
bindValue
(
observeSelection
(
randomValueCheckBox
),
observeValue
(
editedObject
.
getPortProfileMap
().
get
(
inputPort
),
REFINEMENT_PORT_PROFILE__USE_RANDOM_VALUE
));
// Composite that has the controls for the probability distribution
// etc.
// Composite that has the controls for the probability distribution, etc.
final
Composite
profileControlsComposite
=
toolkit
.
createComposite
(
inputPortSettingsComposite
);
GridDataFactory
.
fillDefaults
().
grab
(
true
,
false
).
span
(
2
,
1
)
.
applyTo
(
profileControlsComposite
);
fillDefaults
().
grab
(
true
,
false
).
span
(
2
,
1
).
applyTo
(
profileControlsComposite
);
DataProfileViewer
.
createProfileControl
(
profileControlsComposite
,
toolkit
,
dbc
,
editedObject
.
getPortProfileMap
().
get
(
inputPort
).
getDataProfile
(),
inputPort
.
getName
(),
ExpandableComposite
.
NO_TITLE
);
createProfileControl
(
profileControlsComposite
,
toolkit
,
dbc
,
editedObject
.
getPortProfileMap
().
get
(
inputPort
).
getDataProfile
(),
inputPort
.
getName
(),
NO_TITLE
);
//
f
or a proper presentation we have to set both, the visible flag
//
F
or a proper presentation we have to set both, the visible flag
// and the GridData exclude flag to control if the the
// profileControlsComposite is visible/hidden
dbc
.
bindValue
(
SWTObservables
.
observeVisible
(
profileControlsComposite
),
SWTObservables
.
observeSelection
(
randomValueCheckBox
));
dbc
.
bindValue
(
observeVisible
(
profileControlsComposite
),
observeSelection
(
randomValueCheckBox
));
randomValueCheckBox
.
addSelectionListener
(
new
SelectionAdapter
()
{
/** {@inheritDoc} */
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
((
GridData
)
profileControlsComposite
.
getLayoutData
()).
exclude
=
...
...
@@ -178,16 +182,17 @@ public class RefinementSpecificationEditor extends FormsEditorBase<RefinementSpe
@Override
protected
void
createColumns
(
final
TableViewer
viewer
)
{
createWeightedColumn
(
viewer
,
50
,
"MSC"
,
"The refined MSC."
,
new
ColumnLabelProvider
()
{
/** {@inheritDoc} */
@Override
public
String
getText
(
Object
element
)
{
return
((
MSCRefinement
)
element
).
getRefinedMSCObject
().
getName
();
}
});
//
l
ast check date column
//
L
ast check date column
createWeightedColumn
(
viewer
,
50
,
"Last Check Date"
,
"The date of the last check."
,
new
ColumnLabelProvider
()
{
/** {@inheritDoc} */
@Override
public
String
getText
(
Object
element
)
{
MSCRefinement
refinement
=
(
MSCRefinement
)
element
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment