Search in sources :

Example 81 with TreeObject

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

the class ViewExecuteSelectedAction 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 DesignDocumentViewTreeObject) {
        action.setEnabled(((DesignDocumentViewTreeObject) treeObject).hasReduce());
    }
}
Also used : 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) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 82 with TreeObject

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

the class SequenceExecuteSelectedAction 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 SequenceTreeObject)) {
                SequenceTreeObject sequenceTreeObject = (SequenceTreeObject) treeObject;
                openEditors(explorerView, sequenceTreeObject);
                Sequence sequence = sequenceTreeObject.getObject();
                ProjectTreeObject projectTreeObject = sequenceTreeObject.getProjectTreeObject();
                SequenceEditor sequenceEditor = projectTreeObject.getSequenceEditor(sequence);
                if (sequenceEditor != null) {
                    getActivePage().activate(sequenceEditor);
                    boolean fromStub = action.getId().contains("FromStub");
                    sequenceEditor.getSequenceEditorPart().getDocument(sequence.getName(), null, fromStub);
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to execute the selected sequence!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) 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) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) SequenceEditor(com.twinsoft.convertigo.eclipse.editors.sequence.SequenceEditor) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 83 with TreeObject

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

the class SequenceExecuteSelectedAction method loadProject.

private void loadProject(ProjectExplorerView explorerView, String projectName) {
    if (!explorerView.isProjectLoaded(projectName)) {
        TreeObject unloadedProjectTreeObject;
        try {
            unloadedProjectTreeObject = ((ViewContentProvider) explorerView.viewer.getContentProvider()).getProjectRootObject(projectName);
            explorerView.loadProject((UnloadedProjectTreeObject) unloadedProjectTreeObject);
            try {
                while (!explorerView.isProjectLoaded(projectName)) Thread.sleep(10000);
            } catch (InterruptedException e) {
            }
        } catch (EngineException e) {
            e.printStackTrace();
        }
    }
}
Also used : EngineException(com.twinsoft.convertigo.engine.EngineException) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) 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)

Example 84 with TreeObject

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

the class DatabaseObjectFindDialog method findDatabaseObject.

protected void findDatabaseObject() {
    Pattern pattern = null;
    String substring = "";
    try {
        pattern = bRegExp ? (bMatchCase ? Pattern.compile(objectTextSubstring) : Pattern.compile(objectTextSubstring, Pattern.CASE_INSENSITIVE)) : null;
    } catch (Exception pex) {
        ConvertigoPlugin.errorMessageBox(pex.getClass().getName() + ":\n" + pex.getMessage());
        return;
    }
    substring = bMatchCase ? objectTextSubstring : objectTextSubstring.toLowerCase();
    while (true) {
        Enumeration<DatabaseObjectTreeObject> enumDatabaseObjects = Collections.enumeration(vDatabaseObjects);
        while (enumDatabaseObjects.hasMoreElements()) {
            DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) enumDatabaseObjects.nextElement();
            DatabaseObject databaseObject = databaseObjectTreeObject.getObject();
            boolean bContinue = false;
            switch(objectType) {
                case // *
                0:
                    bContinue = true;
                    break;
                case // Mobile Component
                1:
                    bContinue = databaseObject.getDatabaseType().equals("MobileComponent");
                    break;
                case // Screen class
                2:
                    bContinue = databaseObject.getDatabaseType().equals("ScreenClass");
                    break;
                case // Criteria
                3:
                    bContinue = databaseObject.getDatabaseType().equals("Criteria");
                    break;
                case // Extraction rule
                4:
                    bContinue = databaseObject.getDatabaseType().equals("ExtractionRule");
                    break;
                case // Sheet
                5:
                    bContinue = databaseObject.getDatabaseType().equals("Sheet");
                    break;
                case // Transaction
                6:
                    bContinue = databaseObject.getDatabaseType().equals("Transaction");
                    break;
                case // Statement
                7:
                    bContinue = databaseObject.getDatabaseType().equals("Statement");
                    break;
                case // Sequence
                8:
                    bContinue = databaseObject.getDatabaseType().equals("Sequence");
                    break;
                case // Step
                9:
                    bContinue = databaseObject.getDatabaseType().equals("Step");
                    break;
            }
            if (bContinue) {
                String text = databaseObjectTreeObject.toString();
                try {
                    text = YamlConverter.toYaml(databaseObject.toXml(XMLUtils.createDom()));
                } catch (Exception e) {
                    e.printStackTrace();
                }
                boolean bFound = false;
                if (bRegExp) {
                    Matcher matcher = pattern.matcher(text);
                    bFound = matcher.find();
                } else {
                    text = bMatchCase ? text : text.toLowerCase();
                    bFound = text.indexOf(substring) != -1;
                }
                if (bFound) {
                    // Object found !!!
                    // System.out.println(text);
                    ConvertigoPlugin.getDefault().getProjectExplorerView().objectSelected(new CompositeEvent(databaseObject));
                    vDatabaseObjects.remove(databaseObjectTreeObject);
                    return;
                }
            }
        }
        TreeObject treeSelected = firstSelected == null ? ConvertigoPlugin.projectManager.currentProjectTreeObject : firstSelected;
        MessageBox messageBox = new MessageBox(getShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
        String message = "End of the search for " + treeSelected.toString() + " object.\nDo you want to retry the search from the beginning?";
        messageBox.setMessage(message);
        int ret = messageBox.open();
        if (ret == SWT.YES) {
            ConvertigoPlugin.getDefault().getProjectExplorerView().setSelectedTreeObject(treeSelected);
            vDatabaseObjects.clear();
            getDatabaseObjects(null);
        } else {
            return;
        }
    }
}
Also used : Pattern(java.util.regex.Pattern) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) Matcher(java.util.regex.Matcher) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) 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) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 85 with TreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject 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

TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)207 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)129 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)112 Shell (org.eclipse.swt.widgets.Shell)111 Cursor (org.eclipse.swt.graphics.Cursor)107 Display (org.eclipse.swt.widgets.Display)107 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)97 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)64 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)53 StepTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject)47 ObjectsFolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject)45 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)36 TransactionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject)36 EngineException (com.twinsoft.convertigo.engine.EngineException)36 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)35 IPropertyTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject)33 Sequence (com.twinsoft.convertigo.beans.core.Sequence)32 PropertyTableRowTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject)32 SequenceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)32 PropertyTableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)31