use of com.twinsoft.convertigo.beans.core.DatabaseObject 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.beans.core.DatabaseObject in project convertigo by convertigo.
the class UpdateXSDTypesAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
try {
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
action.setEnabled(actionModel.isEnabled);
} catch (Exception e) {
}
}
use of com.twinsoft.convertigo.beans.core.DatabaseObject 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.beans.core.DatabaseObject in project convertigo by convertigo.
the class SetMobileRootPageAction 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 MobilePageComponentTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
action.setChecked(actionModel.isChecked);
}
}
use of com.twinsoft.convertigo.beans.core.DatabaseObject in project convertigo by convertigo.
the class ShowStepInPickerAction 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) {
if (treeObject instanceof DatabaseObjectTreeObject) {
DatabaseObject selectedDbo = ((DatabaseObjectTreeObject) treeObject).getObject();
if (selectedDbo != null) {
StepSourceEvent event = null;
if (showSource) {
if (selectedDbo instanceof Step) {
Step step = (Step) selectedDbo;
Set<StepSource> sources = step.getSources();
if (!sources.isEmpty()) {
event = new StepSourceEvent(sources.iterator().next());
} else {
throw new Exception("No Source defined");
}
}
} else {
event = new StepSourceEvent(selectedDbo);
}
if (event != null) {
SourcePickerView spv = ConvertigoPlugin.getDefault().getSourcePickerView();
if (spv == null) {
spv = (SourcePickerView) getActivePage().showView("com.twinsoft.convertigo.eclipse.views.sourcepicker.SourcePickerView");
}
if (spv != null) {
spv.sourceSelected(event);
}
}
}
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to show object in Picker!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
Aggregations