|
@@ -41,6 +41,7 @@ import org.yakindu.sct.refactoring.refactor.AbstractRefactoring;
|
|
|
* <ul>
|
|
|
* <li>Each incoming transition has at least one action.</li>
|
|
|
* <li>No incoming transition enters a composite state which has entry actions.</li>
|
|
|
+ * <li>At least one action is foldable.</li>
|
|
|
* </ul>
|
|
|
* @author thomas kutz - Initial contribution and API
|
|
|
*
|
|
@@ -60,7 +61,8 @@ public class FoldIncomingActionsRefactoring extends AbstractRefactoring<State> {
|
|
|
public boolean isExecutable() {
|
|
|
return super.isExecutable()
|
|
|
&& allIncomingTransitionsHaveAtLeastOneAction()
|
|
|
- && noIncomingTransitionEntersCompositeWithEntryActions();
|
|
|
+ && noIncomingTransitionEntersCompositeWithEntryActions()
|
|
|
+ && atLeastOneActionIsFoldable();
|
|
|
}
|
|
|
|
|
|
private boolean noIncomingTransitionEntersCompositeWithEntryActions() {
|
|
@@ -70,8 +72,11 @@ public class FoldIncomingActionsRefactoring extends AbstractRefactoring<State> {
|
|
|
private boolean allIncomingTransitionsHaveAtLeastOneAction() {
|
|
|
return helper.haveAllAtLeastOneAction(getContextObject().getIncomingTransitions());
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ private boolean atLeastOneActionIsFoldable() {
|
|
|
+ EList<Transition> transitions = getContextObject().getIncomingTransitions();
|
|
|
+ return getLastFoldableAction(helper.getAllActions(transitions), 0) != null;
|
|
|
+ }
|
|
|
|
|
|
private List<Expression> getFoldableActions() {
|
|
|
EList<Transition> transitions = getContextObject()
|