Search in sources :

Example 1 with NgxUIComponentTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject in project convertigo by convertigo.

the class TreeDropAdapter method performDrop.

private void performDrop(Object data, final ProjectExplorerView explorerView, TreeObject targetTreeObject) throws EngineException, IOException {
    boolean needReload = false;
    final DatabaseObject dbo;
    if (data instanceof String) {
        String source = data.toString();
        if (targetTreeObject instanceof ObjectsFolderTreeObject) {
            ObjectsFolderTreeObject folderTreeObject = (ObjectsFolderTreeObject) targetTreeObject;
            dbo = (DatabaseObject) folderTreeObject.getParent().getObject();
            switch(folderTreeObject.folderType) {
                case ObjectsFolderTreeObject.FOLDER_TYPE_CRITERIAS:
                    if (dbo instanceof HtmlScreenClass) {
                        // Creates a XPath criteria for this screen class
                        if (!dbo.equals(((HtmlConnector) dbo.getConnector()).getDefaultScreenClass())) {
                            ((HtmlScreenClass) dbo).addCriteria(createXPath(source));
                            needReload = true;
                        }
                    }
                    break;
                case ObjectsFolderTreeObject.FOLDER_TYPE_INHERITED_SCREEN_CLASSES:
                    if (dbo instanceof HtmlScreenClass) {
                        // Creates an inherited screen class with an XPath criteria for this screen class
                        HtmlScreenClass newSc = createHtmlScreenClass(dbo.priority + 1);
                        ((HtmlScreenClass) dbo).addInheritedScreenClass(newSc);
                        newSc.addCriteria(createXPath(source));
                        needReload = true;
                    }
                    break;
                case ObjectsFolderTreeObject.FOLDER_TYPE_EXTRACTION_RULES:
                    if (dbo instanceof HtmlScreenClass) {
                        NewObjectWizard newObjectWizard = new NewObjectWizard(dbo, "com.twinsoft.convertigo.beans.core.ExtractionRule", source, null);
                        WizardDialog wzdlg = new WizardDialog(Display.getDefault().getActiveShell(), newObjectWizard);
                        wzdlg.setPageSize(850, 650);
                        wzdlg.open();
                        needReload = true;
                    }
                    break;
                default:
                    break;
            }
            if (needReload)
                reloadTreeObject(explorerView, folderTreeObject.getParent());
        } else if (targetTreeObject instanceof DatabaseObjectTreeObject) {
            DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) targetTreeObject;
            dbo = (DatabaseObject) targetTreeObject.getObject();
            if (databaseObjectTreeObject instanceof ScreenClassTreeObject) {
                if (dbo instanceof HtmlScreenClass) {
                    // Creates an inherited screen class with an XPath criteria for this screen class
                    HtmlScreenClass newSc = createHtmlScreenClass(dbo.priority + 1);
                    ((HtmlScreenClass) dbo).addInheritedScreenClass(newSc);
                    newSc.addCriteria(createXPath(source));
                    needReload = true;
                }
            } else if (dbo instanceof IXPathable) {
                // Set XPath property
                if (dbo instanceof XpathableStatement)
                    ((XpathableStatement) dbo).setPureXpath(source);
                else
                    ((IXPathable) dbo).setXpath(source);
                ((DatabaseObject) dbo).hasChanged = true;
                needReload = true;
            }
            if (needReload)
                reloadTreeObject(explorerView, databaseObjectTreeObject);
        } else if (targetTreeObject instanceof IPropertyTreeObject) {
            IPropertyTreeObject pto = null;
            if (detail == DND.DROP_MOVE) {
                // Set XPath property
                if (targetTreeObject instanceof IXPathable) {
                    ((IXPathable) targetTreeObject).setXpath("." + source);
                    needReload = true;
                } else // Add new row with xpath
                if (targetTreeObject instanceof PropertyTableTreeObject) {
                    // // See Ticket #679 : Drag and drop without Control
                    // PropertyTableTreeObject description = (PropertyTableTreeObject)targetTreeObject;
                    // pto = description.addNewRow();
                    // needReload = true;
                    // if ((pto != null) && (pto instanceof IXPathable)) {
                    // ((IXPathable)pto).setXpath("."+source);
                    // }
                    String label = ((PropertyTableTreeObject) targetTreeObject).getRowDefaultLabel().toLowerCase();
                    throw new EngineException("Please hold on the 'Ctrl' key while dragging to create a new " + label);
                }
            } else if (detail == DND.DROP_COPY) {
                // Add new row with xpath
                if (targetTreeObject instanceof PropertyTableTreeObject) {
                    PropertyTableTreeObject description = (PropertyTableTreeObject) targetTreeObject;
                    pto = description.addNewRow();
                    needReload = true;
                    if ((pto != null) && (pto instanceof IXPathable)) {
                        ((IXPathable) pto).setXpath("." + source);
                    }
                } else // Add new column with xpath
                if (targetTreeObject instanceof PropertyTableRowTreeObject) {
                    PropertyTableRowTreeObject row = (PropertyTableRowTreeObject) targetTreeObject;
                    pto = row.addNewColumn();
                    needReload = true;
                    if ((pto != null) && (pto instanceof IXPathable)) {
                        ((IXPathable) pto).setXpath("." + source);
                    }
                }
            }
            if (needReload) {
                pto = (pto == null) ? (IPropertyTreeObject) targetTreeObject : pto;
                targetTreeObject = ((IPropertyTreeObject) targetTreeObject).getTreeObjectOwner();
                if (targetTreeObject instanceof DatabaseObjectTreeObject) {
                    // reloadTreeObject(explorerView, targetTreeObject);
                    TreeParent treeParent = targetTreeObject.getParent();
                    if (treeParent instanceof FolderTreeObject)
                        treeParent = treeParent.getParent();
                    explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), pto.getPath()));
                }
            }
        }
    } else if (data instanceof StepSource) {
        if (targetTreeObject instanceof DatabaseObjectTreeObject) {
            final DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) targetTreeObject;
            dbo = (DatabaseObject) targetTreeObject.getObject();
            final Set<PropertyDescriptor> propertyDescriptors = new TreeSet<PropertyDescriptor>(new Comparator<PropertyDescriptor>() {

                @Override
                public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {
                    return o1.getDisplayName().compareTo(o2.getDisplayName());
                }
            });
            propertyDescriptors.addAll(CachedIntrospector.getPropertyDescriptors(dbo, Property.smartType));
            propertyDescriptors.addAll(CachedIntrospector.getPropertyDescriptors(dbo, Property.sourceDefinition));
            propertyDescriptors.addAll(CachedIntrospector.getPropertyDescriptors(dbo, Property.sourcesDefinition));
            if (!propertyDescriptors.isEmpty()) {
                // Retrieve Source definition
                final XMLVector<String> sourceDefinition = new XMLVector<String>(2);
                sourceDefinition.add(((StepSource) data).getPriority());
                sourceDefinition.add(((StepSource) data).getXpath());
                SelectionListener selectionListener = new SelectionListener() {

                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        PropertyDescriptor propertyDescriptor = (e == null) ? propertyDescriptors.iterator().next() : (PropertyDescriptor) e.widget.getData();
                        String propertyName = propertyDescriptor.getName();
                        if (propertyDescriptor.getPropertyType().isAssignableFrom(SmartType.class)) {
                            SmartType smartType = new SmartType();
                            smartType.setMode(Mode.SOURCE);
                            smartType.setSourceDefinition(sourceDefinition);
                            databaseObjectTreeObject.setPropertyValue(propertyDescriptor.getName(), smartType);
                        } else if (propertyName.equals("sourceDefinition")) {
                            // Use setPropertyValue in order to set object's value and fire necessary events
                            databaseObjectTreeObject.setPropertyValue(propertyDescriptor.getName(), sourceDefinition);
                        } else if (propertyName.equals("sourcesDefinition")) {
                            try {
                                XMLVector<XMLVector<Object>> sourcesDefinition = GenericUtils.cast(propertyDescriptor.getReadMethod().invoke(dbo));
                                // make a copy to make a property change
                                sourcesDefinition = new XMLVector<XMLVector<Object>>(sourcesDefinition);
                                XMLVector<Object> row = new XMLVector<Object>();
                                row.add("");
                                row.add(sourceDefinition);
                                row.add("");
                                sourcesDefinition.add(row);
                                databaseObjectTreeObject.setPropertyValue(propertyName, sourcesDefinition);
                            } catch (Exception ex) {
                                ConvertigoPlugin.logError("failed to add to sourcesDefinition of " + dbo.getName());
                            }
                        }
                        // Properties view needs to be refreshed
                        refreshPropertiesView(explorerView, databaseObjectTreeObject);
                    }

                    @Override
                    public void widgetDefaultSelected(SelectionEvent e) {
                    }
                };
                if (propertyDescriptors.size() == 1) {
                    selectionListener.widgetSelected(null);
                } else {
                    Shell shell = ConvertigoPlugin.getMainShell();
                    Menu dropMenu = new Menu(shell, SWT.POP_UP);
                    shell.setMenu(dropMenu);
                    for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
                        MenuItem itemCheck = new MenuItem(dropMenu, SWT.NONE);
                        itemCheck.setText(propertyDescriptor.getDisplayName());
                        itemCheck.setData(propertyDescriptor);
                        itemCheck.addSelectionListener(selectionListener);
                    }
                    dropMenu.setVisible(true);
                }
            }
        }
    } else if (data instanceof PaletteSource) {
        try {
            if (targetTreeObject instanceof ObjectsFolderTreeObject) {
                ObjectsFolderTreeObject folderTreeObject = (ObjectsFolderTreeObject) targetTreeObject;
                targetTreeObject = folderTreeObject.getParent();
            }
            if (targetTreeObject instanceof DatabaseObjectTreeObject) {
                DatabaseObject parent = (DatabaseObject) targetTreeObject.getObject();
                String xmlData = ((PaletteSource) data).getXmlData();
                Document document = XMLUtils.getDefaultDocumentBuilder().parse(new InputSource(new StringReader(xmlData)));
                Element rootElement = document.getDocumentElement();
                NodeList nodeList = rootElement.getChildNodes();
                int len = nodeList.getLength();
                Node node;
                // Special objects move from palette
                if (detail == DND.DROP_MOVE) {
                    for (int i = 0; i < len; i++) {
                        node = (Node) nodeList.item(i);
                        if (node.getNodeType() != Node.TEXT_NODE) {
                            if (paste(node, parent, true) == null) {
                                throw new Exception();
                            }
                        }
                    }
                    reloadTreeObject(explorerView, targetTreeObject);
                }
            } else {
                throw new Exception();
            }
        } catch (Exception ex) {
            ConvertigoPlugin.logError("failed to add from palette");
        }
    } else if (data instanceof MobileSource) {
        try {
            String jsonString = ((MobileSource) data).getJsonString();
            if (targetTreeObject instanceof MobileUIComponentTreeObject) {
                Shell shell = ConvertigoPlugin.getMainShell();
                Menu dropMenu = new Menu(shell, SWT.POP_UP);
                shell.setMenu(dropMenu);
                MobileUIComponentTreeObject mcto = GenericUtils.cast(targetTreeObject);
                for (IPropertyDescriptor descriptor : mcto.getPropertyDescriptors()) {
                    if (descriptor instanceof MobileSmartSourcePropertyDescriptor) {
                        MobileSmartSourcePropertyDescriptor cspd = GenericUtils.cast(descriptor);
                        if (!cspd.isReadOnly()) {
                            String propertyName = (String) cspd.getId();
                            String propertyLabel = (String) cspd.getDisplayName();
                            MenuItem itemCheck = new MenuItem(dropMenu, SWT.NONE);
                            itemCheck.setText(propertyLabel);
                            itemCheck.addSelectionListener(new SelectionListener() {

                                @Override
                                public void widgetSelected(SelectionEvent e) {
                                    com.twinsoft.convertigo.beans.mobile.components.MobileSmartSourceType cst = new com.twinsoft.convertigo.beans.mobile.components.MobileSmartSourceType();
                                    cst.setMode(com.twinsoft.convertigo.beans.mobile.components.MobileSmartSourceType.Mode.SOURCE);
                                    cst.setSmartValue(jsonString);
                                    mcto.setPropertyValue(propertyName, cst);
                                    refreshPropertiesView(explorerView, mcto);
                                }

                                @Override
                                public void widgetDefaultSelected(SelectionEvent e) {
                                }
                            });
                        }
                    }
                }
                dropMenu.setVisible(true);
            }
            if (targetTreeObject instanceof NgxUIComponentTreeObject) {
                Shell shell = ConvertigoPlugin.getMainShell();
                Menu dropMenu = new Menu(shell, SWT.POP_UP);
                shell.setMenu(dropMenu);
                NgxUIComponentTreeObject mcto = GenericUtils.cast(targetTreeObject);
                for (IPropertyDescriptor descriptor : mcto.getPropertyDescriptors()) {
                    if (descriptor instanceof NgxSmartSourcePropertyDescriptor) {
                        NgxSmartSourcePropertyDescriptor cspd = GenericUtils.cast(descriptor);
                        if (!cspd.isReadOnly()) {
                            String propertyName = (String) cspd.getId();
                            String propertyLabel = (String) cspd.getDisplayName();
                            MenuItem itemCheck = new MenuItem(dropMenu, SWT.NONE);
                            itemCheck.setText(propertyLabel);
                            itemCheck.addSelectionListener(new SelectionListener() {

                                @Override
                                public void widgetSelected(SelectionEvent e) {
                                    com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType cst = new com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType();
                                    cst.setMode(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSourceType.Mode.SOURCE);
                                    cst.setSmartValue(jsonString);
                                    mcto.setPropertyValue(propertyName, cst);
                                    refreshPropertiesView(explorerView, mcto);
                                }

                                @Override
                                public void widgetDefaultSelected(SelectionEvent e) {
                                }
                            });
                        }
                    }
                }
                dropMenu.setVisible(true);
            } else {
                throw new Exception();
            }
        } catch (Exception ex) {
            ConvertigoPlugin.logError("failed to add mobile source");
        }
    }
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) InputSource(org.xml.sax.InputSource) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) XMLVector(com.twinsoft.convertigo.beans.common.XMLVector) Node(org.w3c.dom.Node) EngineException(com.twinsoft.convertigo.engine.EngineException) Document(org.w3c.dom.Document) Comparator(java.util.Comparator) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) HtmlScreenClass(com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass) IXPathable(com.twinsoft.convertigo.beans.core.IXPathable) NodeList(org.w3c.dom.NodeList) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) IOrderableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IOrderableTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) MobileComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject) SelectionListener(org.eclipse.swt.events.SelectionListener) Set(java.util.Set) TreeSet(java.util.TreeSet) MobileSmartSourcePropertyDescriptor(com.twinsoft.convertigo.eclipse.property_editors.MobileSmartSourcePropertyDescriptor) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) Element(org.w3c.dom.Element) NgxSmartSourcePropertyDescriptor(com.twinsoft.convertigo.eclipse.property_editors.NgxSmartSourcePropertyDescriptor) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) NewObjectWizard(com.twinsoft.convertigo.eclipse.wizards.new_object.NewObjectWizard) Shell(org.eclipse.swt.widgets.Shell) StringReader(java.io.StringReader) Menu(org.eclipse.swt.widgets.Menu) SmartType(com.twinsoft.convertigo.beans.steps.SmartType) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) XpathableStatement(com.twinsoft.convertigo.beans.statements.XpathableStatement) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) PropertyDescriptor(java.beans.PropertyDescriptor) NgxSmartSourcePropertyDescriptor(com.twinsoft.convertigo.eclipse.property_editors.NgxSmartSourcePropertyDescriptor) MobileSmartSourcePropertyDescriptor(com.twinsoft.convertigo.eclipse.property_editors.MobileSmartSourcePropertyDescriptor) IPropertyDescriptor(org.eclipse.ui.views.properties.IPropertyDescriptor) MenuItem(org.eclipse.swt.widgets.MenuItem) IOException(java.io.IOException) ObjectWithSameNameException(com.twinsoft.convertigo.engine.ObjectWithSameNameException) SAXException(org.xml.sax.SAXException) EngineException(com.twinsoft.convertigo.engine.EngineException) InvalidOperationException(com.twinsoft.convertigo.engine.InvalidOperationException) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) IPropertyDescriptor(org.eclipse.ui.views.properties.IPropertyDescriptor) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) WizardDialog(org.eclipse.jface.wizard.WizardDialog) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject)

Example 2 with NgxUIComponentTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject 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;
    }
}
Also used : NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeItem(org.eclipse.swt.widgets.TreeItem) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) Rectangle(org.eclipse.swt.graphics.Rectangle) EngineException(com.twinsoft.convertigo.engine.EngineException) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ISelectionListener(org.eclipse.ui.ISelectionListener) CustomDialog(com.twinsoft.convertigo.eclipse.dialogs.CustomDialog) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) Tree(org.eclipse.swt.widgets.Tree) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) ButtonSpec(com.twinsoft.convertigo.eclipse.dialogs.ButtonSpec) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) Color(org.eclipse.swt.graphics.Color) IClosableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IClosableTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) MobileBuilder(com.twinsoft.convertigo.engine.mobile.MobileBuilder) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) MobileApplicationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationTreeObject) IClosableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IClosableTreeObject) XMLRecordDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLRecordDescriptionTreeObject) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) UrlMappingTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) MobileApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationComponentTreeObject) UrlMappingOperationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingOperationTreeObject) ReferenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ReferenceTreeObject) HandlersDeclarationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject) UrlMappingResponseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingResponseTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) CriteriaTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) UrlAuthenticationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlAuthenticationTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) MobileRouteActionComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteActionComponentTreeObject) ListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ListenerTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) FullSyncListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) StatementTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StatementTreeObject) NgxApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxApplicationComponentTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) IEditableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IEditableTreeObject) XMLTableDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLTableDescriptionTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) TemplateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TemplateTreeObject) TestCaseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) VariableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.VariableTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) MobilePlatformTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePlatformTreeObject) ExtractionRuleTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ExtractionRuleTreeObject) MobileRouteComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteComponentTreeObject) SheetTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SheetTreeObject) UrlMapperTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMapperTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) DocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DocumentTreeObject) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) MigrationListener(com.twinsoft.convertigo.engine.MigrationListener) TreeDragListener(com.twinsoft.convertigo.eclipse.dnd.TreeDragListener) ISelectionListener(org.eclipse.ui.ISelectionListener) CompositeListener(com.twinsoft.convertigo.eclipse.editors.CompositeListener) DatabaseObjectListener(com.twinsoft.convertigo.engine.DatabaseObjectListener) Listener(org.eclipse.swt.widgets.Listener) EngineListener(com.twinsoft.convertigo.engine.EngineListener) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ITreeViewerListener(org.eclipse.jface.viewers.ITreeViewerListener) IMenuListener(org.eclipse.jface.action.IMenuListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) HandlerStatement(com.twinsoft.convertigo.beans.statements.HandlerStatement) Shell(org.eclipse.swt.widgets.Shell) GC(org.eclipse.swt.graphics.GC) VariableTreeObject2(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.VariableTreeObject2) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) TreeEditor(org.eclipse.swt.custom.TreeEditor) Composite(org.eclipse.swt.widgets.Composite) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) Text(org.eclipse.swt.widgets.Text) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable) IEditorPart(org.eclipse.ui.IEditorPart) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) EngineEvent(com.twinsoft.convertigo.engine.EngineEvent) TreeExpansionEvent(org.eclipse.jface.viewers.TreeExpansionEvent) DatabaseObjectImportedEvent(com.twinsoft.convertigo.engine.DatabaseObjectImportedEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) DatabaseObjectLoadedEvent(com.twinsoft.convertigo.engine.DatabaseObjectLoadedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) Event(org.eclipse.swt.widgets.Event) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) IEditorInput(org.eclipse.ui.IEditorInput) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)

Example 3 with NgxUIComponentTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject 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);
    }
}
Also used : NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) XMLVector(com.twinsoft.convertigo.beans.common.XMLVector) BlockFactory(com.twinsoft.convertigo.beans.core.BlockFactory) ScreenClass(com.twinsoft.convertigo.beans.core.ScreenClass) EngineException(com.twinsoft.convertigo.engine.EngineException) Document(org.w3c.dom.Document) MobilePlatformTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePlatformTreeObject) UrlMappingTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingTreeObject) Pool(com.twinsoft.convertigo.beans.core.Pool) ExtractionRuleTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ExtractionRuleTreeObject) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) TestCaseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject) UrlMapperTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMapperTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) IProject(org.eclipse.core.resources.IProject) Project(com.twinsoft.convertigo.beans.core.Project) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) StatementTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StatementTreeObject) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) MobileApplicationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationTreeObject) IClosableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IClosableTreeObject) XMLRecordDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLRecordDescriptionTreeObject) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) UrlMappingTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) MobileApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationComponentTreeObject) UrlMappingOperationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingOperationTreeObject) ReferenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ReferenceTreeObject) HandlersDeclarationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject) UrlMappingResponseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingResponseTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) CriteriaTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) UrlAuthenticationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlAuthenticationTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) MobileRouteActionComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteActionComponentTreeObject) ListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ListenerTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) FullSyncListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) StatementTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StatementTreeObject) NgxApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxApplicationComponentTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) IEditableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IEditableTreeObject) XMLTableDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLTableDescriptionTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) TemplateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TemplateTreeObject) TestCaseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) VariableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.VariableTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) MobilePlatformTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePlatformTreeObject) ExtractionRuleTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ExtractionRuleTreeObject) MobileRouteComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteComponentTreeObject) SheetTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SheetTreeObject) UrlMapperTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMapperTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) DocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DocumentTreeObject) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) MobileApplicationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationTreeObject) IClosableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IClosableTreeObject) XMLRecordDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLRecordDescriptionTreeObject) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) UrlMappingTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) MobileApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationComponentTreeObject) UrlMappingOperationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingOperationTreeObject) ReferenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ReferenceTreeObject) HandlersDeclarationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject) UrlMappingResponseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingResponseTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) CriteriaTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) UrlAuthenticationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlAuthenticationTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) MobileRouteActionComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteActionComponentTreeObject) ListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ListenerTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) FullSyncListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) StatementTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StatementTreeObject) NgxApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxApplicationComponentTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) IEditableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IEditableTreeObject) XMLTableDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLTableDescriptionTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) TemplateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TemplateTreeObject) TestCaseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TestCaseTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) VariableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.VariableTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) MobilePlatformTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePlatformTreeObject) ExtractionRuleTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ExtractionRuleTreeObject) MobileRouteComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteComponentTreeObject) SheetTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SheetTreeObject) UrlMapperTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMapperTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TraceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject) DocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DocumentTreeObject) ListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ListenerTreeObject) FullSyncListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject) IScreenClassContainer(com.twinsoft.convertigo.beans.core.IScreenClassContainer) CriteriaTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject) ExtractionRule(com.twinsoft.convertigo.beans.core.ExtractionRule) WalkHelper(com.twinsoft.convertigo.engine.helpers.WalkHelper) Criteria(com.twinsoft.convertigo.beans.core.Criteria) SheetTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SheetTreeObject) StringReader(java.io.StringReader) VariableTreeObject2(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.VariableTreeObject2) UrlMapper(com.twinsoft.convertigo.beans.core.UrlMapper) UrlMappingOperation(com.twinsoft.convertigo.beans.core.UrlMappingOperation) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) ProjectSchemaReference(com.twinsoft.convertigo.beans.references.ProjectSchemaReference) IEditorReference(org.eclipse.ui.IEditorReference) Reference(com.twinsoft.convertigo.beans.core.Reference) Statement(com.twinsoft.convertigo.beans.core.Statement) HandlerStatement(com.twinsoft.convertigo.beans.statements.HandlerStatement) FunctionStatement(com.twinsoft.convertigo.beans.statements.FunctionStatement) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) TestCase(com.twinsoft.convertigo.beans.core.TestCase) ReferenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ReferenceTreeObject) BufferedReader(java.io.BufferedReader) UrlMappingOperationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingOperationTreeObject) UrlAuthentication(com.twinsoft.convertigo.beans.core.UrlAuthentication) IFolder(org.eclipse.core.resources.IFolder) UrlMapping(com.twinsoft.convertigo.beans.core.UrlMapping) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) NgxApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxApplicationComponentTreeObject) MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) HandlersDeclarationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) ListenerList(org.eclipse.core.runtime.ListenerList) LinkedList(java.util.LinkedList) NodeList(org.w3c.dom.NodeList) ArrayList(java.util.ArrayList) EventListenerList(javax.swing.event.EventListenerList) List(java.util.List) XMLTableDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLTableDescriptionTreeObject) MobileRouteComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteComponentTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) FullSyncListenerTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FullSyncListenerTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) MobilePlatform(com.twinsoft.convertigo.beans.core.MobilePlatform) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) Transaction(com.twinsoft.convertigo.beans.core.Transaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) CoreException(org.eclipse.core.runtime.CoreException) XMLRecordDescriptionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.XMLRecordDescriptionTreeObject) Collection(java.util.Collection) IFile(org.eclipse.core.resources.IFile) File(java.io.File) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) UrlMappingResponseTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingResponseTreeObject) Variable(com.twinsoft.convertigo.beans.core.Variable) StepVariable(com.twinsoft.convertigo.beans.variables.StepVariable) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable) MigrationListener(com.twinsoft.convertigo.engine.MigrationListener) TreeDragListener(com.twinsoft.convertigo.eclipse.dnd.TreeDragListener) ISelectionListener(org.eclipse.ui.ISelectionListener) CompositeListener(com.twinsoft.convertigo.eclipse.editors.CompositeListener) DatabaseObjectListener(com.twinsoft.convertigo.engine.DatabaseObjectListener) Listener(org.eclipse.swt.widgets.Listener) EngineListener(com.twinsoft.convertigo.engine.EngineListener) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ITreeViewerListener(org.eclipse.jface.viewers.ITreeViewerListener) IMenuListener(org.eclipse.jface.action.IMenuListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) UrlMappingParameter(com.twinsoft.convertigo.beans.core.UrlMappingParameter) MobileApplicationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationTreeObject) UrlMappingResponse(com.twinsoft.convertigo.beans.core.UrlMappingResponse) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) DocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DocumentTreeObject) FunctionStep(com.twinsoft.convertigo.beans.steps.FunctionStep) Step(com.twinsoft.convertigo.beans.core.Step) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) MobileRouteActionComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteActionComponentTreeObject) MobileApplicationComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileApplicationComponentTreeObject) ITablesProperty(com.twinsoft.convertigo.beans.core.ITablesProperty) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) UrlAuthenticationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlAuthenticationTreeObject) IOException(java.io.IOException) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) InvocationTargetException(java.lang.reflect.InvocationTargetException) EngineException(com.twinsoft.convertigo.engine.EngineException) Point(org.eclipse.swt.graphics.Point) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Sheet(com.twinsoft.convertigo.beans.core.Sheet)

Example 4 with NgxUIComponentTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject in project convertigo by convertigo.

the class NgxPickerComposite method setCurrentInput.

public void setCurrentInput(Object selected, String source) {
    if (isUpdating)
        return;
    currentMC = null;
    setWidgetsEnabled(true);
    if (selected instanceof NgxComponentTreeObject) {
        UIComponent uic = null;
        if (selected instanceof NgxPageComponentTreeObject) {
            currentMC = ((NgxPageComponentTreeObject) selected).getObject();
        } else if (selected instanceof NgxUIComponentTreeObject) {
            uic = ((NgxUIComponentTreeObject) selected).getObject();
            // currentMC = uic.getPage() != null ? uic.getPage() : (uic.getMenu() != null ?  uic.getMenu() : uic.getApplication());
            currentMC = currentMC == null ? uic.getPage() : currentMC;
            currentMC = currentMC == null ? uic.getMenu() : currentMC;
            currentMC = currentMC == null ? uic.getSharedAction() : currentMC;
            currentMC = currentMC == null ? uic.getSharedComponent() : currentMC;
            currentMC = currentMC == null ? uic.getApplication() : currentMC;
        }
        if (currentMC == null) {
            resetViewers();
        } else {
            if (!currentMC.equals(checkboxTreeViewer.getInput())) {
                resetViewers();
                checkboxTreeViewer.setInput(currentMC);
                initTreeSelection(checkboxTreeViewer, null);
            }
            MobileSmartSource cs = MobileSmartSource.valueOf(source);
            if (cs != null) {
                NgxPickerContentProvider contentProvider = (NgxPickerContentProvider) checkboxTreeViewer.getContentProvider();
                if (isParentDialog) {
                    // when dbo's property edition
                    contentProvider.setSelectedDbo(uic);
                }
                ToolItem buttonToSelect = btnSequence;
                currentSource = source;
                Filter filter = cs.getFilter();
                if (Filter.Sequence.equals(filter)) {
                    buttonToSelect = btnSequence;
                }
                if (Filter.Database.equals(filter)) {
                    buttonToSelect = btnDatabase;
                }
                if (Filter.Action.equals(filter)) {
                    buttonToSelect = btnAction;
                }
                if (Filter.Shared.equals(filter)) {
                    buttonToSelect = btnShared;
                }
                if (Filter.Iteration.equals(filter)) {
                    buttonToSelect = btnIteration;
                }
                if (Filter.Form.equals(filter)) {
                    buttonToSelect = btnForm;
                }
                if (Filter.Global.equals(filter)) {
                    buttonToSelect = btnGlobal;
                }
                buttonToSelect.notifyListeners(SWT.Selection, null);
            }
        }
        updateMessage();
    } else {
        resetViewers();
        updateMessage();
    }
}
Also used : NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileSmartSource(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) NgxPageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject) Filter(com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.Filter) UIComponent(com.twinsoft.convertigo.beans.ngx.components.UIComponent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 5 with NgxUIComponentTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject in project convertigo by convertigo.

the class TreeDropAdapter method validateDrop.

/* (non-Javadoc)
	 * @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
	 */
@Override
public boolean validateDrop(Object target, int operation, TransferData transferType) {
    if (TextTransfer.getInstance().isSupportedType(transferType)) {
        if (getCurrentOperation() == DND.DROP_MOVE) {
            Object targetObject = getCurrentTarget();
            Object sourceObject = getSelectedObject();
            if (targetObject != null && targetObject instanceof TreeObject) {
                TreeObject targetTreeObject = (TreeObject) targetObject;
                if (sourceObject != null && sourceObject instanceof TreeObject) {
                    TreeObject sourceTreeObject = (TreeObject) sourceObject;
                    boolean isFocus = sourceTreeObject.viewer.getControl().isFocusControl();
                    if (isFocus && (sourceObject == targetObject || targetTreeObject.isChildOf(sourceTreeObject))) {
                        return false;
                    }
                }
                if (targetObject instanceof DatabaseObjectTreeObject) {
                    try {
                        String xmlData = TextTransfer.getInstance().nativeToJava(transferType).toString();
                        List<Object> list = ConvertigoPlugin.clipboardManagerDND.read(xmlData);
                        DatabaseObject databaseObject = (DatabaseObject) list.get(0);
                        DatabaseObject targetDatabaseObject = ((DatabaseObjectTreeObject) target).getObject();
                        if (DatabaseObjectsManager.acceptDatabaseObjects(targetDatabaseObject, databaseObject)) {
                            return true;
                        }
                        DatabaseObject parentDatabaseObject = targetDatabaseObject.getParent();
                        if (parentDatabaseObject != null && DatabaseObjectsManager.acceptDatabaseObjects(parentDatabaseObject, databaseObject)) {
                            return true;
                        }
                        return false;
                    } catch (Exception e) {
                        e.printStackTrace(System.out);
                    }
                }
            }
        }
        return true;
    }
    if (StepSourceTransfer.getInstance().isSupportedType(transferType)) {
        if (target instanceof TreeObject) {
            TreeObject targetTreeObject = (TreeObject) target;
            // Check for drop to a step which contains a stepSource definition
            // if (targetTreeObject.getObject() instanceof IStepSourceContainer) {
            Object ob = targetTreeObject.getObject();
            if (ob instanceof Step && ((Step) ob).canWorkOnSource() || ob instanceof IStepSourceContainer) {
                StepSource stepSource = StepSourceTransfer.getInstance().getStepSource();
                if (stepSource != null) {
                    Step targetStep = (Step) ((ob instanceof StepVariable) ? ((StepVariable) ob).getParent() : ob);
                    // Check for drop to a step in the same sequence
                    Long key = Long.valueOf(stepSource.getPriority());
                    Step sourceStep = targetStep.getSequence().loadedSteps.get(key);
                    if ((sourceStep != null) && (!targetStep.equals(sourceStep))) {
                        // Check for drop on a 'following' step
                        try {
                            List<TreeObject> siblings = new ArrayList<TreeObject>();
                            getNextSiblings(siblings, targetTreeObject.getProjectTreeObject(), sourceStep);
                            // System.out.println("siblings: "+siblings.toString());
                            return siblings.contains(targetTreeObject);
                        } catch (Exception e) {
                            e.printStackTrace(System.out);
                        }
                        ;
                    }
                }
            }
        }
    }
    if (PaletteSourceTransfer.getInstance().isSupportedType(transferType)) {
        if (target instanceof TreeObject) {
            TreeObject targetTreeObject = (TreeObject) target;
            PaletteSource paletteSource = PaletteSourceTransfer.getInstance().getPaletteSource();
            if (paletteSource != null) {
                try {
                    String xmlData = paletteSource.getXmlData();
                    List<Object> list = ConvertigoPlugin.clipboardManagerDND.read(xmlData);
                    DatabaseObject databaseObject = (DatabaseObject) list.get(0);
                    if (targetTreeObject instanceof ObjectsFolderTreeObject) {
                        ObjectsFolderTreeObject folderTreeObject = (ObjectsFolderTreeObject) targetTreeObject;
                        if (!ProjectExplorerView.folderAcceptMobileComponent(folderTreeObject.folderType, databaseObject)) {
                            return false;
                        }
                        // continue
                        targetTreeObject = folderTreeObject.getParent();
                    }
                    if (targetTreeObject instanceof DatabaseObjectTreeObject) {
                        DatabaseObject targetDatabaseObject = ((DatabaseObjectTreeObject) targetTreeObject).getObject();
                        if (targetDatabaseObject != null) {
                            if (!DatabaseObjectsManager.acceptDatabaseObjects(targetDatabaseObject, databaseObject)) {
                                return false;
                            }
                            if (targetTreeObject instanceof MobileComponentTreeObject) {
                                if (!com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.acceptDatabaseObjects(targetDatabaseObject, databaseObject)) {
                                    return false;
                                }
                                if (!com.twinsoft.convertigo.beans.mobile.components.dynamic.ComponentManager.isTplCompatible(targetDatabaseObject, databaseObject)) {
                                    return false;
                                }
                            }
                            if (targetTreeObject instanceof NgxComponentTreeObject) {
                                if (!com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.acceptDatabaseObjects(targetDatabaseObject, databaseObject)) {
                                    return false;
                                }
                                if (!com.twinsoft.convertigo.beans.ngx.components.dynamic.ComponentManager.isTplCompatible(targetDatabaseObject, databaseObject)) {
                                    return false;
                                }
                            }
                            return true;
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace(System.out);
                }
            }
        }
    }
    if (MobileSourceTransfer.getInstance().isSupportedType(transferType)) {
        MobileSource mobileSource = MobileSourceTransfer.getInstance().getMobileSource();
        if (mobileSource != null) {
            if (target instanceof MobileUIComponentTreeObject) {
                MobileUIComponentTreeObject mcto = GenericUtils.cast(target);
                com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource mss = com.twinsoft.convertigo.beans.mobile.components.MobileSmartSource.valueOf(mobileSource.getJsonString());
                if (mss == null || !mss.isDroppableInto(mcto.getObject())) {
                    return false;
                }
                for (IPropertyDescriptor descriptor : mcto.getPropertyDescriptors()) {
                    if (descriptor instanceof MobileSmartSourcePropertyDescriptor) {
                        if (!((MobileSmartSourcePropertyDescriptor) descriptor).isReadOnly()) {
                            return true;
                        }
                    }
                }
            }
            if (target instanceof NgxUIComponentTreeObject) {
                NgxUIComponentTreeObject mcto = GenericUtils.cast(target);
                com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource mss = com.twinsoft.convertigo.beans.ngx.components.MobileSmartSource.valueOf(mobileSource.getJsonString());
                if (mss == null || !mss.isDroppableInto(mcto.getObject())) {
                    return false;
                }
                for (IPropertyDescriptor descriptor : mcto.getPropertyDescriptors()) {
                    if (descriptor instanceof NgxSmartSourcePropertyDescriptor) {
                        if (!((NgxSmartSourcePropertyDescriptor) descriptor).isReadOnly()) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) MobileSmartSourcePropertyDescriptor(com.twinsoft.convertigo.eclipse.property_editors.MobileSmartSourcePropertyDescriptor) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) ArrayList(java.util.ArrayList) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) XMLElementStep(com.twinsoft.convertigo.beans.steps.XMLElementStep) Step(com.twinsoft.convertigo.beans.core.Step) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) StepVariable(com.twinsoft.convertigo.beans.variables.StepVariable) NgxSmartSourcePropertyDescriptor(com.twinsoft.convertigo.eclipse.property_editors.NgxSmartSourcePropertyDescriptor) IStepSourceContainer(com.twinsoft.convertigo.beans.core.IStepSourceContainer) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) MobileComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject) IOException(java.io.IOException) ObjectWithSameNameException(com.twinsoft.convertigo.engine.ObjectWithSameNameException) SAXException(org.xml.sax.SAXException) EngineException(com.twinsoft.convertigo.engine.EngineException) InvalidOperationException(com.twinsoft.convertigo.engine.InvalidOperationException) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) IOrderableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IOrderableTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) MobileComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) IOrderableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IOrderableTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) NgxUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) IPropertyTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject) RequestableObject(com.twinsoft.convertigo.beans.core.RequestableObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) MobileComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject) IPropertyDescriptor(org.eclipse.ui.views.properties.IPropertyDescriptor)

Aggregations

NgxUIComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject)7 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)6 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)6 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)4 IPropertyTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject)4 MobileUIComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject)4 ObjectsFolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject)4 PropertyTableRowTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject)4 PropertyTableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)4 ScreenClassTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject)4 EngineException (com.twinsoft.convertigo.engine.EngineException)4 NgxPageComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject)3 XMLVector (com.twinsoft.convertigo.beans.common.XMLVector)2 UIComponent (com.twinsoft.convertigo.beans.ngx.components.UIComponent)2 HandlerStatement (com.twinsoft.convertigo.beans.statements.HandlerStatement)2 RequestableVariable (com.twinsoft.convertigo.beans.variables.RequestableVariable)2 TreeDragListener (com.twinsoft.convertigo.eclipse.dnd.TreeDragListener)2 CompositeEvent (com.twinsoft.convertigo.eclipse.editors.CompositeEvent)2 CompositeListener (com.twinsoft.convertigo.eclipse.editors.CompositeListener)2 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)2