651ee47df7282751f3e891b11dcce3e5588b2caa
[simantics/platform.git] / bundles / org.simantics.tests.modelled.ui / src / org / simantics / tests / modelled / ui / TestsUIUtils.java
1 package org.simantics.tests.modelled.ui;
2
3 import java.io.IOException;
4
5 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
6 import org.simantics.db.Resource;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.ui.workbench.e4.E4WorkbenchUtils;
9
10 public class TestsUIUtils {
11
12     private TestsUIUtils() {
13     }
14
15     public static void runSTSTestAction(Resource test) throws DatabaseException, IOException {
16         MPart part = E4WorkbenchUtils.getMPartById(STSTestRunnerView.ID);
17         E4WorkbenchUtils.openAndShowPart(part);
18         Object obj = part.getObject();
19         STSTestRunnerView view = (STSTestRunnerView) obj;
20         view.currentTest(test);
21         view.execute();
22     }
23 }