use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject in project convertigo by convertigo.
the class TransactionExecuteDefaultAction 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) {
ProjectTreeObject projectTreeObject = treeObject.getProjectTreeObject();
Connector connector = null;
if (treeObject instanceof ConnectorTreeObject) {
ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) treeObject;
connectorTreeObject.openConnectorEditor();
connector = connectorTreeObject.getObject();
} else {
connector = ((Project) projectTreeObject.getObject()).getDefaultConnector();
ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) explorerView.findTreeObjectByUserObject(connector);
if (connectorTreeObject != null)
connectorTreeObject.openConnectorEditor();
}
Transaction transaction = connector.getDefaultTransaction();
ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
if (connectorEditor != null) {
getActivePage().activate(connectorEditor);
connectorEditor.getDocument(transaction.getName(), false);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to execute the default transaction!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject 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.ConnectorTreeObject in project convertigo by convertigo.
the class AbstractConnectorComposite method selectionChanged.
/**
* Handles tree view selection
*/
public void selectionChanged(SelectionChangedEvent event) {
if (event.getSource() instanceof ISelectionProvider) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TreeObject treeObject = (TreeObject) selection.getFirstElement();
if (treeObject != null) {
if (ILearnable.class.isAssignableFrom(this.getClass()) && (!HttpConnectorComposite.class.equals(this.getClass()))) {
ConnectorTreeObject connectorTreeObject = treeObject.getConnectorTreeObject();
if (connectorTreeObject != null) {
Connector connector = (Connector) connectorTreeObject.getObject();
if (connector.equals(this.connector)) {
if (treeObject instanceof TransactionTreeObject) {
if (!this.connector.isLearning())
toolBarSetEnable("Learn", true);
} else {
if (!this.connector.isLearning())
toolBarSetEnable("Learn", false);
}
} else {
if (!this.connector.isLearning())
toolBarSetEnable("Learn", false);
}
}
}
}
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject in project convertigo by convertigo.
the class JavelinConnectorComposite method initJavelin.
protected void initJavelin(boolean bRecord) {
String traceFilePath = null;
if (bRecord) {
Timestamp ts = new Timestamp(System.currentTimeMillis());
traceFilePath = connector.getProject().getDirPath() + "/Traces/" + connector.getName() + "/";
traceFilePath += ts.toString().substring(0, 10) + "_trace.etr";
File file = new File(traceFilePath);
if (!file.exists()) {
try {
file.createNewFile();
ProjectExplorerView explorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
if (explorerView != null) {
ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) explorerView.findTreeObjectByUserObject(connector);
for (TreeObject treeObject : connectorTreeObject.getChildren()) {
if (treeObject instanceof FolderTreeObject) {
if (treeObject.getName().equals("Traces")) {
TraceTreeObject traceTreeObject = new TraceTreeObject(explorerView.viewer, file);
((FolderTreeObject) treeObject).addChild(traceTreeObject);
explorerView.refreshTreeObject(treeObject);
explorerView.setSelectedTreeObject(traceTreeObject);
}
}
}
}
} catch (IOException e) {
ConvertigoPlugin.errorMessageBox("Unable to create the trace file");
}
}
}
// The following code allows to push relevant MDC values into Javelin's
// threads
JavelinObjectCreatorThread javelinObjectCreatorThread = new JavelinObjectCreatorThread(this, traceFilePath);
javelinObjectCreatorThread.start();
while (javelinObjectCreatorThread.isAlive()) {
try {
Thread.sleep(300);
} catch (InterruptedException e) {
}
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject in project convertigo by convertigo.
the class HtmlConnectorDesignComposite method selectionChanged.
public void selectionChanged(SelectionChangedEvent event) {
if (event.getSource() instanceof ISelectionProvider) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TreeObject treeObject = (TreeObject) selection.getFirstElement();
if (treeObject != null) {
ConnectorTreeObject connectorTreeObject = treeObject.getConnectorTreeObject();
if (connectorTreeObject != null) {
Connector connector = (Connector) connectorTreeObject.getObject();
if (connector.equals(htmlConnector)) {
if (treeObject instanceof TransactionTreeObject) {
if (!htmlConnector.isLearning())
toolLearn.setEnabled(true);
} else {
if (!htmlConnector.isLearning())
toolLearn.setEnabled(false);
}
} else {
if (!htmlConnector.isLearning())
toolLearn.setEnabled(false);
}
}
}
}
}
Aggregations