use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView 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();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class UndoAction method update.
public void update() {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
UndoManager undoManager = explorerView.getUndoManager();
setText(undoManager.getUndoPresentationName());
setEnabled(undoManager.canUndo());
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class UnloadedProjectDeleteAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
MultipleDeletionDialog dialog;
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
if (treeObjects.length == 1) {
dialog = new MultipleDeletionDialog(shell, "Project Deletion", false);
} else {
dialog = new MultipleDeletionDialog(shell, "Project Deletion", true);
}
dialog.setToggle("Delete project content on disk (cannot be undone)", false);
if (treeObjects != null && treeObjects.length > 0) {
for (TreeObject treeObject : treeObjects) {
if (treeObject instanceof UnloadedProjectTreeObject) {
String projectName = ((UnloadedProjectTreeObject) treeObject).getName();
if (dialog.shouldBeDeleted("Do you really want to delete the project \"" + projectName + "\" and all its sub-objects?")) {
// Deleted project will be backup, car will be deleted to avoid its deployment at engine restart
// Engine.theApp.databaseObjectsManager.deleteProject(projectName);
Job rmProject = new Job("Remove '" + projectName + "' project") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
if (dialog.getToggleState()) {
Engine.theApp.databaseObjectsManager.deleteProjectAndCar(projectName);
}
ConvertigoPlugin.getDefault().deleteProjectPluginResource(dialog.getToggleState(), projectName);
} catch (Exception e) {
ConvertigoPlugin.logException(e, "Unable to delete the '" + projectName + "' project.");
return new MultiStatus(ConvertigoPlugin.PLUGIN_UNIQUE_ID, IStatus.ERROR, "Failed to remove the '" + projectName + "' project.", e);
}
return Status.OK_STATUS;
}
};
rmProject.schedule();
explorerView.removeProjectTreeObject(treeObject);
explorerView.fireTreeObjectRemoved(new TreeObjectEvent(treeObject));
}
}
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to delete the project!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class VariableGenerateFromXmlAndLinkAction 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 StepVariable))) {
StepVariable stepVariable = (StepVariable) databaseObject;
RequestableStep requestableStep = (RequestableStep) stepVariable.getParent();
if (requestableStep != null) {
DatabaseObjectTreeObject parentDboTreeObject = ((DatabaseObjectTreeObject) treeObject).getParentDatabaseObjectTreeObject().getParentDatabaseObjectTreeObject();
RequestableObject requestableObject = null;
if (requestableStep instanceof SequenceStep) {
requestableObject = ((SequenceStep) requestableStep).getTargetSequence();
} else if (requestableStep instanceof TransactionStep) {
requestableObject = ((TransactionStep) requestableStep).getTargetTransaction();
}
if ((requestableObject != null) && (requestableObject instanceof IVariableContainer)) {
String variableName = stepVariable.getName();
IVariableContainer container = (IVariableContainer) requestableObject;
RequestableVariable variable = (RequestableVariable) container.getVariable(variableName);
// generate dom model
Document document = null;
try {
String description = variable.getDescription();
document = XMLUtils.parseDOMFromString(description);
} catch (Exception e) {
}
if (document != null) {
Element root = document.getDocumentElement();
if (root != null) {
// create step's structure from dom
DatabaseObject parentObject = requestableStep.getParent();
Step step = StepUtils.createStepFromXmlDomModel(parentObject, root);
// add step's structure to parent of requestableStep
if (parentObject instanceof Sequence) {
Sequence parentSequence = (Sequence) parentObject;
parentSequence.addStep(step);
parentSequence.insertAtOrder(step, requestableStep.priority);
} else {
StepWithExpressions parentSwe = (StepWithExpressions) parentObject;
parentSwe.addStep(step);
parentSwe.insertAtOrder(step, requestableStep.priority);
}
// set source definition of variable
XMLVector<String> sourceDefinition = new XMLVector<String>();
sourceDefinition.add(String.valueOf(step.priority));
sourceDefinition.add(".");
stepVariable.setSourceDefinition(sourceDefinition);
stepVariable.hasChanged = true;
// Reload parent dbo in tree
explorerView.reloadTreeObject(parentDboTreeObject);
// Select variable dbo in tree
explorerView.objectSelected(new CompositeEvent(databaseObject));
}
}
}
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to generate and link variable!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView 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();
}
}
Aggregations