use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.
the class ProjectExplorerView method makeActions.
private void makeActions() {
tracePlayAction = new TracePlayAction();
doubleClickAction = new Action() {
@Override
public void run() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
TreeObject treeObject = (TreeObject) selection.getFirstElement();
if (treeObject instanceof UnloadedProjectTreeObject) {
loadProject((UnloadedProjectTreeObject) treeObject);
} else if (treeObject instanceof ConnectorTreeObject) {
((ConnectorTreeObject) treeObject).launchEditor();
} else if (treeObject instanceof SequenceTreeObject) {
((SequenceTreeObject) treeObject).launchEditor();
} else if (treeObject instanceof StepTreeObject) {
showStepInPickerAction.run();
if (treeObject instanceof IEditableTreeObject) {
((IEditableTreeObject) treeObject).launchEditor(null);
}
} else if (treeObject instanceof VariableTreeObject2) {
if (treeObject.getObject() instanceof StepVariable) {
showStepInPickerAction.run();
}
} else if (treeObject instanceof IEditableTreeObject) {
((IEditableTreeObject) treeObject).launchEditor(null);
} else if (treeObject instanceof TraceTreeObject) {
tracePlayAction.run();
}
}
};
undoAction = new UndoAction();
redoAction = new RedoAction();
copyAction = new ClipboardCopyAction();
cutAction = new ClipboardCutAction();
pasteAction = new ClipboardPasteAction();
deleteDatabaseObjectAction = new DatabaseObjectDeleteAction();
deletePropertyTableRowAction = new DeletePropertyTableRowAction();
deletePropertyTableColumnAction = new DeletePropertyTableColumnAction();
projectExplorerSaveAllAction = new ProjectExplorerSaveAllAction();
decreasePriorityAction = new DatabaseObjectDecreasePriorityAction();
increasePriorityAction = new DatabaseObjectIncreasePriorityAction();
executeTransaction = new TransactionExecuteSelectedAction();
executeDefaultTransaction = new TransactionExecuteDefaultAction();
transactionEditHandlersAction = new TransactionEditHandlersAction();
executeSequence = new SequenceExecuteSelectedAction();
executeTestCase = new TestCaseExecuteSelectedAction();
showStepInPickerAction = new ShowStepInPickerAction();
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.
the class ProjectExplorerView method edit.
private void edit(TreeObject treeObject) {
final Tree tree = viewer.getTree();
final TreeEditor editor = new TreeEditor(tree);
final Color black = getSite().getShell().getDisplay().getSystemColor(SWT.COLOR_BLACK);
TreeItem[] items = tree.getSelection();
if (items.length > 0) {
final TreeItem item = items[0];
final TreeObject theTreeObject = treeObject;
if (treeObject instanceof ProjectTreeObject) {
if (((ProjectTreeObject) treeObject).getModified()) {
// Project need to be saved to avoid xsd/wsdl modification errors - Fix ticket #2265
ConvertigoPlugin.warningMessageBox("Please save project before renaming it.");
return;
}
}
if (treeObject.getObject() instanceof HandlerStatement) {
return;
}
if ((item != null) && lastItem.length > 0 && (item == lastItem[0])) {
boolean isCarbon = SWT.getPlatform().equals("carbon");
final Composite composite = new Composite(tree, SWT.NONE);
if (!isCarbon) {
composite.setBackground(black);
}
final Text text = new Text(composite, SWT.NONE);
final int inset = isCarbon ? 0 : 1;
composite.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event e) {
Rectangle rect = composite.getClientArea();
text.setBounds(rect.x + inset, rect.y + inset, rect.width - inset * 2, rect.height - inset * 2);
}
});
Listener textListener = new Listener() {
public void handleEvent(final Event e) {
MobileBuilder mba = null;
MobileBuilder mbo = null;
IEditorPart editorPart = ConvertigoPlugin.getDefault().getApplicationComponentEditor();
if (editorPart != null) {
IEditorInput input = editorPart.getEditorInput();
if (input instanceof com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput) {
com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput editorInput = GenericUtils.cast(input);
mba = editorInput.getApplication().getProject().getMobileBuilder();
}
if (input instanceof com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput) {
com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput editorInput = GenericUtils.cast(input);
mba = editorInput.getApplication().getProject().getMobileBuilder();
}
}
if (theTreeObject instanceof DatabaseObjectTreeObject) {
mbo = ((DatabaseObjectTreeObject) theTreeObject).getObject().getProject().getMobileBuilder();
}
String newName = null;
String oldName = null;
boolean needRefresh = false;
boolean needProjectReload = false;
if (theTreeObject instanceof DatabaseObjectTreeObject) {
oldName = ((DatabaseObject) ((DatabaseObjectTreeObject) theTreeObject).getObject()).getName();
} else if (theTreeObject instanceof TraceTreeObject) {
oldName = ((TraceTreeObject) theTreeObject).getName();
} else if (theTreeObject instanceof DesignDocumentViewTreeObject) {
oldName = ((DesignDocumentViewTreeObject) theTreeObject).getName();
} else if (theTreeObject instanceof DesignDocumentFunctionTreeObject) {
oldName = ((DesignDocumentFunctionTreeObject) theTreeObject).getName();
}
switch(e.type) {
case SWT.FocusOut:
editingTextCtrl = null;
composite.dispose();
break;
case SWT.Verify:
String newText = text.getText();
String leftText = newText.substring(0, e.start);
String rightText = newText.substring(e.end, newText.length());
GC gc = new GC(text);
Point size = gc.textExtent(leftText + e.text + rightText);
gc.dispose();
size = text.computeSize(size.x, SWT.DEFAULT);
editor.horizontalAlignment = SWT.LEFT;
Rectangle itemRect = item.getBounds(), rect = tree.getClientArea();
editor.minimumWidth = Math.max(size.x, itemRect.width) + inset * 2;
int left = itemRect.x, right = rect.x + rect.width;
editor.minimumWidth = Math.min(editor.minimumWidth, right - left);
editor.minimumHeight = size.y + inset * 2;
editor.layout();
break;
case SWT.Traverse:
switch(e.detail) {
case SWT.TRAVERSE_RETURN:
Engine.logStudio.info("---------------------- Rename started ----------------------");
if (mba != null) {
mba.prepareBatchBuild();
}
newName = text.getText();
// Save and close editors
if (theTreeObject instanceof IClosableTreeObject) {
((IClosableTreeObject) theTreeObject).closeAllEditors(true);
}
if (theTreeObject instanceof DatabaseObjectTreeObject) {
DatabaseObjectTreeObject dbObjectTreeObject = (DatabaseObjectTreeObject) theTreeObject;
if (dbObjectTreeObject.rename(newName, Boolean.TRUE)) {
item.setText(newName);
needRefresh = true;
if (theTreeObject instanceof ProjectTreeObject) {
needProjectReload = true;
}
}
} else if (theTreeObject instanceof TraceTreeObject) {
TraceTreeObject traceTreeObject = (TraceTreeObject) theTreeObject;
traceTreeObject.rename(newName);
if (traceTreeObject.hasChanged) {
item.setText(newName);
traceTreeObject.hasChanged = false;
needRefresh = true;
}
} else if (theTreeObject instanceof DesignDocumentViewTreeObject) {
DesignDocumentViewTreeObject ddvto = (DesignDocumentViewTreeObject) theTreeObject;
if (ddvto.rename(newName, Boolean.TRUE)) {
item.setText(newName);
needRefresh = true;
}
} else if (theTreeObject instanceof DesignDocumentFunctionTreeObject) {
DesignDocumentFunctionTreeObject ddfto = (DesignDocumentFunctionTreeObject) theTreeObject;
if (ddfto.rename(newName, Boolean.TRUE)) {
item.setText(newName);
needRefresh = true;
}
}
// FALL THROUGH
case SWT.TRAVERSE_ESCAPE:
editingTextCtrl = null;
composite.dispose();
e.doit = false;
}
break;
}
if (needRefresh) {
boolean updateDlg = false;
boolean updateReferences = false;
int update = 0;
// Updates references to object if needed
if ((theTreeObject instanceof ProjectTreeObject) || (theTreeObject instanceof SequenceTreeObject) || (theTreeObject instanceof ConnectorTreeObject) || (theTreeObject instanceof TransactionTreeObject) || (theTreeObject instanceof VariableTreeObject2) || (theTreeObject instanceof IDesignTreeObject) || (theTreeObject instanceof MobilePageComponentTreeObject) || (theTreeObject instanceof MobileUIComponentTreeObject) || (theTreeObject instanceof NgxPageComponentTreeObject) || (theTreeObject instanceof NgxUIComponentTreeObject)) {
String objectType = "";
if (theTreeObject instanceof ProjectTreeObject) {
objectType = "project";
updateDlg = true;
} else if (theTreeObject instanceof SequenceTreeObject) {
objectType = "sequence";
updateDlg = true;
} else if (theTreeObject instanceof ConnectorTreeObject) {
objectType = "connector";
updateDlg = true;
} else if (theTreeObject instanceof TransactionTreeObject) {
objectType = "transaction";
updateDlg = true;
} else if (theTreeObject instanceof VariableTreeObject2) {
objectType = "variable";
updateDlg = ((DatabaseObject) theTreeObject.getObject()) instanceof RequestableVariable ? true : false;
} else if (theTreeObject instanceof DesignDocumentTreeObject) {
objectType = "document";
updateDlg = true;
} else if (theTreeObject instanceof DesignDocumentViewTreeObject) {
objectType = "view";
updateDlg = true;
} else if (theTreeObject instanceof DesignDocumentFilterTreeObject) {
objectType = "filter";
updateDlg = true;
} else if (theTreeObject instanceof DesignDocumentUpdateTreeObject) {
objectType = "update";
updateDlg = true;
} else if (theTreeObject instanceof DesignDocumentValidateTreeObject) {
objectType = "validate";
updateDlg = true;
} else if (theTreeObject instanceof MobilePageComponentTreeObject) {
objectType = "page";
updateDlg = true;
} else if (theTreeObject instanceof NgxPageComponentTreeObject) {
objectType = "page";
updateDlg = true;
} else if (theTreeObject instanceof MobileUIComponentTreeObject) {
DatabaseObject dbo = (DatabaseObject) theTreeObject.getObject();
if (dbo instanceof com.twinsoft.convertigo.beans.mobile.components.UIDynamicMenu) {
objectType = "menu";
updateDlg = true;
}
if (dbo instanceof com.twinsoft.convertigo.beans.mobile.components.UIActionStack) {
objectType = "shared action";
updateDlg = true;
}
if (dbo instanceof com.twinsoft.convertigo.beans.mobile.components.UISharedComponent) {
objectType = "shared component";
updateDlg = true;
}
if (dbo instanceof com.twinsoft.convertigo.beans.mobile.components.UIStackVariable) {
objectType = "variable";
updateDlg = true;
}
if (dbo instanceof com.twinsoft.convertigo.beans.mobile.components.UICompVariable) {
objectType = "variable";
updateDlg = true;
}
} else if (theTreeObject instanceof NgxUIComponentTreeObject) {
DatabaseObject dbo = (DatabaseObject) theTreeObject.getObject();
if (dbo instanceof com.twinsoft.convertigo.beans.ngx.components.UIDynamicMenu) {
objectType = "menu";
updateDlg = true;
}
if (dbo instanceof com.twinsoft.convertigo.beans.ngx.components.UIActionStack) {
objectType = "shared action";
updateDlg = true;
}
if (dbo instanceof com.twinsoft.convertigo.beans.ngx.components.UISharedComponent) {
objectType = "shared component";
updateDlg = true;
}
if (dbo instanceof com.twinsoft.convertigo.beans.ngx.components.UIStackVariable) {
objectType = "variable";
updateDlg = true;
}
if (dbo instanceof com.twinsoft.convertigo.beans.ngx.components.UICompVariable) {
objectType = "variable";
updateDlg = true;
}
}
if (updateDlg) {
Shell shell = Display.getDefault().getActiveShell();
CustomDialog customDialog = new CustomDialog(shell, "Update object references", "Do you want to update " + objectType + " references ?\n You can replace '" + oldName + "' by '" + newName + "' in all loaded projects \n or replace '" + oldName + "' by '" + newName + "' in current project only.", 670, 200, new ButtonSpec("Replace in all loaded projects", true), new ButtonSpec("Replace in current project", false), new ButtonSpec("Do not replace anywhere", false));
int response = customDialog.open();
if (response == 0) {
updateReferences = true;
update = TreeObjectEvent.UPDATE_ALL;
}
if (response == 1) {
updateReferences = true;
update = TreeObjectEvent.UPDATE_LOCAL;
}
}
}
TreeObjectEvent treeObjectEvent = null;
if (updateReferences) {
treeObjectEvent = new TreeObjectEvent(theTreeObject, "name", oldName, newName, update);
} else {
treeObjectEvent = new TreeObjectEvent(theTreeObject, "name", oldName, newName);
}
BatchOperationHelper.start();
ProjectExplorerView.this.refreshTree();
ProjectExplorerView.this.setSelectedTreeObject(theTreeObject);
ProjectExplorerView.this.fireTreeObjectPropertyChanged(treeObjectEvent);
if (updateReferences && needProjectReload) {
((ProjectTreeObject) theTreeObject).save(false);
}
if (mbo != null) {
if (theTreeObject instanceof MobilePageComponentTreeObject) {
try {
mbo.pageRenamed((com.twinsoft.convertigo.beans.mobile.components.PageComponent) theTreeObject.getObject(), oldName);
} catch (EngineException e1) {
e1.printStackTrace();
}
}
if (theTreeObject instanceof NgxPageComponentTreeObject) {
try {
mbo.pageRenamed((com.twinsoft.convertigo.beans.ngx.components.PageComponent) theTreeObject.getObject(), oldName);
} catch (EngineException e1) {
e1.printStackTrace();
}
}
}
BatchOperationHelper.stop();
Engine.logStudio.info("---------------------- Rename ended ----------------------");
StructuredSelection structuredSelection = new StructuredSelection(theTreeObject);
ISelectionListener listener = null;
// refresh properties view
listener = ConvertigoPlugin.getDefault().getPropertiesView();
if (listener != null)
listener.selectionChanged((IWorkbenchPart) ProjectExplorerView.this, structuredSelection);
// refresh references view
listener = ConvertigoPlugin.getDefault().getReferencesView();
if (listener != null)
listener.selectionChanged((IWorkbenchPart) ProjectExplorerView.this, structuredSelection);
}
if (needProjectReload) {
Engine.theApp.databaseObjectsManager.clearCache(newName);
reloadProject(theTreeObject);
refreshTree();
}
}
};
text.addListener(SWT.FocusOut, textListener);
text.addListener(SWT.Traverse, textListener);
text.addListener(SWT.Verify, textListener);
editor.setEditor(composite, item);
if (theTreeObject instanceof DatabaseObjectTreeObject) {
text.setText(((DatabaseObjectTreeObject) theTreeObject).getName());
} else if (theTreeObject instanceof TraceTreeObject) {
text.setText(((TraceTreeObject) theTreeObject).getName());
} else if (theTreeObject instanceof DesignDocumentViewTreeObject) {
text.setText(((DesignDocumentViewTreeObject) theTreeObject).getName());
} else if (theTreeObject instanceof DesignDocumentFunctionTreeObject) {
text.setText(((DesignDocumentFunctionTreeObject) theTreeObject).getName());
}
text.selectAll();
text.setFocus();
editingTextCtrl = text;
}
lastItem[0] = item;
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.
the class ProjectExplorerView method loadDatabaseObject.
private void loadDatabaseObject(TreeParent parentTreeObject, DatabaseObject parentDatabaseObject, ProjectLoadingJob projectLoadingJob, final IProgressMonitor monitor) throws EngineException, IOException {
try {
new WalkHelper() {
// recursion parameters
TreeParent parentTreeObject;
ProjectLoadingJob projectLoadingJob;
// sibling parameters
ObjectsFolderTreeObject currentTreeFolder = null;
public void init(DatabaseObject databaseObject, TreeParent parentTreeObject, ProjectLoadingJob projectLoadingJob) throws Exception {
this.parentTreeObject = parentTreeObject;
this.projectLoadingJob = projectLoadingJob;
walkInheritance = true;
super.init(databaseObject);
}
protected ObjectsFolderTreeObject getFolder(TreeParent treeParent, int folderType) {
ObjectsFolderTreeObject ofto = null;
for (TreeObject to : treeParent.getChildren()) {
if (to instanceof ObjectsFolderTreeObject) {
if (((ObjectsFolderTreeObject) to).folderType == folderType) {
ofto = (ObjectsFolderTreeObject) to;
break;
}
}
}
if (ofto == null) {
ofto = new ObjectsFolderTreeObject(viewer, folderType);
treeParent.addChild(ofto);
}
return ofto;
}
@Override
protected void walk(DatabaseObject databaseObject) throws Exception {
// retrieve recursion parameters
final TreeParent parentTreeObject = this.parentTreeObject;
final ProjectLoadingJob projectLoadingJob = this.projectLoadingJob;
// retrieve sibling parameters
ObjectsFolderTreeObject currentTreeFolder = this.currentTreeFolder;
String dboName = (databaseObject instanceof Step) ? ((Step) databaseObject).getStepNodeName() : databaseObject.getName();
monitor.subTask("Loading databaseObject '" + dboName + "'...");
DatabaseObjectTreeObject databaseObjectTreeObject = null;
// first call case, the tree object already exists and its content is just refreshed
if (parentTreeObject.getObject() == databaseObject) {
databaseObjectTreeObject = (DatabaseObjectTreeObject) parentTreeObject;
} else // recursive call case, the tree object doesn't exist and must be added to the parent tree object
{
int folderType = Integer.MIN_VALUE;
if (databaseObject instanceof Connector) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_CONNECTORS;
databaseObjectTreeObject = new ConnectorTreeObject(viewer, (Connector) databaseObject, false);
} else if (databaseObject instanceof Sequence) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_SEQUENCES;
databaseObjectTreeObject = new SequenceTreeObject(viewer, (Sequence) databaseObject, false);
} else if (databaseObject instanceof MobileApplication) {
databaseObjectTreeObject = new MobileApplicationTreeObject(viewer, (MobileApplication) databaseObject, false);
} else if (databaseObject instanceof MobilePlatform) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_PLATFORMS;
databaseObjectTreeObject = new MobilePlatformTreeObject(viewer, (MobilePlatform) databaseObject, false);
} else /**
***********************************************************************************************
*/
if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.MobileComponent) {
if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.ApplicationComponent) {
databaseObjectTreeObject = new MobileApplicationComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.RouteComponent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_ROUTES;
databaseObjectTreeObject = new MobileRouteComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_EVENTS;
databaseObjectTreeObject = new MobileRouteEventComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.RouteActionComponent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_ACTIONS;
databaseObjectTreeObject = new MobileRouteActionComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.PageComponent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_PAGES;
databaseObjectTreeObject = new MobilePageComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIActionStack) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_SHARED_ACTIONS;
databaseObjectTreeObject = new MobileUIComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UISharedComponent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_SHARED_COMPONENTS;
databaseObjectTreeObject = new MobileUIComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIDynamicMenu) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_MENUS;
databaseObjectTreeObject = new MobileUIComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIComponent) {
if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIAttribute) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_ATTRIBUTES;
if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIControlAttr) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_CONTROLS;
}
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIStyle) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_STYLES;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIControlVariable) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_VARIABLES;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UICompVariable) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_VARIABLES;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIStackVariable) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_VARIABLES;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIFormValidator) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_VALIDATORS;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIAppEvent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_EVENTS;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIPageEvent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_EVENTS;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.mobile.components.UIEventSubscriber) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_EVENTS;
}
databaseObjectTreeObject = new MobileUIComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
}
} else /**
***********************************************************************************************
*/
if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.MobileComponent) {
if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.ApplicationComponent) {
databaseObjectTreeObject = new NgxApplicationComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.PageComponent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_PAGES;
databaseObjectTreeObject = new NgxPageComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIActionStack) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_SHARED_ACTIONS;
databaseObjectTreeObject = new NgxUIComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UISharedComponent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_SHARED_COMPONENTS;
databaseObjectTreeObject = new NgxUIComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIDynamicMenu) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_MENUS;
databaseObjectTreeObject = new NgxUIComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIComponent) {
if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIAttribute) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_ATTRIBUTES;
if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIControlAttr) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_CONTROLS;
}
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIDynamicAttr) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_ATTRIBUTES;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIStyle) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_STYLES;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIControlVariable) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_VARIABLES;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UICompVariable) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_VARIABLES;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIStackVariable) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_VARIABLES;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIAppEvent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_EVENTS;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIPageEvent) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_EVENTS;
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.ngx.components.UIEventSubscriber) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_EVENTS;
}
databaseObjectTreeObject = new NgxUIComponentTreeObject(viewer, GenericUtils.cast(databaseObject), false);
}
} else if (databaseObject instanceof UrlMapper) {
databaseObjectTreeObject = new UrlMapperTreeObject(viewer, (UrlMapper) databaseObject, false);
} else if (databaseObject instanceof UrlAuthentication) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_AUTHENTICATIONS;
databaseObjectTreeObject = new UrlAuthenticationTreeObject(viewer, (UrlAuthentication) databaseObject, false);
} else if (databaseObject instanceof UrlMapping) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_MAPPINGS;
databaseObjectTreeObject = new UrlMappingTreeObject(viewer, (UrlMapping) databaseObject, false);
} else if (databaseObject instanceof UrlMappingOperation) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_OPERATIONS;
databaseObjectTreeObject = new UrlMappingOperationTreeObject(viewer, (UrlMappingOperation) databaseObject, false);
} else if (databaseObject instanceof UrlMappingParameter) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_PARAMETERS;
databaseObjectTreeObject = new UrlMappingParameterTreeObject(viewer, (UrlMappingParameter) databaseObject, false);
} else if (databaseObject instanceof UrlMappingResponse) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_RESPONSES;
databaseObjectTreeObject = new UrlMappingResponseTreeObject(viewer, (UrlMappingResponse) databaseObject, false);
} else if (databaseObject instanceof Reference) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_REFERENCES;
databaseObjectTreeObject = new ReferenceTreeObject(viewer, (Reference) databaseObject, false);
} else if (databaseObject instanceof Pool) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_POOLS;
databaseObjectTreeObject = new DatabaseObjectTreeObject(viewer, databaseObject, false);
} else if (databaseObject instanceof Transaction) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_TRANSACTIONS;
databaseObjectTreeObject = new TransactionTreeObject(viewer, (Transaction) databaseObject, false);
} else if (databaseObject instanceof ScreenClass) {
if (databaseObject.getParent() instanceof IScreenClassContainer<?>) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_SCREEN_CLASSES;
databaseObjectTreeObject = new ScreenClassTreeObject(viewer, (ScreenClass) databaseObject, false);
} else {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_INHERITED_SCREEN_CLASSES;
databaseObjectTreeObject = new ScreenClassTreeObject(viewer, (ScreenClass) databaseObject, false);
}
} else if (databaseObject instanceof Sheet) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_SHEETS;
databaseObjectTreeObject = new SheetTreeObject(viewer, (Sheet) databaseObject, parentTreeObject.getObject() != databaseObject.getParent());
} else if (databaseObject instanceof TestCase) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_TESTCASES;
databaseObjectTreeObject = new TestCaseTreeObject(viewer, (TestCase) databaseObject, false);
} else if (databaseObject instanceof Variable) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_VARIABLES;
databaseObjectTreeObject = new VariableTreeObject2(viewer, (Variable) databaseObject, false);
} else if (databaseObject instanceof Step) {
if (databaseObject.getParent() instanceof Sequence) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_STEPS;
}
databaseObjectTreeObject = new StepTreeObject(viewer, (Step) databaseObject, false);
} else if (databaseObject instanceof Statement) {
if (databaseObject.getParent() instanceof Transaction) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_FUNCTIONS;
}
databaseObjectTreeObject = new StatementTreeObject(viewer, (Statement) databaseObject, false);
} else if (databaseObject instanceof Criteria) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_CRITERIAS;
databaseObjectTreeObject = new CriteriaTreeObject(viewer, (Criteria) databaseObject, parentTreeObject.getObject() != databaseObject.getParent());
} else if (databaseObject instanceof ExtractionRule) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_EXTRACTION_RULES;
databaseObjectTreeObject = new ExtractionRuleTreeObject(viewer, (ExtractionRule) databaseObject, parentTreeObject.getObject() != databaseObject.getParent());
} else if (databaseObject instanceof BlockFactory) {
databaseObjectTreeObject = new DatabaseObjectTreeObject(viewer, databaseObject, parentTreeObject.getObject() != databaseObject.getParent());
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.core.Document) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_DOCUMENTS;
com.twinsoft.convertigo.beans.core.Document document = (com.twinsoft.convertigo.beans.core.Document) databaseObject;
String documentRenderer = document.getRenderer();
if (documentRenderer.equals("DesignDocumentTreeObject"))
databaseObjectTreeObject = new DesignDocumentTreeObject(viewer, document, false);
else
databaseObjectTreeObject = new DocumentTreeObject(viewer, document, false);
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.core.Listener) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_LISTENERS;
com.twinsoft.convertigo.beans.core.Listener listener = (com.twinsoft.convertigo.beans.core.Listener) databaseObject;
String listenerRenderer = listener.getRenderer();
if (listenerRenderer.equals("FullSyncListenerTreeObject")) {
databaseObjectTreeObject = new FullSyncListenerTreeObject(viewer, listener, false);
} else {
databaseObjectTreeObject = new ListenerTreeObject(viewer, listener, false);
}
} else if (databaseObject instanceof com.twinsoft.convertigo.beans.core.Index) {
folderType = ObjectsFolderTreeObject.FOLDER_TYPE_INDEXES;
databaseObjectTreeObject = new DatabaseObjectTreeObject(viewer, databaseObject, false);
} else {
// unknow DBO case !!!
databaseObjectTreeObject = new DatabaseObjectTreeObject(viewer, databaseObject, false);
}
// no virtual folder
if (folderType == Integer.MIN_VALUE) {
parentTreeObject.addChild(databaseObjectTreeObject);
} else // virtual folder creation or reuse
{
/* fixed #5416 */
// if (currentTreeFolder == null || currentTreeFolder.folderType != folderType) {
// currentTreeFolder = new ObjectsFolderTreeObject(viewer, folderType);
// parentTreeObject.addChild(currentTreeFolder);
// }
currentTreeFolder = getFolder(parentTreeObject, folderType);
currentTreeFolder.addChild(databaseObjectTreeObject);
}
// case databaseObject has been changed through dbo::preconfigure, mark projectTreeObject as modified
if ((databaseObject.bNew) || (databaseObject.hasChanged && !databaseObject.bNew)) {
databaseObjectTreeObject.hasBeenModified(true);
}
// new value of recursion parameters
this.parentTreeObject = databaseObjectTreeObject;
}
// special databaseObject cases
if (databaseObject instanceof Project) {
Project project = (Project) databaseObject;
// Creates directories and files
createDirsAndFiles(project.getName());
// Creates or Refresh xsd and wsdl folders
IFolder xsdFolder, wsdlFolder = null;
IFolder xsdInternalFolder = null;
try {
wsdlFolder = ((ProjectTreeObject) parentTreeObject).getFolder("wsdl");
if (!wsdlFolder.exists())
wsdlFolder.create(true, true, null);
else
wsdlFolder.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
xsdFolder = ((ProjectTreeObject) parentTreeObject).getFolder("xsd");
if (!xsdFolder.exists())
xsdFolder.create(true, true, null);
else {
xsdInternalFolder = xsdFolder.getFolder("internal");
if (!xsdInternalFolder.exists())
xsdInternalFolder.create(true, true, null);
xsdFolder.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
}
} catch (Exception e) {
e.printStackTrace();
}
// Connectors
IFolder xsdConnectorInternalFolder = null;
Collection<Connector> connectors = project.getConnectorsList();
if (connectors.size() != 0) {
// Set default connector if none
if (project.getDefaultConnector() == null) {
// Report from 4.5: fix #401
ConvertigoPlugin.logWarning(null, "Project \"" + project.getName() + "\" has no default connector. Try to set a default one.");
Connector defaultConnector = connectors.iterator().next();
try {
project.setDefaultConnector(defaultConnector);
defaultConnector.hasChanged = true;
} catch (Exception e) {
ConvertigoPlugin.logWarning(e, "Unable to set a default connector for project \"" + project.getName() + "\"");
}
}
// Refresh Traces folder
IFolder ifolder = ((ProjectTreeObject) parentTreeObject).getFolder("Traces");
if (ifolder.exists()) {
try {
ifolder.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
} catch (CoreException e) {
}
}
// Creates or Refresh internal xsd connector folders
for (Connector connector : connectors) {
try {
xsdConnectorInternalFolder = xsdInternalFolder.getFolder(connector.getName());
if (!xsdConnectorInternalFolder.exists())
xsdConnectorInternalFolder.create(true, true, null);
else
xsdConnectorInternalFolder.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
} catch (Exception e) {
e.printStackTrace();
}
}
}
} else if (databaseObject instanceof Connector) {
Connector connector = (Connector) databaseObject;
// Open connector editor
if (projectLoadingJob != null && connector.isDefault) {
projectLoadingJob.setDefaultConnectorTreeObject((ConnectorTreeObject) databaseObjectTreeObject);
}
// Traces
if (connector instanceof JavelinConnector) {
String projectName = databaseObject.getProject().getName();
if (projectLoadingJob == null) {
if (MigrationManager.isProjectMigrated(projectName)) {
UnloadedProjectTreeObject unloadedProjectTreeObject = new UnloadedProjectTreeObject(databaseObjectTreeObject.viewer, projectName);
this.projectLoadingJob = new ProjectLoadingJob(databaseObjectTreeObject.viewer, unloadedProjectTreeObject);
this.projectLoadingJob.loadTrace(databaseObjectTreeObject, new File(Engine.projectDir(projectName) + "/Traces/" + connector.getName()));
}
}
if (projectLoadingJob != null) {
projectLoadingJob.loadTrace(databaseObjectTreeObject, new File(Engine.projectDir(projectName) + "/Traces/" + connector.getName()));
}
}
} else if (databaseObject instanceof Transaction) {
Transaction transaction = (Transaction) databaseObject;
// Functions
List<HandlersDeclarationTreeObject> treeObjects = new LinkedList<HandlersDeclarationTreeObject>();
String line, lineReaded;
int lineNumber = 0;
BufferedReader br = new BufferedReader(new StringReader(transaction.handlers));
line = br.readLine();
while (line != null) {
lineReaded = line.trim();
lineNumber++;
if (lineReaded.startsWith("function ")) {
try {
String functionName = lineReaded.substring(9, lineReaded.indexOf(')') + 1);
HandlersDeclarationTreeObject handlersDeclarationTreeObject = null;
if (functionName.endsWith(JavelinTransaction.EVENT_ENTRY_HANDLER + "()")) {
handlersDeclarationTreeObject = new HandlersDeclarationTreeObject(viewer, functionName, HandlersDeclarationTreeObject.TYPE_FUNCTION_SCREEN_CLASS_ENTRY, lineNumber);
} else if (functionName.endsWith(JavelinTransaction.EVENT_EXIT_HANDLER + "()")) {
handlersDeclarationTreeObject = new HandlersDeclarationTreeObject(viewer, functionName, HandlersDeclarationTreeObject.TYPE_FUNCTION_SCREEN_CLASS_EXIT, lineNumber);
} else {
handlersDeclarationTreeObject = new HandlersDeclarationTreeObject(viewer, functionName, HandlersDeclarationTreeObject.TYPE_OTHER, lineNumber);
}
if (handlersDeclarationTreeObject != null) {
treeObjects.add(handlersDeclarationTreeObject);
}
} catch (StringIndexOutOfBoundsException e) {
throw new EngineException("Exception in reading line of a transaction", e);
}
}
line = br.readLine();
}
if (treeObjects.size() != 0) {
ObjectsFolderTreeObject objectsFolderTreeObject = new ObjectsFolderTreeObject(viewer, ObjectsFolderTreeObject.FOLDER_TYPE_FUNCTIONS);
databaseObjectTreeObject.addChild(objectsFolderTreeObject);
for (HandlersDeclarationTreeObject handlersDeclarationTreeObject : treeObjects) {
objectsFolderTreeObject.addChild(handlersDeclarationTreeObject);
}
}
} else if (databaseObject instanceof Sheet) {
addTemplates((Sheet) databaseObject, databaseObjectTreeObject);
} else if (databaseObject instanceof ITablesProperty) {
ITablesProperty iTablesProperty = (ITablesProperty) databaseObject;
String[] tablePropertyNames = iTablesProperty.getTablePropertyNames();
for (int i = 0; i < tablePropertyNames.length; i++) {
String tablePropertyName = tablePropertyNames[i];
String tableRenderer = iTablesProperty.getTableRenderer(tablePropertyName);
XMLVector<XMLVector<Object>> xmlv = iTablesProperty.getTableData(tablePropertyName);
if (tableRenderer.equals("XMLTableDescriptionTreeObject")) {
XMLTableDescriptionTreeObject propertyXMLTableTreeObject = new XMLTableDescriptionTreeObject(viewer, tablePropertyName, xmlv, databaseObjectTreeObject);
databaseObjectTreeObject.addChild(propertyXMLTableTreeObject);
} else if (tableRenderer.equals("XMLRecordDescriptionTreeObject")) {
XMLRecordDescriptionTreeObject propertyXMLRecordTreeObject = new XMLRecordDescriptionTreeObject(viewer, tablePropertyName, xmlv, databaseObjectTreeObject);
databaseObjectTreeObject.addChild(propertyXMLRecordTreeObject);
}
}
}
monitor.worked(1);
// children cannot be added in the current virtual folder
this.currentTreeFolder = null;
super.walk(databaseObject);
// restore recursion parameters
this.parentTreeObject = parentTreeObject;
this.projectLoadingJob = projectLoadingJob;
// restore sibling parameters
this.currentTreeFolder = currentTreeFolder;
}
}.init(parentDatabaseObject, parentTreeObject, projectLoadingJob);
} catch (EngineException e) {
throw e;
} catch (Exception e) {
throw new EngineException("Exception in copyDatabaseObject", e);
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject in project convertigo by convertigo.
the class SequenceExecuteSelectedFromStubAction 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 SequenceTreeObject)) {
SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) treeObject;
openEditors(explorerView, sequenceTreeObject);
Sequence sequence = sequenceTreeObject.getObject();
ProjectTreeObject projectTreeObject = sequenceTreeObject.getProjectTreeObject();
SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
if (sequenceEditor != null) {
getActivePage().activate(sequenceEditor);
sequenceEditor.getDocument(sequence.getName(), true);
}
}
}
} 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.SequenceTreeObject in project convertigo by convertigo.
the class SequenceExecuteSelectedFromStubAction method openEditors.
private void openEditors(ProjectExplorerView explorerView, List<Step> steps) {
for (Step step : steps) {
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 (step.getSequence().equals(sequenceStep.getSequenceName()))
// avoid sequence recursion
return;
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);
} 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());
}
}
}
Aggregations