Search in sources :

Example 6 with AbstractSCTResource

use of org.yakindu.sct.model.sgraph.resource.AbstractSCTResource in project statecharts by Yakindu.

the class GroupStatesIntoCompositeRefactoringTest method testSemanticalRefactoring.

@Test
public void testSemanticalRefactoring() {
    Statechart initial = models.loadStatechartFromResource(GROUPING_STATES + INITIAL_STATECHART);
    List<State> states = getStatesByName(initial, Lists.newArrayList("B", "C", "D"));
    GroupStatesIntoCompositeRefactoring refactoring = new GroupStatesIntoCompositeRefactoring();
    refactoring.contextStates = Lists.newArrayList(states);
    AbstractSCTResource initialRes = (AbstractSCTResource) initial.eResource();
    initialRes.setSerializerEnabled(true);
    refactoring.doSemanticalRefactoring();
    initialRes.setSerializerEnabled(false);
    initialRes.linkSpecificationElements();
    Statechart expected = models.loadStatechartFromResource(GROUPING_STATES + EXPECTED_STATECHART);
    compareStatecharts(initial, expected);
}
Also used : AbstractSCTResource(org.yakindu.sct.model.sgraph.resource.AbstractSCTResource) State(org.yakindu.sct.model.sgraph.State) Statechart(org.yakindu.sct.model.sgraph.Statechart) Test(org.junit.Test) RefactoringTest(org.yakindu.sct.refactoring.refactor.RefactoringTest)

Example 7 with AbstractSCTResource

use of org.yakindu.sct.model.sgraph.resource.AbstractSCTResource in project statecharts by Yakindu.

the class AbstractRefactoring method parseAndLinkSpecificationElements.

/**
 * Parses and links the specification elements of {@link AbstractRefactoring#getResource()}
 */
protected void parseAndLinkSpecificationElements() {
    Resource resource = getResource();
    if (resource instanceof AbstractSCTResource) {
        ((AbstractSCTResource) resource).parseSpecificationElements();
        ((AbstractSCTResource) resource).linkSpecificationElements();
    }
}
Also used : AbstractSCTResource(org.yakindu.sct.model.sgraph.resource.AbstractSCTResource) AbstractSCTResource(org.yakindu.sct.model.sgraph.resource.AbstractSCTResource) Resource(org.eclipse.emf.ecore.resource.Resource)

Aggregations

AbstractSCTResource (org.yakindu.sct.model.sgraph.resource.AbstractSCTResource)7 Statechart (org.yakindu.sct.model.sgraph.Statechart)3 State (org.yakindu.sct.model.sgraph.State)2 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IStatus (org.eclipse.core.runtime.IStatus)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 Status (org.eclipse.core.runtime.Status)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)1 View (org.eclipse.gmf.runtime.notation.View)1 ITaskFinder (org.eclipse.xtext.tasks.ITaskFinder)1 CancelIndicator (org.eclipse.xtext.util.CancelIndicator)1 Issue (org.eclipse.xtext.validation.Issue)1 Test (org.junit.Test)1 IDomain (org.yakindu.sct.domain.extension.IDomain)1 RefactoringTest (org.yakindu.sct.refactoring.refactor.RefactoringTest)1