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
e6c2764a
Commit
e6c2764a
authored
Oct 26, 2017
by
Tatiana Chuprina
Browse files
RED
refs 3087
parent
27937282
Changes
6
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.rcp.application/trunk/src/org/fortiss/af3/rcp/application/advisors/ApplicationActionBarAdvisor.java
View file @
e6c2764a
...
...
@@ -46,8 +46,9 @@ import org.fortiss.tooling.kernel.ui.util.TutorialUIServiceUtils;
* @author ratiu
* @author $Author: ratiu $
* @version $Rev: 2691 $
* @ConQAT.Rating
YELLOW
Hash:
E5C4724FD5037831FBCABF83AD980C8C
* @ConQAT.Rating
RED
Hash:
AA9D5D02B2451B14E449E8A8F9F884E3
*/
// TODO (TC, 15)
@SuppressWarnings
(
"restriction"
)
public
class
ApplicationActionBarAdvisor
extends
ActionBarAdvisor
{
...
...
@@ -203,40 +204,42 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
/** {@inheritDoc} */
@Override
protected
void
makeActions
(
IWorkbenchWindow
window
)
{
// TODO (TC, 25)
newWizardDropDownAction
=
ActionFactory
.
NEW_WIZARD_DROP_DOWN
.
create
(
window
);
register
(
newWizardDropDownAction
);
// TODO (TC, 25)
saveAction
=
ActionFactory
.
SAVE
.
create
(
window
);
register
(
saveAction
);
// TODO (TC, 25)
openPreferencesAction
=
ActionFactory
.
PREFERENCES
.
create
(
window
);
register
(
openPreferencesAction
);
// Actions for invisible accelerators.
// TODO (TC, 25)
quitAction
=
ActionFactory
.
QUIT
.
create
(
window
);
register
(
quitAction
);
// TODO (TC, 25)
undoAction
=
ActionFactory
.
UNDO
.
create
(
window
);
register
(
undoAction
);
// TODO (TC, 25)
redoAction
=
ActionFactory
.
REDO
.
create
(
window
);
register
(
redoAction
);
// TODO (TC, 25)
backAction
=
ActionFactory
.
BACKWARD_HISTORY
.
create
(
window
);
register
(
backAction
);
// TODO (TC, 25)
forwardAction
=
ActionFactory
.
FORWARD_HISTORY
.
create
(
window
);
register
(
forwardAction
);
// TODO (TC, 25)
cutAction
=
ActionFactory
.
CUT
.
create
(
window
);
register
(
cutAction
);
// TODO (TC, 25)
copyAction
=
ActionFactory
.
COPY
.
create
(
window
);
register
(
copyAction
);
// TODO (TC, 25)
pasteAction
=
ActionFactory
.
PASTE
.
create
(
window
);
register
(
pasteAction
);
// TODO (TC, 25)
deleteAction
=
ActionFactory
.
DELETE
.
create
(
window
);
register
(
deleteAction
);
...
...
@@ -344,6 +347,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
* Registers the "About AutoFOCUS3" action and attaches it to the corresponding button.
*/
private
void
registerAboutAction
(
IWorkbenchWindow
window
)
{
// TODO (TC, 25)
aboutAction
=
ActionFactory
.
ABOUT
.
create
(
window
);
aboutAction
.
setId
(
"aboutAction"
);
aboutAction
.
setImageDescriptor
(
getPluginImageDescriptor
(
"org.fortiss.af3.rcp.application"
,
...
...
@@ -358,6 +362,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
* Registers the "Intro" action and attaches it to the corresponding button.
*/
private
void
registerIntroAction
(
IWorkbenchWindow
window
)
{
// TODO (TC, 25)
introAction
=
ActionFactory
.
INTRO
.
create
(
window
);
register
(
introAction
);
}
...
...
@@ -366,6 +371,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
* Registers the "AF3 Help" action and attaches it to the corresponding button.
*/
private
void
registerHelpContentsAction
(
IWorkbenchWindow
window
)
{
// TODO (TC, 25)
helpContentsAction
=
ActionFactory
.
HELP_CONTENTS
.
create
(
window
);
helpContentsAction
.
setId
(
"helpContentsAction"
);
helpContentsAction
.
setToolTipText
(
"AF3 Help"
);
...
...
@@ -620,6 +626,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
* button.
*/
private
void
registerGoForward
(
IWorkbenchWindow
window
)
{
// TODO (TC, 25)
goForward
=
ActionFactory
.
FORWARD_HISTORY
.
create
(
window
);
register
(
forwardAction
);
register
(
goForward
);
...
...
@@ -630,6 +637,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
* button.
*/
private
void
registerGoBack
(
IWorkbenchWindow
window
)
{
// TODO (TC, 25)
goBack
=
ActionFactory
.
BACKWARD_HISTORY
.
create
(
window
);
register
(
backAction
);
register
(
goBack
);
...
...
@@ -789,9 +797,9 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
@Override
protected
void
fillMenuBar
(
IMenuManager
menuBar
)
{
// FileMenu.
MenuManager
fileMenu
=
new
MenuManager
(
IDEWorkbenchMessages
.
Workbench_file
,
IWorkbenchActionConstants
.
M_FILE
);
MenuManager
fileMenu
=
new
MenuManager
(
IDEWorkbenchMessages
.
Workbench_file
,
// TODO (TC, 25)
IWorkbenchActionConstants
.
M_FILE
);
menuBar
.
add
(
fileMenu
);
fileMenu
.
add
(
newAF3ProjectAction
);
fileMenu
.
add
(
newAF3LibraryAction
);
...
...
@@ -824,6 +832,7 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
// EditMenu.
MenuManager
editMenu
=
// TODO (TC, 25)
new
MenuManager
(
IDEWorkbenchMessages
.
Workbench_edit
,
IWorkbenchActionConstants
.
M_EDIT
);
menuBar
.
add
(
editMenu
);
...
...
@@ -838,13 +847,16 @@ public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
editMenu
.
add
(
new
Separator
());
editMenu
.
add
(
deleteAction
);
// Required to make text editors open on first attempt in storage view
// TODO (TC, 25)
editMenu
.
add
(
new
Separator
(
IWorkbenchActionConstants
.
FIND_EXT
));
// TutorialMenu
// TODO (TC, 25)
MenuManager
tutorialMenu
=
TutorialUIServiceUtils
.
createTutorialMenu
();
menuBar
.
add
(
tutorialMenu
);
// Help Menu.
// TODO (TC, 25)
MenuManager
helpMenu
=
new
MenuManager
(
"&Help"
,
IWorkbenchActionConstants
.
M_HELP
);
menuBar
.
add
(
helpMenu
);
helpMenu
.
add
(
introAction
);
...
...
org.fortiss.af3.rcp.application/trunk/src/org/fortiss/af3/rcp/application/advisors/ApplicationWorkbenchAdvisor.java
View file @
e6c2764a
...
...
@@ -39,7 +39,7 @@ import org.fortiss.tooling.kernel.ui.ToolingKernelUI;
* @author ratiu
* @author $Author: ratiu $
* @version $Rev: 6104 $
* @ConQAT.Rating
YELLOW
Hash: E
D1286887C1B2AB2D0358D40304750B2
* @ConQAT.Rating
RED
Hash: E
E3D6DDA9E2CBB455637146A4E66B456
*/
public
class
ApplicationWorkbenchAdvisor
extends
WorkbenchAdvisor
{
...
...
@@ -53,19 +53,24 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
/** {@inheritDoc} */
@Override
public
IAdaptable
getDefaultPageInput
()
{
// TODO (TC, 25)
return
ResourcesPlugin
.
getWorkspace
().
getRoot
();
}
/** {@inheritDoc} */
@Override
public
void
preStartup
()
{
// TODO (TC, 25)
IDE
.
registerAdapters
();
// TODO (TC, 25)
AF3ExplorationUIActivator
.
registerWorkbenchListener
();
}
/** {@inheritDoc} */
@Override
public
void
postStartup
()
{
// TODO (TC, 25)
public
void
postStartup
()
{
ToolingKernel
.
start
();
ToolingBase
.
start
();
ToolingKernelUI
.
start
();
...
...
@@ -77,6 +82,7 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
@Override
public
void
initialize
(
IWorkbenchConfigurer
configurer
)
{
configurer
.
setSaveAndRestore
(
true
);
// TODO (TC, 25)
ToolingKernel
.
initialize
();
ToolingBase
.
initialize
();
ToolingKernelUI
.
initialize
();
...
...
@@ -86,6 +92,7 @@ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
/** {@inheritDoc} */
@Override
public
String
getInitialWindowPerspectiveId
()
{
// TODO (TC, 25)
return
ModelingPerspectiveFactory
.
MODELING_PERSPECTIVE_ID
;
}
}
org.fortiss.af3.rcp.application/trunk/src/org/fortiss/af3/rcp/application/advisors/ApplicationWorkbenchWindowAdvisor.java
View file @
e6c2764a
...
...
@@ -86,9 +86,11 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
}
}
// Register DSE perspective listener
// TODO (TC, 25)
AF3ExplorationUIActivator
.
registerPerspectiveListener
();
// enable AF3 Perspective rather than any other perspective at startup
// TODO (TC, 25)
ApplicationUtils
.
switchToAF3Perspective
();
}
}
org.fortiss.af3.rcp.application/trunk/src/org/fortiss/af3/rcp/application/advisors/CurrentObjectiveContributionItem.java
View file @
e6c2764a
...
...
@@ -68,7 +68,7 @@ import org.fortiss.tooling.kernel.utils.EcoreUtils;
* @author levilucio
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
YELLOW
Hash:
A962AD431C18BFEFE647AE506E70A18
F
* @ConQAT.Rating
RED
Hash:
6587E8E37CFF71CBE2744C49381CB2F
F
*/
class
CurrentObjectiveContributionItem
extends
ContributionItem
implements
ISelectionListener
,
IResourceChangeListener
{
...
...
@@ -94,10 +94,11 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
/** Constructor. */
public
CurrentObjectiveContributionItem
()
{
ISelectionService
ss
=
// TODO (TC,25)
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getSelectionService
();
ss
.
addSelectionListener
(
this
);
// TODO (TC,25)
IWorkspace
workspace
=
ResourcesPlugin
.
getWorkspace
();
workspace
.
addResourceChangeListener
(
this
);
}
...
...
@@ -105,8 +106,9 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
/** Creates the control holding list of objectives for the selected project. */
@Override
public
void
fill
(
ToolBar
parent
,
int
index
)
{
// TODO (TC,25)
toolitem
=
new
ToolItem
(
parent
,
SWT
.
SEPARATOR
,
index
);
// TODO (TC,25)
currentObjectiveCombo
=
new
Combo
(
parent
,
SWT
.
DROP_DOWN
);
currentObjectiveCombo
.
addSelectionListener
(
new
SelectionAdapter
()
{
...
...
@@ -133,6 +135,7 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
/** Compute Combo Width */
protected
int
computeWidth
(
Control
control
)
{
// TODO (TC,25)
return
control
.
computeSize
(
SWT
.
DEFAULT
,
SWT
.
DEFAULT
,
true
).
x
;
}
...
...
@@ -175,6 +178,7 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
fileProject
=
(
FileProject
)
chosenElement
;
}
else
{
fileProject
=
// TODO (TC,25)
EcoreUtils
.
getFirstParentWithType
(
chosenElement
,
FileProject
.
class
);
}
...
...
@@ -213,6 +217,7 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
}
}
// TODO (TC,10)
/**
*
* @author levilucio
...
...
@@ -260,10 +265,12 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
}
else
{
successPercentage
=
resultHolder
.
successCount
/
resultHolder
.
totalCount
;
if
(
successPercentage
<=
.
5
&&
successPercentage
>=
0
)
{
// TODO (TC, 25)
currentObjectiveCombo
.
setBackground
(
SWTResourceManager
.
getColor
(
new
RGB
(
0
,
(
float
).
7
-
(
successPercentage
)
/
2
,
1
)));
}
if
(
successPercentage
>=
.
5
)
{
// TODO (TC, 25)
currentObjectiveCombo
.
setBackground
(
SWTResourceManager
.
getColor
(
new
RGB
(
130
,
(
successPercentage
)
-
(
float
).
3
,
1
)));
}
...
...
@@ -282,9 +289,11 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
ConstraintConfiguration
newObjective
=
getConstraintConfigByName
(
newObjectiveName
);
final
ConstraintConfiguration
oldObjective
=
// TODO (TC, 20)
currentDevelopmentProcess
.
getCurrentObjective
();
if
(
newObjective
!=
null
)
{
ITopLevelElement
modelContext
=
// TODO (TC, 25)
IPersistencyService
.
getInstance
().
getTopLevelElementFor
(
currentDevelopmentProcess
);
modelContext
.
runAsNonDirtyingCommand
(()
->
{
...
...
@@ -292,18 +301,21 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
List
<
ConstraintConfiguration
>
activeConfigs
=
getActiveConfigurationsTransitively
(
newObjective
,
null
);
if
(!
activeConfigs
.
contains
(
oldObjective
))
{
// TODO (TC, 19,20)
deactivateConfiguration
(
oldObjective
,
currentDevelopmentProcess
.
getConstraintInstanceContainer
(),
newObjective
);
}
activateConfiguration
(
newObjective
,
// TODO (TC, 19,20)
currentDevelopmentProcess
.
getConstraintInstanceContainer
());
});
// TODO (TC,20)
currentObjectiveCombo
.
setText
(
currentDevelopmentProcess
.
getCurrentObjective
().
getName
());
generateScoresAndUpdateUI
(
currentDevelopmentProcess
);
// TODO (TC, 19,25)
List
<
String
>
configNames
=
currentDevelopmentProcess
.
getConfigurations
().
stream
().
map
(
c
->
c
.
getName
())
.
collect
(
Collectors
.
toList
());
...
...
@@ -316,6 +328,7 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
for
(
String
comboString
:
configNamesArray
)
{
currentObjectiveCombo
.
add
(
comboString
);
}
// TODO (TC,20)
currentObjectiveCombo
.
setText
(
currentDevelopmentProcess
.
getCurrentObjective
().
getName
());
}
...
...
@@ -337,6 +350,7 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
currentDevelopmentProcess
.
getConstraintInstanceContainer
().
getConstraintInstances
();
for
(
ConstraintInstance
ci
:
instances
)
{
if
(
constraintName
.
equalsIgnoreCase
(
ci
.
getConstraintName
()))
{
// TODO (TC, 25)
IConstraintInstanceStatus
status
=
IConstraintUIService
.
getInstance
().
getStatus
(
ci
);
if
(
status
instanceof
SuccessConstraintInstanceStatus
)
{
success
++;
...
...
@@ -377,10 +391,11 @@ class CurrentObjectiveContributionItem extends ContributionItem implements ISele
/** {@inheritDoc} */
@Override
public
void
resourceChanged
(
IResourceChangeEvent
event
)
{
// TODO (TC, 25)
if
(
event
.
getType
()
==
IResourceChangeEvent
.
POST_CHANGE
&&
currentDevelopmentProcess
!=
null
)
{
generateScoresAndUpdateUI
(
currentDevelopmentProcess
);
// TODO (TC, 19,25)
List
<
String
>
configNames
=
currentDevelopmentProcess
.
getConfigurations
().
stream
().
map
(
c
->
c
.
getName
())
.
collect
(
Collectors
.
toList
());
...
...
org.fortiss.af3.rcp.application/trunk/src/org/fortiss/af3/rcp/application/advisors/ImageLabelContribution.java
View file @
e6c2764a
...
...
@@ -12,7 +12,7 @@ import org.eclipse.swt.widgets.Label;
* @author levilucio
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
YELLOW
Hash:
FD7D79C001FE57524A2E536732C63804
* @ConQAT.Rating
RED
Hash:
B69611B509717BA3695858DE157FE621
*/
public
class
ImageLabelContribution
extends
ControlContribution
{
...
...
@@ -28,6 +28,7 @@ public class ImageLabelContribution extends ControlContribution {
/** {@inheritDoc} */
@Override
protected
Control
createControl
(
Composite
parent
)
{
// TODO(TC,25)
final
Label
b
=
new
Label
(
parent
,
SWT
.
CENTER
);
b
.
setImage
(
labelImageDescriptor
.
createImage
());
return
b
;
...
...
org.fortiss.af3.rcp.application/trunk/src/org/fortiss/af3/rcp/application/advisors/UpcomingObjectiveContributionItem.java
View file @
e6c2764a
...
...
@@ -82,14 +82,15 @@ public class UpcomingObjectiveContributionItem extends ContributionItem implemen
/** The control object holding the combo. */
private
ToolItem
toolitem
;
/** Configuration of the current project selected in the combo box */
/** Configuration of the current project selected in the combo box
.
*/
private
ConstraintBasedDevelopmentProcess
currentDevelopmentProcess
=
null
;
/** The current objective combo box */
/** The current objective combo box
.
*/
CurrentObjectiveContributionItem
currentObjective
;
/** Constructor. */
public
UpcomingObjectiveContributionItem
()
{
// TODO (TC,25)
ISelectionService
ww
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getSelectionService
();
...
...
@@ -99,20 +100,23 @@ public class UpcomingObjectiveContributionItem extends ContributionItem implemen
/** Creates the control holding the step length combo. */
@Override
public
void
fill
(
ToolBar
parent
,
int
index
)
{
// TODO (TC,25)
toolitem
=
new
ToolItem
(
parent
,
SWT
.
SEPARATOR
,
index
);
// TODO (TC,25)
upcomingObjectiveCombo
=
new
Combo
(
parent
,
SWT
.
DROP_DOWN
);
upcomingObjectiveCombo
.
addSelectionListener
(
new
SelectionListener
()
{
@Override
public
void
widgetSelected
(
SelectionEvent
e
)
{
// TODO (TC,2)
// TODO Auto-generated method stub
currentObjective
.
updateObjectiveByName
(((
Combo
)
e
.
getSource
()).
getText
());
}
@Override
public
void
widgetDefaultSelected
(
SelectionEvent
e
)
{
// TODO (TC,2)
// TODO Auto-generated method stub
// do nothing
}
...
...
@@ -159,6 +163,7 @@ public class UpcomingObjectiveContributionItem extends ContributionItem implemen
/** Compute Combo Width */
protected
int
computeWidth
(
Control
control
)
{
// TODO (TC,25)
return
control
.
computeSize
(
SWT
.
DEFAULT
,
SWT
.
DEFAULT
,
true
).
x
;
}
...
...
@@ -180,6 +185,7 @@ public class UpcomingObjectiveContributionItem extends ContributionItem implemen
if
(
chosenElement
instanceof
FileProjectImpl
)
{
fileProject
=
(
FileProjectImpl
)
chosenElement
;
}
else
{
// TODO (TC,25)
fileProject
=
EcoreUtils
.
getFirstParentWithType
(
chosenElement
,
FileProjectImpl
.
class
);
...
...
@@ -216,7 +222,7 @@ public class UpcomingObjectiveContributionItem extends ContributionItem implemen
private
List
<
ConstraintConfiguration
>
getUpcomingObjectives
()
{
EList
<
ConstraintConfiguration
>
configs
=
currentDevelopmentProcess
.
getConfigurations
();
// TODO (TC,25)
List
<
ConstraintConfiguration
>
atomicConfigs
=
LambdaUtils
.
filterList
(
configs
,
c
->
c
.
getIncludedConfigurations
().
isEmpty
());
...
...
@@ -283,7 +289,7 @@ public class UpcomingObjectiveContributionItem extends ContributionItem implemen
* @return true if the configuration is satisfied, false otherwise
*/
private
boolean
isConfigurationSatisfied
(
ConstraintConfiguration
constraintConfiguration
)
{
// TODO (TC,25)
ITopLevelElement
modelContext
=
IPersistencyService
.
getInstance
().
getTopLevelElementFor
(
currentDevelopmentProcess
);
...
...
@@ -292,23 +298,26 @@ public class UpcomingObjectiveContributionItem extends ContributionItem implemen
EList
<
String
>
activeConstraints
=
constraintConfiguration
.
getActiveConstraints
();
if
(!
activeConstraints
.
isEmpty
())
{
modelContext
.
runAsNonDirtyingCommand
(()
->
{
// deactivate current configurations
// TODO (TC,20)
deactivateConfiguration
(
currentDevelopmentProcess
.
getCurrentObjective
(),
currentDevelopmentProcess
.
getConstraintInstanceContainer
());
// activate configuration to be checked
// TODO (TC,20)
activateOneConfiguration
(
constraintConfiguration
,
currentDevelopmentProcess
.
getConstraintInstanceContainer
());
});
for
(
String
constraintName
:
activeConstraints
)
{
// TODO (TC,20)
EList
<
ConstraintInstance
>
instances
=
currentDevelopmentProcess
.
getConstraintInstanceContainer
()
.
getConstraintInstances
();
for
(
ConstraintInstance
ci
:
instances
)
{
if
(
constraintName
.
equalsIgnoreCase
(
ci
.
getConstraintName
()))
{
// TODO (TC,25)
IConstraintInstanceStatus
status
=
IConstraintUIService
.
getInstance
().
getStatus
(
ci
);
if
(!(
status
instanceof
SuccessConstraintInstanceStatus
))
{
...
...
@@ -318,14 +327,15 @@ public class UpcomingObjectiveContributionItem extends ContributionItem implemen
}
}
}
modelContext
.
runAsNonDirtyingCommand
(()
->
{
// deactivate configuration to be checked
// TODO (TC,20)
deactivateOneConfiguration
(
constraintConfiguration
,
currentDevelopmentProcess
.
getConstraintInstanceContainer
());
// reactivate current configuration
// TODO (TC,20)
activateConfiguration
(
currentDevelopmentProcess
.
getCurrentObjective
(),
currentDevelopmentProcess
.
getConstraintInstanceContainer
());
});
...
...
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