use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject in project convertigo by convertigo.
the class SetDefaultTransactionAction 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) {
TransactionTreeObject transactionTreeObject = (TransactionTreeObject) explorerView.getFirstSelectedTreeObject();
Transaction transaction = (Transaction) explorerView.getFirstSelectedDatabaseObject();
Connector connector = (Connector) transaction.getParent();
// Report from 4.5: fix #401
TransactionTreeObject defaultTransactionTreeObject = null;
Transaction defaultTransaction = connector.getDefaultTransaction();
if (defaultTransaction != null) {
defaultTransactionTreeObject = (TransactionTreeObject) explorerView.findTreeObjectByUserObject(defaultTransaction);
}
connector.setDefaultTransaction(transaction);
if (defaultTransactionTreeObject != null) {
defaultTransactionTreeObject.isDefault = false;
defaultTransactionTreeObject.hasBeenModified(true);
}
transactionTreeObject.isDefault = true;
transactionTreeObject.hasBeenModified(true);
// Updating the tree
explorerView.refreshTreeObject(transactionTreeObject.getParentDatabaseObjectTreeObject());
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to set transaction to default one!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject 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.TransactionTreeObject in project convertigo by convertigo.
the class AbstractStubAction 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;
Sequence sequence = sequenceTreeObject.getObject();
File stubDir = new File(sequence.getProject().getDirPath() + "/stubs");
stubDir.mkdirs();
File stubFile = new File(stubDir, sequence.getName() + ".xml");
Document dom = getXML(treeObject);
writeStub(dom, stubFile);
} else if ((treeObject != null) && (treeObject instanceof TransactionTreeObject)) {
TransactionTreeObject transactionTreeObject = (TransactionTreeObject) treeObject;
Transaction transaction = transactionTreeObject.getObject();
File stubDir = new File(transaction.getProject().getDirPath() + "/stubs");
stubDir.mkdirs();
File stubFile = new File(stubDir, transaction.getParent().getName() + "." + transaction.getName() + ".xml");
Document dom = getXML(treeObject);
writeStub(dom, stubFile);
}
}
} catch (NoSuchElementException e) {
ConvertigoPlugin.logException(e, "No previous XML file found");
} 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.TransactionTreeObject 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);
}
}
}
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject in project convertigo by convertigo.
the class SetDefaultTransactionAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
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);
action.setChecked(actionModel.isChecked);
}
}
Aggregations