Search in sources :

Example 1 with ProjectTreeObject

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

the class CreateConnectorAction method postCreate.

public void postCreate(TreeObject parentTreeObject, DatabaseObject createdDatabaseObject) throws Exception {
    super.postCreate(parentTreeObject, createdDatabaseObject);
    ProjectTreeObject projectTreeObject = (ProjectTreeObject) parentTreeObject;
    projectTreeObject.openConnectorEditor((Connector) createdDatabaseObject);
}
Also used : ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)

Example 2 with ProjectTreeObject

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

the class CreateStubFromXMLAction method getXML.

public Document getXML(TreeObject treeObject) throws Exception {
    Document dom = XMLUtils.createDom("java");
    ProjectTreeObject projectTreeObject = treeObject.getProjectTreeObject();
    Object requestable = treeObject.getObject();
    if (requestable instanceof Transaction) {
        Transaction transaction = (Transaction) requestable;
        ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor((Connector) transaction.getParent());
        dom = connectorEditor.getLastGeneratedDocument();
    } else if (requestable instanceof Sequence) {
        SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor((Sequence) requestable);
        dom = sequenceEditor.getLastGeneratedDocument();
    }
    if (dom == null) {
        throw new NoSuchElementException();
    }
    return dom;
}
Also used : Transaction(com.twinsoft.convertigo.beans.core.Transaction) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) SequenceEditor(com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor) Document(org.w3c.dom.Document) ConnectorEditor(com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor) NoSuchElementException(java.util.NoSuchElementException)

Example 3 with ProjectTreeObject

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

the class CustomStatisticsAction 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) {
            ProjectTreeObject projectTreeObject = (ProjectTreeObject) explorerView.getFirstSelectedTreeObject();
            if (projectTreeObject != null) {
                StatisticsDialog stats = new StatisticsDialog(shell, projectTreeObject.getName(), projectTreeObject.getObject().getComment(), projectTreeObject.getObject().getVersion());
                stats.open();
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to compute statistics!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) StatisticsDialog(com.twinsoft.convertigo.eclipse.dialogs.StatisticsDialog) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 4 with ProjectTreeObject

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

the class ReferencesView method handleProjectSelection.

private void handleProjectSelection(Object firstElement) {
    List<String> projectNames = Engine.theApp.databaseObjectsManager.getAllProjectNamesList();
    ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
    Project projectSelected = null;
    ProjectTreeObject projectTreeObjectSelected = null;
    UnloadedProjectTreeObject unloadedProjectTreeObjectSelected = null;
    if (firstElement instanceof ProjectTreeObject) {
        projectTreeObjectSelected = (ProjectTreeObject) firstElement;
        projectSelected = projectTreeObjectSelected.getObject();
    } else if (firstElement instanceof UnloadedProjectTreeObject) {
        unloadedProjectTreeObjectSelected = (UnloadedProjectTreeObject) firstElement;
        String projectNameSelected = unloadedProjectTreeObjectSelected.getName();
        projectSelected = getProject(projectNameSelected, projectExplorerView);
    }
    if (projectSelected == null) {
        return;
    }
    String projectNameSelected = projectSelected.getName();
    treeViewer.setInput(null);
    // Get the referencing sequences and transactions
    List<Sequence> sequences = projectSelected.getSequencesList();
    RootNode root = new RootNode();
    ProjectNode projectNode = new ProjectNode(root, projectNameSelected, projectSelected);
    root.addChild(projectNode);
    // Get all the projects needed to successfully execute the selected project
    // i.e. get all CallTransaction and CallSequence steps from the selected project
    // that refer to other projects
    RequiresNode requiresNode = new RequiresNode(root, "Requires");
    // Search for external sequence or transaction referenced by CallSequence or CallTransaction
    // from the selected project
    List<String> transactionList = new ArrayList<String>();
    List<String> sequenceList = new ArrayList<String>();
    for (Sequence sequence : sequences) {
        List<Step> steps = sequence.getSteps();
        for (Step step : steps) {
            getRequiredRequestables(step, projectSelected, projectExplorerView, requiresNode, transactionList, sequenceList);
        }
    }
    UrlMapper urlMapper = projectSelected.getUrlMapper();
    if (urlMapper != null) {
        List<UrlMapping> mappings = urlMapper.getMappingList();
        for (UrlMapping mapping : mappings) {
            List<UrlMappingOperation> operations = mapping.getOperationList();
            for (UrlMappingOperation operation : operations) {
                try {
                    String targetRequestableName = operation.getTargetRequestable();
                    if (!targetRequestableName.isEmpty() && !targetRequestableName.startsWith(projectNameSelected)) {
                        handleTargetRequestable(targetRequestableName, projectExplorerView, requiresNode);
                    }
                } catch (Exception e) {
                    ConvertigoPlugin.logException(e, "Error while analyzing the projects hierarchy", true);
                }
            }
        }
    }
    if (requiresNode.hasChildren()) {
        projectNode.addChild(requiresNode);
    } else {
        projectNode.addChild(new InformationNode(projectNode, "This project does not require any other project"));
    }
    // Get all the projects using the selected project
    // i.e. get all CallTransaction and CallSequence steps that refer to transactions
    // or sequences from the selected project
    IsUsedByNode isUsedByNode = new IsUsedByNode(root, "Is used by");
    for (String projectName : projectNames) {
        if (!(projectName.equals(projectNameSelected))) {
            Project project = getProject(projectName, projectExplorerView);
            if (project == null) {
                // Unable to load the project, just ignore it
                ConvertigoPlugin.logWarning("[References View] Unable to load the project \"" + projectName + "\"", false);
                continue;
            }
            ProjectNode projectFolderExports = new ProjectNode(root, projectName, project);
            urlMapper = project.getUrlMapper();
            if (urlMapper != null) {
                MapperNode mapperNode = new MapperNode(projectFolderExports, 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(projectNameSelected + ".")) {
                            MappingOperationNode operationNode = new MappingOperationNode(pathNode, operation.getName(), operation);
                            pathNode.addChild(operationNode);
                        }
                    }
                    if (pathNode.hasChildren()) {
                        mapperNode.addChild(pathNode);
                    }
                }
                if (mapperNode.hasChildren()) {
                    projectFolderExports.addChild(mapperNode);
                }
            }
            List<Sequence> sequencesList = project.getSequencesList();
            for (Sequence sequence : sequencesList) {
                // Search for CallTransaction and CallSequence
                // referencing a transaction or sequence
                // from the selected project
                List<Step> stepList = sequence.getSteps();
                SequenceNode sequenceNode = new SequenceNode(root, sequence.getName(), sequence);
                for (Step step : stepList) {
                    getUsedRequestables(step, projectSelected, sequenceNode);
                }
                if (sequenceNode.hasChildren()) {
                    projectFolderExports.addChild(sequenceNode);
                }
            }
            if (projectFolderExports.hasChildren()) {
                isUsedByNode.addChild(projectFolderExports);
            }
        }
    }
    if (isUsedByNode.hasChildren()) {
        projectNode.addChild(isUsedByNode);
    } else {
        projectNode.addChild(new InformationNode(projectNode, "This project is not used by any other project"));
    }
    treeViewer.setInput(null);
    treeViewer.setInput(root);
    treeViewer.expandAll();
}
Also used : UrlMapping(com.twinsoft.convertigo.beans.core.UrlMapping) RootNode(com.twinsoft.convertigo.eclipse.views.references.model.RootNode) MapperNode(com.twinsoft.convertigo.eclipse.views.references.model.MapperNode) ArrayList(java.util.ArrayList) 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) InformationNode(com.twinsoft.convertigo.eclipse.views.references.model.InformationNode) UrlMapper(com.twinsoft.convertigo.beans.core.UrlMapper) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) UrlMappingOperation(com.twinsoft.convertigo.beans.core.UrlMappingOperation) Sequence(com.twinsoft.convertigo.beans.core.Sequence) MappingOperationNode(com.twinsoft.convertigo.eclipse.views.references.model.MappingOperationNode) EngineException(com.twinsoft.convertigo.engine.EngineException) SequenceNode(com.twinsoft.convertigo.eclipse.views.references.model.SequenceNode) Project(com.twinsoft.convertigo.beans.core.Project) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) MappingPathNode(com.twinsoft.convertigo.eclipse.views.references.model.MappingPathNode) RequiresNode(com.twinsoft.convertigo.eclipse.views.references.model.RequiresNode) IsUsedByNode(com.twinsoft.convertigo.eclipse.views.references.model.IsUsedByNode) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ProjectNode(com.twinsoft.convertigo.eclipse.views.references.model.ProjectNode)

Example 5 with ProjectTreeObject

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

the class DatabaseObjectFindDialog method getDatabaseObjects.

private void getDatabaseObjects(TreeParent treeObject) {
    ProjectTreeObject projectTreeObject = ConvertigoPlugin.projectManager.currentProjectTreeObject;
    TreeParent treeParent = treeObject;
    if (treeObject == null) {
        treeParent = projectTreeObject;
        TreeObject treeSelected = ConvertigoPlugin.getDefault().getProjectExplorerView().getFirstSelectedTreeObject();
        while (treeSelected != null && !(treeSelected instanceof TreeParent)) {
            treeSelected = treeSelected.getParent();
        }
        if (treeSelected != null) {
            treeParent = (TreeParent) treeSelected;
        }
        if (firstSelected == null) {
            firstSelected = treeSelected;
        }
    }
    List<? extends TreeObject> children = treeParent.getChildren();
    children.sort(ConvertigoPlugin.getDefault().getProjectExplorerView().getViewerComparator());
    for (TreeObject child : children) {
        if (child instanceof DatabaseObjectTreeObject) {
            DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) child;
            if (!databaseObjectTreeObject.isInherited) {
                vDatabaseObjects.add(databaseObjectTreeObject);
                getDatabaseObjects(databaseObjectTreeObject);
            }
        } else if (child instanceof TreeParent) {
            getDatabaseObjects((TreeParent) child);
        }
    }
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)

Aggregations

ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)36 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)24 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)19 Shell (org.eclipse.swt.widgets.Shell)19 Cursor (org.eclipse.swt.graphics.Cursor)17 Display (org.eclipse.swt.widgets.Display)17 UnloadedProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject)16 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)15 SequenceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)14 Project (com.twinsoft.convertigo.beans.core.Project)12 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)12 EngineException (com.twinsoft.convertigo.engine.EngineException)10 DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)9 DesignDocumentViewTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject)9 IDesignTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject)9 IPropertyTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject)9 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)8 Sequence (com.twinsoft.convertigo.beans.core.Sequence)8 CriteriaTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject)8 DesignDocumentFilterTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)8