use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.
the class TestCaseExecuteSelectedAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
if ((treeObject != null) && (treeObject instanceof TestCaseTreeObject)) {
TestCase testCase = (TestCase) treeObject.getObject();
ProjectTreeObject projectTreeObject = treeObject.getProjectTreeObject();
RequestableObject requestable = (RequestableObject) testCase.getParent();
if (requestable instanceof Transaction) {
TransactionTreeObject transactionTreeObject = (TransactionTreeObject) treeObject.getParent().getParent();
transactionTreeObject.getConnectorTreeObject().openConnectorEditor();
Transaction transaction = (Transaction) testCase.getParent();
Connector connector = (Connector) transaction.getParent();
ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
if (connectorEditor != null) {
getActivePage().activate(connectorEditor);
connectorEditor.getDocument(transaction.getName(), testCase.getName(), false);
}
}
if (requestable instanceof Sequence) {
SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) treeObject.getParent().getParent();
new SequenceExecuteSelectedAction().openEditors(explorerView, sequenceTreeObject);
Sequence sequence = (Sequence) testCase.getParent();
SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
if (sequenceEditor != null) {
getActivePage().activate(sequenceEditor);
sequenceEditor.getDocument(sequence.getName(), testCase.getName(), false);
}
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to execute the selected test case!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.
the class StepExportVariablesToSequenceAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
Object databaseObject = treeObject.getObject();
if ((databaseObject != null) && (databaseObject instanceof RequestableStep)) {
RequestableStep requestableStep = (RequestableStep) databaseObject;
requestableStep.exportVariableDefinition();
Sequence sequence = requestableStep.getSequence();
if (sequence.hasChanged) {
SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) explorerView.findTreeObjectByUserObject(sequence);
explorerView.reloadTreeObject(sequenceTreeObject);
explorerView.setSelectedTreeObject(sequenceTreeObject);
StructuredSelection structuredSelection = new StructuredSelection(sequenceTreeObject);
ConvertigoPlugin.getDefault().getPropertiesView().selectionChanged((IWorkbenchPart) explorerView, structuredSelection);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to export step variables to main sequence!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.
the class SequenceExecuteSelectedAction method openEditors.
private void openEditors(ProjectExplorerView explorerView, List<Step> steps, Set<SequenceStep> alreadyOpened) {
for (Step step : steps) {
if (step.isEnabled()) {
if (step instanceof SequenceStep) {
SequenceStep sequenceStep = (SequenceStep) step;
String projectName = sequenceStep.getProjectName();
// load project if necessary
if (!step.getSequence().getProject().getName().equals(projectName))
loadProject(explorerView, projectName);
if (alreadyOpened.contains(sequenceStep)) {
// avoid sequence recursion
return;
}
alreadyOpened.add(sequenceStep);
try {
ProjectTreeObject projectTreeObject = (ProjectTreeObject) explorerView.getProjectRootObject(projectName);
Sequence subSequence = projectTreeObject.getObject().getSequenceByName(sequenceStep.getSequenceName());
SequenceTreeObject subSequenceTreeObject = (SequenceTreeObject) explorerView.findTreeObjectByUserObject(subSequence);
// recurse on sequence
openEditors(explorerView, subSequenceTreeObject, alreadyOpened);
} catch (EngineException e) {
e.printStackTrace();
}
} else if (step instanceof TransactionStep) {
TransactionStep transactionStep = (TransactionStep) step;
String projectName = transactionStep.getProjectName();
if (!step.getSequence().getProject().getName().equals(projectName))
// load project if necessary
loadProject(explorerView, projectName);
try {
ProjectTreeObject projectTreeObject = (ProjectTreeObject) explorerView.getProjectRootObject(projectName);
Connector connector = projectTreeObject.getObject().getConnectorByName(transactionStep.getConnectorName());
ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) explorerView.findTreeObjectByUserObject(connector);
// open connector editor
connectorTreeObject.openConnectorEditor();
} catch (EngineException e) {
e.printStackTrace();
}
} else if (step instanceof StepWithExpressions) {
openEditors(explorerView, ((StepWithExpressions) step).getSteps(), alreadyOpened);
}
}
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.
the class SequenceExecuteSelectedAction method run.
@Override
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
if ((treeObject != null) && (treeObject instanceof SequenceTreeObject)) {
SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) treeObject;
openEditors(explorerView, sequenceTreeObject);
Sequence sequence = sequenceTreeObject.getObject();
ProjectTreeObject projectTreeObject = sequenceTreeObject.getProjectTreeObject();
SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
if (sequenceEditor != null) {
getActivePage().activate(sequenceEditor);
boolean fromStub = action.getId().contains("FromStub");
sequenceEditor.getSequenceEditorPart().getDocument(sequence.getName(), null, fromStub);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to execute the selected sequence!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.
the class SequenceExecuteSelectedAction method openEditors.
private void openEditors(ProjectExplorerView explorerView, TreeObject treeObject, Set<SequenceStep> alreadyOpened) {
if (treeObject instanceof SequenceTreeObject) {
SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) treeObject;
openEditors(explorerView, sequenceTreeObject.getObject().getSteps(), alreadyOpened);
sequenceTreeObject.openSequenceEditor();
}
}
Aggregations