Search in sources :

Example 11 with ConnectorTreeObject

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

the class SetDefaultConnectorAction method selectionChanged.

public void selectionChanged(IAction action, ISelection selection) {
    super.selectionChanged(action, selection);
    IStructuredSelection structuredSelection = (IStructuredSelection) selection;
    TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
    if (treeObject instanceof ConnectorTreeObject) {
        DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
        ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
        action.setChecked(actionModel.isChecked);
    }
}
Also used : ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ActionModel(com.twinsoft.convertigo.engine.studio.ActionModel)

Example 12 with ConnectorTreeObject

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

the class SetDefaultConnectorAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) explorerView.getFirstSelectedTreeObject();
            Connector connector = (Connector) connectorTreeObject.getObject();
            Project project = connector.getProject();
            // Report from 4.5: fix #401
            ConnectorTreeObject defaultConnectorTreeObject = null;
            Connector defaultConnector = project.getDefaultConnector();
            if (defaultConnector != null) {
                defaultConnectorTreeObject = (ConnectorTreeObject) explorerView.findTreeObjectByUserObject(defaultConnector);
            }
            project.setDefaultConnector(connector);
            if (defaultConnectorTreeObject != null) {
                defaultConnectorTreeObject.isDefault = false;
                defaultConnectorTreeObject.hasBeenModified(true);
            }
            connectorTreeObject.isDefault = true;
            connectorTreeObject.hasBeenModified(true);
            // Updating the tree
            explorerView.refreshTreeObject(connectorTreeObject.getParentDatabaseObjectTreeObject());
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to set connector to default one!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) Connector(com.twinsoft.convertigo.beans.core.Connector) Project(com.twinsoft.convertigo.beans.core.Project) Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 13 with ConnectorTreeObject

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

the class ViewExecuteSelectedAction method run.

@Override
public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
            if ((treeObject != null) && (treeObject instanceof DesignDocumentViewTreeObject)) {
                DesignDocumentViewTreeObject viewTreeObject = (DesignDocumentViewTreeObject) treeObject;
                DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) viewTreeObject.getTreeObjectOwner();
                ConnectorTreeObject cto = (ConnectorTreeObject) ddto.getOwnerDatabaseObjectTreeObject();
                ProjectTreeObject projectTreeObject = cto.getProjectTreeObject();
                CouchDbConnector connector = (CouchDbConnector) cto.getObject();
                cto.openConnectorEditor();
                ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
                if (connectorEditor != null) {
                    // activate connector's editor
                    getActivePage().activate(connectorEditor);
                    // set transaction's parameters
                    Transaction transaction = connector.getTransactionByName(CouchDbConnector.internalView);
                    ((GetViewTransaction) transaction).setViewname(viewTreeObject.getDocViewName());
                    Variable view_reduce = ((GetViewTransaction) transaction).getVariable(CouchParam.prefix + "reduce");
                    view_reduce.setValueOrNull(viewTreeObject.hasReduce() ? isReduceRequested() : false);
                    // execute view transaction
                    connectorEditor.getDocument(CouchDbConnector.internalView, isStubRequested());
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to execute the selected view!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) Variable(com.twinsoft.convertigo.beans.core.Variable) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) ConnectorEditor(com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor) CouchDbConnector(com.twinsoft.convertigo.beans.connectors.CouchDbConnector) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) Shell(org.eclipse.swt.widgets.Shell) GetViewTransaction(com.twinsoft.convertigo.beans.transactions.couchdb.GetViewTransaction) GetViewTransaction(com.twinsoft.convertigo.beans.transactions.couchdb.GetViewTransaction) Transaction(com.twinsoft.convertigo.beans.core.Transaction) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Display(org.eclipse.swt.widgets.Display)

Example 14 with ConnectorTreeObject

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

the class ReferencesView method handleConnectorSelection.

private void handleConnectorSelection(Object firstElement) {
    ConnectorTreeObject connectorTreeObject = (ConnectorTreeObject) firstElement;
    Connector connectorSelected = connectorTreeObject.getObject();
    String connectorSelectedName = connectorSelected.getName();
    Project projectConnectorSelected = connectorSelected.getProject();
    String connectorProjectName = connectorSelected.getProject().getName();
    List<Transaction> transactions = connectorSelected.getTransactionsList();
    try {
        Project project = null;
        List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
        ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
        treeViewer.setInput(null);
        RootNode root = new RootNode();
        ConnectorNode connectorNode = null;
        connectorNode = getConnectorNode(root, connectorSelected);
        root.addChild(connectorNode);
        IsUsedByNode isUsedByNode = new IsUsedByNode(connectorNode, "Is used by");
        RequiresNode requiresNode = new RequiresNode(connectorNode, "Requires");
        ProjectNode projectFolder = null;
        // Search handlers are that referenced by the selected connector for continue with site Clipper
        if (connectorSelected instanceof HtmlConnector) {
            ProjectNode projectNode = new ProjectNode(requiresNode, connectorProjectName, projectConnectorSelected);
            for (Transaction transaction : transactions) {
                List<Statement> statements = ((HtmlTransaction) transaction).getStatements();
                List<String> siteClipperConnectorNames = new ArrayList<String>();
                for (Statement statement : statements) {
                    List<Statement> statementList = ((FunctionStatement) statement).getStatements();
                    for (Statement st : statementList) {
                        if (st instanceof ContinueWithSiteClipperStatement) {
                            ContinueWithSiteClipperStatement continueWithSiteClipperStatement = (ContinueWithSiteClipperStatement) st;
                            String siteClipperconnectorName = continueWithSiteClipperStatement.getSiteClipperConnectorName();
                            if (!siteClipperConnectorNames.contains(siteClipperconnectorName)) {
                                siteClipperConnectorNames.add(siteClipperconnectorName);
                                Connector siteClipperConnector = projectConnectorSelected.getConnectorByName(siteClipperconnectorName);
                                ConnectorNode connectorSiteClipperNode = new SiteClipperConnectorNode(projectNode, siteClipperconnectorName, siteClipperConnector);
                                projectNode.addChild(connectorSiteClipperNode);
                            }
                        }
                    }
                }
            }
            if (projectNode.hasChildren()) {
                requiresNode.addChild(projectNode);
            }
        } else if (connectorSelected instanceof SiteClipperConnector) {
            List<Connector> connectors = projectConnectorSelected.getConnectorsList();
            ProjectNode projectNode = new ProjectNode(isUsedByNode, connectorProjectName, projectConnectorSelected);
            for (Connector connector : connectors) {
                if (connector instanceof HtmlConnector) {
                    List<Transaction> transactionList = ((HtmlConnector) connector).getTransactionsList();
                    for (Transaction transaction : transactionList) {
                        List<Statement> statements = ((HtmlTransaction) transaction).getStatements();
                        for (Statement statement : statements) {
                            List<Statement> statementList = ((FunctionStatement) statement).getStatements();
                            for (Statement st : statementList) {
                                if (st instanceof ContinueWithSiteClipperStatement) {
                                    String sourceSiteClipperConnectorName = ((ContinueWithSiteClipperStatement) st).getSiteClipperConnectorName();
                                    if (sourceSiteClipperConnectorName.equals(connectorSelectedName)) {
                                        ContinueWithSiteClipperStatement continueWithSiteClipperStatement = (ContinueWithSiteClipperStatement) st;
                                        HtmlConnectorNode htmlConnectorNode = new HtmlConnectorNode(projectNode, connector.getName(), connector);
                                        projectNode.addChild(htmlConnectorNode);
                                        TransactionNode transactionNode = new TransactionNode(htmlConnectorNode, transaction.getName(), continueWithSiteClipperStatement);
                                        htmlConnectorNode.addChild(transactionNode);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (projectNode.hasChildren()) {
                isUsedByNode.addChild(projectNode);
            }
        }
        // Searching all objects that are referenced by the selected connector
        for (String projectName : projectNames) {
            project = getProject(projectName, projectExplorerView);
            if (project != null) {
                projectFolder = new ProjectNode(isUsedByNode, projectName, project);
                UrlMapper urlMapper = project.getUrlMapper();
                if (urlMapper != null) {
                    MapperNode mapperNode = new MapperNode(projectFolder, urlMapper.getName(), urlMapper);
                    List<UrlMapping> mappings = urlMapper.getMappingList();
                    for (UrlMapping mapping : mappings) {
                        MappingPathNode pathNode = new MappingPathNode(mapperNode, mapping.getPath(), mapping);
                        List<UrlMappingOperation> operations = mapping.getOperationList();
                        for (UrlMappingOperation operation : operations) {
                            String targetRequestable = operation.getTargetRequestable();
                            if (targetRequestable.startsWith(projectConnectorSelected + "." + connectorSelectedName + ".")) {
                                MappingOperationNode operationNode = new MappingOperationNode(pathNode, operation.getName(), operation);
                                pathNode.addChild(operationNode);
                            }
                        }
                        if (pathNode.hasChildren()) {
                            mapperNode.addChild(pathNode);
                        }
                    }
                    if (mapperNode.hasChildren()) {
                        projectFolder.addChild(mapperNode);
                    }
                }
                List<Sequence> sequences = project.getSequencesList();
                for (Sequence sequence : sequences) {
                    List<Step> steps = sequence.getSteps();
                    SequenceNode sequenceNode = new SequenceNode(projectFolder, sequence.getName(), sequence);
                    for (Step step : steps) {
                        getConnectorReferencingIsUsedBy(step, projectExplorerView, sequenceNode, transactions, connectorProjectName, connectorSelectedName);
                    }
                    if (sequenceNode.hasChildren()) {
                        projectFolder.addChild(sequenceNode);
                    }
                }
                if (projectFolder.hasChildren()) {
                    isUsedByNode.addChild(projectFolder);
                }
            }
        }
        if (requiresNode.hasChildren()) {
            connectorNode.addChild(requiresNode);
        }
        if (isUsedByNode.hasChildren()) {
            connectorNode.addChild(isUsedByNode);
        }
        if (!connectorNode.hasChildren()) {
            connectorNode.addChild(new InformationNode(connectorNode, "This connector is not used by any other objects"));
        }
        treeViewer.setInput(root);
        treeViewer.expandAll();
    } catch (EngineException e) {
        ConvertigoPlugin.logException(e, "Error while analyzing the projects hierarchy", true);
    }
}
Also used : UrlMapping(com.twinsoft.convertigo.beans.core.UrlMapping) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) JavelinConnector(com.twinsoft.convertigo.beans.connectors.JavelinConnector) HttpConnector(com.twinsoft.convertigo.beans.connectors.HttpConnector) ProxyHttpConnector(com.twinsoft.convertigo.beans.connectors.ProxyHttpConnector) Connector(com.twinsoft.convertigo.beans.core.Connector) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) SqlConnector(com.twinsoft.convertigo.beans.connectors.SqlConnector) RootNode(com.twinsoft.convertigo.eclipse.views.references.model.RootNode) ContinueWithSiteClipperStatement(com.twinsoft.convertigo.beans.statements.ContinueWithSiteClipperStatement) MapperNode(com.twinsoft.convertigo.eclipse.views.references.model.MapperNode) ArrayList(java.util.ArrayList) EngineException(com.twinsoft.convertigo.engine.EngineException) Step(com.twinsoft.convertigo.beans.core.Step) ElseStep(com.twinsoft.convertigo.beans.steps.ElseStep) RequestableStep(com.twinsoft.convertigo.beans.core.RequestableStep) ThenStep(com.twinsoft.convertigo.beans.steps.ThenStep) SequenceStep(com.twinsoft.convertigo.beans.steps.SequenceStep) BranchStep(com.twinsoft.convertigo.beans.steps.BranchStep) XMLComplexStep(com.twinsoft.convertigo.beans.steps.XMLComplexStep) BlockStep(com.twinsoft.convertigo.beans.steps.BlockStep) TransactionStep(com.twinsoft.convertigo.beans.steps.TransactionStep) FunctionStatement(com.twinsoft.convertigo.beans.statements.FunctionStatement) SiteClipperConnector(com.twinsoft.convertigo.beans.connectors.SiteClipperConnector) HtmlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HtmlConnectorNode) InformationNode(com.twinsoft.convertigo.eclipse.views.references.model.InformationNode) List(java.util.List) ArrayList(java.util.ArrayList) SiteClipperConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SiteClipperConnectorNode) UrlMapper(com.twinsoft.convertigo.beans.core.UrlMapper) HtmlConnector(com.twinsoft.convertigo.beans.connectors.HtmlConnector) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) UrlMappingOperation(com.twinsoft.convertigo.beans.core.UrlMappingOperation) FunctionStatement(com.twinsoft.convertigo.beans.statements.FunctionStatement) Statement(com.twinsoft.convertigo.beans.core.Statement) ContinueWithSiteClipperStatement(com.twinsoft.convertigo.beans.statements.ContinueWithSiteClipperStatement) ScHandlerStatement(com.twinsoft.convertigo.beans.statements.ScHandlerStatement) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) MappingOperationNode(com.twinsoft.convertigo.eclipse.views.references.model.MappingOperationNode) Sequence(com.twinsoft.convertigo.beans.core.Sequence) ConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ConnectorNode) SiteClipperConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SiteClipperConnectorNode) HtmlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HtmlConnectorNode) JavelinConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.JavelinConnectorNode) CicsConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.CicsConnectorNode) SqlConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.SqlConnectorNode) ProxyHttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.ProxyHttpConnectorNode) HttpConnectorNode(com.twinsoft.convertigo.eclipse.views.references.model.HttpConnectorNode) SequenceNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) Project(com.twinsoft.convertigo.beans.core.Project) Transaction(com.twinsoft.convertigo.beans.core.Transaction) HtmlTransaction(com.twinsoft.convertigo.beans.transactions.HtmlTransaction) JavelinTransaction(com.twinsoft.convertigo.beans.transactions.JavelinTransaction) MappingPathNode(com.twinsoft.convertigo.eclipse.views.references.model.MappingPathNode) IsUsedByNode(com.twinsoft.convertigo.eclipse.views.references.model.IsUsedByNode) RequiresNode(com.twinsoft.convertigo.eclipse.views.references.model.RequiresNode) TransactionNode(com.twinsoft.convertigo.eclipse.views.references.model.TransactionNode) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)

Example 15 with ConnectorTreeObject

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

the class DatabaseObjectDeleteAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        treeNodesToUpdate = new ArrayList<>();
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject[] selectedTreeObjects = explorerView.getSelectedTreeObjects();
            if (selectedTreeObjects != null) {
                Collection<DatabaseObjectTreeObject> treeObjects = new HashSet<>(selectedTreeObjects.length);
                for (TreeObject t : Arrays.asList(selectedTreeObjects)) {
                    if (t instanceof DatabaseObjectTreeObject) {
                        treeObjects.add((DatabaseObjectTreeObject) t);
                    }
                }
                ;
                if (treeObjects.size() > 1) {
                    for (DatabaseObjectTreeObject t : new ArrayList<>(treeObjects)) {
                        TreeObject parent = t.getParent();
                        while (parent != null) {
                            if (treeObjects.contains(parent)) {
                                treeObjects.remove(t);
                                parent = null;
                            } else {
                                parent = parent.getParent();
                            }
                        }
                    }
                    ;
                }
                if (treeObjects.size() > 1) {
                    List<DatabaseObjectTreeObject> list = new ArrayList<>(treeObjects);
                    Collections.sort(list, new Comparator<DatabaseObjectTreeObject>() {

                        @Override
                        public int compare(DatabaseObjectTreeObject o1, DatabaseObjectTreeObject o2) {
                            if (o1 instanceof ProjectTreeObject) {
                                if (o2 instanceof ProjectTreeObject) {
                                    return o1.getName().compareTo(o2.getName());
                                }
                                return -1;
                            } else if (o2 instanceof ProjectTreeObject) {
                                return 1;
                            }
                            return o1.getName().compareTo(o2.getName());
                        }
                    });
                    treeObjects = list;
                }
                MultipleDeletionDialog dialog = new MultipleDeletionDialog(shell, "Object Deletion", treeObjects.size() != 1);
                for (DatabaseObjectTreeObject treeObject : treeObjects) {
                    String message = java.text.MessageFormat.format("Do you really want to delete the {0} \"{1}\" and all its sub-objects?", treeObject instanceof ProjectTreeObject ? "project" : "object", treeObject.getName());
                    if (treeObject instanceof ProjectTreeObject) {
                        message += "\nProject location: " + ((Project) treeObject.getObject()).getDirPath();
                        dialog.setToggle("Delete project content on disk (cannot be undone)", false);
                    } else {
                        dialog.removeToggle();
                    }
                    if (!dialog.shouldBeDeleted(message)) {
                        continue;
                    }
                    try {
                        if (treeObject instanceof ProjectTreeObject) {
                            ((ProjectTreeObject) treeObject).closeAllEditors();
                        } else if (treeObject instanceof SequenceTreeObject) {
                            ((ProjectTreeObject) ((SequenceTreeObject) treeObject).getParent().getParent()).closeSequenceEditors((Sequence) treeObject.getObject());
                        } else if (treeObject instanceof ConnectorTreeObject) {
                            ((ProjectTreeObject) ((ConnectorTreeObject) treeObject).getParent().getParent()).closeConnectorEditors((Connector) treeObject.getObject());
                        } else if (treeObject instanceof StepTreeObject) {
                            // We close the editor linked with the SimpleStep (=SequenceJsStep)
                            if (treeObject.getObject() instanceof SimpleStep) {
                                boolean find = false;
                                SimpleStep simpleStep = (SimpleStep) treeObject.getObject();
                                IWorkbenchPage page = this.getActivePage();
                                IEditorReference[] editors = page.getEditorReferences();
                                int _i = 0;
                                while (find != true && _i < editors.length) {
                                    IEditorReference editor = editors[_i];
                                    IEditorInput input = editor.getEditorInput();
                                    if (input instanceof JScriptEditorInput) {
                                        if (simpleStep.equals(((JScriptEditorInput) input).getDatabaseObject())) {
                                            find = true;
                                            IEditorPart editorPart = page.findEditor(input);
                                            if (editorPart != null) {
                                                page.activate(editorPart);
                                                page.closeEditor(editorPart, false);
                                            }
                                        }
                                    }
                                    ++_i;
                                }
                            }
                        } else if (treeObject instanceof MobileComponentTreeObject) {
                            ((MobileComponentTreeObject) treeObject).closeAllEditors(false);
                        }
                        if (treeObject instanceof ProjectTreeObject) {
                            explorerView.removeProjectTreeObject(treeObject);
                            final Project project = (Project) treeObject.getObject();
                            Job rmProject = new Job("Remove '" + project.getName() + "' project") {

                                @Override
                                protected IStatus run(IProgressMonitor monitor) {
                                    try {
                                        delete(project, dialog.getToggleState());
                                    } catch (Exception e) {
                                        ConvertigoPlugin.logException(e, "Unable to delete the '" + project.getName() + "' project.");
                                        return new MultiStatus(ConvertigoPlugin.PLUGIN_UNIQUE_ID, IStatus.ERROR, "Failed to remove the '" + project.getName() + "' project.", e);
                                    }
                                    return Status.OK_STATUS;
                                }
                            };
                            rmProject.schedule();
                        } else {
                            delete(treeObject);
                            // prevents treeObject and its childs to receive further TreeObjectEvents
                            if (treeObject instanceof TreeObjectListener) {
                                explorerView.removeTreeObjectListener(treeObject);
                            }
                            treeObject.removeAllChildren();
                        }
                        explorerView.fireTreeObjectRemoved(new TreeObjectEvent(treeObject));
                    } catch (Exception e) {
                        ConvertigoPlugin.logException(e, "Unable to delete the current selected object.");
                    }
                }
                ;
                // Updating the tree and the properties panel
                Enumeration<DatabaseObjectTreeObject> enumeration = Collections.enumeration(treeNodesToUpdate);
                DatabaseObjectTreeObject parentTreeObject;
                while (enumeration.hasMoreElements()) {
                    parentTreeObject = enumeration.nextElement();
                    if (parentTreeObject != null) {
                        explorerView.reloadTreeObject(parentTreeObject);
                        explorerView.setSelectedTreeObject(parentTreeObject);
                    }
                }
                // Refresh tree to show potential 'broken' steps
                explorerView.refreshTree();
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to delete object!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : JScriptEditorInput(com.twinsoft.convertigo.eclipse.editors.jscript.JScriptEditorInput) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) SimpleStep(com.twinsoft.convertigo.beans.steps.SimpleStep) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) ArrayList(java.util.ArrayList) MultiStatus(org.eclipse.core.runtime.MultiStatus) MultipleDeletionDialog(com.twinsoft.convertigo.eclipse.dialogs.MultipleDeletionDialog) Cursor(org.eclipse.swt.graphics.Cursor) Shell(org.eclipse.swt.widgets.Shell) IEditorReference(org.eclipse.ui.IEditorReference) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) MobileComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject) Job(org.eclipse.core.runtime.jobs.Job) HashSet(java.util.HashSet) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) IEditorPart(org.eclipse.ui.IEditorPart) CoreException(org.eclipse.core.runtime.CoreException) EngineException(com.twinsoft.convertigo.engine.EngineException) ConvertigoException(com.twinsoft.convertigo.engine.ConvertigoException) IOException(java.io.IOException) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) Project(com.twinsoft.convertigo.beans.core.Project) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) TreeObjectListener(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectListener) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) MobileComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileComponentTreeObject) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) IEditorInput(org.eclipse.ui.IEditorInput) Display(org.eclipse.swt.widgets.Display)

Aggregations

ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)15 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)11 Connector (com.twinsoft.convertigo.beans.core.Connector)8 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)8 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)7 EngineException (com.twinsoft.convertigo.engine.EngineException)6 Sequence (com.twinsoft.convertigo.beans.core.Sequence)5 SequenceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)5 TraceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TraceTreeObject)5 UnloadedProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject)5 Step (com.twinsoft.convertigo.beans.core.Step)4 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)4 TransactionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject)4 Project (com.twinsoft.convertigo.beans.core.Project)3 CriteriaTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject)3 DesignDocumentFilterTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)3 DesignDocumentFunctionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject)3 DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)3 DesignDocumentUpdateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)3 DesignDocumentValidateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject)3