use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject in project convertigo by convertigo.
the class TransactionCreateHandlerAction method run.
@Override
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
Statement lastStatement = null;
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
if (treeObject != null) {
Transaction transaction = null;
if (treeObject instanceof TransactionTreeObject) {
transaction = (Transaction) treeObject.getObject();
} else if (treeObject instanceof ObjectsFolderTreeObject) {
transaction = (Transaction) treeObject.getParent().getObject();
}
if (transaction != null) {
CreateHandlerDialog createHandlerDialog = new CreateHandlerDialog(shell, transaction);
createHandlerDialog.open();
if (createHandlerDialog.getReturnCode() != Window.CANCEL) {
List<?> result = createHandlerDialog.result;
if (result != null) {
int len = result.size();
if (len > 0) {
if (transaction instanceof HtmlTransaction) {
HtmlTransaction htmlTransaction = (HtmlTransaction) transaction;
Statement statement = null;
for (int i = 0; i < len; i++) {
statement = (Statement) result.get(i);
htmlTransaction.addStatement(statement);
}
lastStatement = statement;
} else {
String handler = null;
for (int i = 0; i < len; i++) {
handler = (String) result.get(i);
transaction.handlers += handler;
transaction.hasChanged = true;
}
// Update the opened handlers editor if any
JScriptEditorInput jsinput = ConvertigoPlugin.getDefault().getJScriptEditorInput(transaction);
if (jsinput != null) {
jsinput.reload();
}
}
// Reload transaction in tree and select last created Statement.
try {
ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
projectExplorerView.reloadDatabaseObject(transaction);
if (transaction instanceof HtmlTransaction) {
if (lastStatement != null) {
projectExplorerView.objectSelected(new CompositeEvent(lastStatement));
}
} else {
projectExplorerView.objectSelected(new CompositeEvent(transaction));
}
} catch (IOException e) {
}
}
}
}
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to create new handler for transaction!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject in project convertigo by convertigo.
the class TransactionEditHandlersAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
try {
boolean enable = false;
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof TransactionTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
enable = actionModel.isEnabled;
}
action.setEnabled(enable);
} catch (Exception e) {
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject in project convertigo by convertigo.
the class TransactionEditHandlersAction 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) {
Object treeObject = explorerView.getFirstSelectedTreeObject();
if (treeObject instanceof TransactionTreeObject)
((IEditableTreeObject) treeObject).launchEditor("JscriptTransactionEditor");
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to edit the transaction!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject in project convertigo by convertigo.
the class TransactionExecuteSelectedAction 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 TransactionTreeObject)) {
TransactionTreeObject transactionTreeObject = (TransactionTreeObject) treeObject;
Transaction transaction = transactionTreeObject.getObject();
transactionTreeObject.getConnectorTreeObject().openConnectorEditor();
Connector connector = (Connector) transaction.getParent();
ProjectTreeObject projectTreeObject = transactionTreeObject.getProjectTreeObject();
ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
if (connectorEditor != null) {
getActivePage().activate(connectorEditor);
connectorEditor.getDocument(transaction.getName(), isStubRequested());
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to execute the selected transaction!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject in project convertigo by convertigo.
the class TransactionExecuteSelectedFromStubAction 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 TransactionTreeObject)) {
TransactionTreeObject transactionTreeObject = (TransactionTreeObject) treeObject;
Transaction transaction = transactionTreeObject.getObject();
transactionTreeObject.getConnectorTreeObject().openConnectorEditor();
Connector connector = (Connector) transaction.getParent();
ProjectTreeObject projectTreeObject = transactionTreeObject.getProjectTreeObject();
ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
if (connectorEditor != null) {
getActivePage().activate(connectorEditor);
connectorEditor.getDocument(transaction.getName(), true);
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to execute the selected transaction!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
Aggregations