Search in sources :

Example 16 with CompositeEvent

use of com.twinsoft.convertigo.eclipse.editors.CompositeEvent in project convertigo by convertigo.

the class HtmlConnectorDesignComposite method createStatementFromSelection.

public void createStatementFromSelection() {
    String className = "com.twinsoft.convertigo.beans.core.Statement";
    // Retrieve selected statement xpath
    String statementXpath = xpathEvaluator.getSelectionXpath();
    // Retrieve parent Statement
    Statement parentObject = getParentStatement();
    if (parentObject == null) {
        ConvertigoPlugin.errorMessageBox("Unable to create a new statement.\nThe selected handler belongs to a different HTML connector.");
        return;
    }
    // Add statement to parent statement
    NewObjectWizard newObjectWizard = new NewObjectWizard(parentObject, className, statementXpath, null);
    WizardDialog wzdlg = new WizardDialog(Display.getCurrent().getActiveShell(), newObjectWizard);
    wzdlg.setPageSize(850, 650);
    wzdlg.open();
    if (wzdlg.getReturnCode() != Window.CANCEL) {
        Statement statement = (Statement) newObjectWizard.newBean;
        // Reload parent statement in Tree
        fireObjectChanged(new CompositeEvent(parentObject));
        // Set selection on new statement (will expand tree to new statement)
        if (statement != null)
            fireObjectSelected(new CompositeEvent(statement));
        // Set back selection on parent statement
        fireObjectSelected(new CompositeEvent(parentObject));
    }
}
Also used : HTTPStatement(com.twinsoft.convertigo.beans.statements.HTTPStatement) Statement(com.twinsoft.convertigo.beans.core.Statement) ScEntryHandlerStatement(com.twinsoft.convertigo.beans.statements.ScEntryHandlerStatement) ScExitHandlerStatement(com.twinsoft.convertigo.beans.statements.ScExitHandlerStatement) ScHandlerStatement(com.twinsoft.convertigo.beans.statements.ScHandlerStatement) HandlerStatement(com.twinsoft.convertigo.beans.statements.HandlerStatement) NewObjectWizard(com.twinsoft.convertigo.eclipse.wizards.new_object.NewObjectWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent)

Example 17 with CompositeEvent

use of com.twinsoft.convertigo.eclipse.editors.CompositeEvent in project convertigo by convertigo.

the class HtmlConnectorDesignComposite method createScreenClassFromSelection.

public void createScreenClassFromSelection() throws EngineException {
    String className = "com.twinsoft.convertigo.beans.core.ScreenClass";
    // Retrieve selected criteria xpath
    String criteriaXpath = xpathEvaluator.getSelectionXpath();
    // Retrieve parent ScreenClass
    HtmlScreenClass parentObject = getParentHtmlScreenClass();
    NewObjectWizard newObjectWizard = new NewObjectWizard(parentObject, className);
    WizardDialog wzdlg = new WizardDialog(Display.getCurrent().getActiveShell(), newObjectWizard);
    wzdlg.setPageSize(850, 650);
    wzdlg.open();
    if (wzdlg.getReturnCode() != Window.CANCEL) {
        HtmlScreenClass htmlScreenClass = (HtmlScreenClass) newObjectWizard.newBean;
        if (htmlScreenClass != null) {
            String screenClassName = htmlScreenClass.getName();
            // Add criteria to screen class
            createCriteria(htmlScreenClass, criteriaXpath);
            // Set detected ScreenClass to newly created one
            if (htmlConnector.isLearning()) {
                detectedScreenClass = htmlScreenClass;
                ConvertigoPlugin.logDebug2("(HtmlConnectorDesignComposite) Detected screen class is set to newly created one named '" + screenClassName + "'");
            } else {
                ConvertigoPlugin.logDebug2("(HtmlConnectorDesignComposite) New screen class named '" + screenClassName + "' has been added");
            }
            // Reload parent ScreenClass in Tree
            fireObjectChanged(new CompositeEvent(parentObject));
            // Set selection on newly created screenclass
            fireObjectSelected(new CompositeEvent(htmlScreenClass));
            // Highlight new detected ScreenClass in Tree
            if (htmlConnector.isLearning())
                Engine.theApp.fireObjectDetected(new EngineEvent(htmlScreenClass));
        // TODO:toolScreenclass.setEnabled(false);
        }
    }
}
Also used : EngineEvent(com.twinsoft.convertigo.engine.EngineEvent) HtmlScreenClass(com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass) NewObjectWizard(com.twinsoft.convertigo.eclipse.wizards.new_object.NewObjectWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent)

Example 18 with CompositeEvent

use of com.twinsoft.convertigo.eclipse.editors.CompositeEvent in project convertigo by convertigo.

the class SapJcoConnectorDesignComposite method createBapiTransactions.

private void createBapiTransactions(final TableItem[] items) {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = display.getActiveShell();
    if (shell != null) {
        try {
            shell.setCursor(waitCursor);
            for (int i = 0; i < items.length; i++) {
                TableItem item = items[i];
                String bapiName = item.getText(0);
                String bapiDesc = item.getText(1);
                ConvertigoPlugin.logDebug("Creating transaction for BAPI '" + bapiName + "' ...");
                sapConnector.removeSerializedData(bapiName);
                SapJcoTransaction sapJcoTransaction = SapJcoConnector.createSapJcoTransaction(sapConnector, bapiName);
                if (sapJcoTransaction != null) {
                    Transaction transaction = sapConnector.getTransactionByName(bapiName);
                    if (transaction != null) {
                        try {
                            File xsdFile = new File(transaction.getSchemaFilePath());
                            if (xsdFile.exists()) {
                                xsdFile.delete();
                            }
                        } catch (Exception e) {
                        }
                        sapConnector.remove(transaction);
                    }
                    sapJcoTransaction.setComment(bapiDesc);
                    sapConnector.add(sapJcoTransaction);
                    fireObjectChanged(new CompositeEvent(sapConnector));
                    ConvertigoPlugin.logDebug("Transaction added.");
                }
            }
        } catch (Exception ee) {
            ConvertigoPlugin.logException(ee, "Error while creating transaction(s)");
        } finally {
            shell.setCursor(null);
            waitCursor.dispose();
        }
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) SapJcoTransaction(com.twinsoft.convertigo.beans.transactions.SapJcoTransaction) Transaction(com.twinsoft.convertigo.beans.core.Transaction) SapJcoTransaction(com.twinsoft.convertigo.beans.transactions.SapJcoTransaction) TableItem(org.eclipse.swt.widgets.TableItem) Cursor(org.eclipse.swt.graphics.Cursor) File(java.io.File) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) Display(org.eclipse.swt.widgets.Display)

Example 19 with CompositeEvent

use of com.twinsoft.convertigo.eclipse.editors.CompositeEvent in project convertigo by convertigo.

the class CreateDesignDocumentViewAction 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) {
            DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) explorerView.getFirstSelectedTreeObject();
            DesignDocumentViewTreeObject ddvto = ddto.addNewView();
            if (ddto.hasChanged()) {
                TreeParent treeParent = ddto.getParent();
                if (treeParent instanceof FolderTreeObject)
                    treeParent = treeParent.getParent();
                explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), ddvto.getPath()));
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to create a new view!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) Display(org.eclipse.swt.widgets.Display)

Example 20 with CompositeEvent

use of com.twinsoft.convertigo.eclipse.editors.CompositeEvent in project convertigo by convertigo.

the class CreateDesignDocumentViewReduceAction 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) {
            DesignDocumentViewTreeObject ddvto = (DesignDocumentViewTreeObject) explorerView.getFirstSelectedTreeObject();
            DesignDocumentFunctionTreeObject ddfto = ddvto.addReduce();
            DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) ddvto.getParent().getParent();
            if (ddto.hasChanged()) {
                TreeParent treeParent = ddto.getParent();
                if (treeParent instanceof FolderTreeObject)
                    treeParent = treeParent.getParent();
                explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), ddfto.getPath()));
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to create a reduce function!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) Display(org.eclipse.swt.widgets.Display)

Aggregations

CompositeEvent (com.twinsoft.convertigo.eclipse.editors.CompositeEvent)33 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)19 Shell (org.eclipse.swt.widgets.Shell)18 Cursor (org.eclipse.swt.graphics.Cursor)17 Display (org.eclipse.swt.widgets.Display)17 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)10 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)10 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)10 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)9 FolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject)9 WizardDialog (org.eclipse.jface.wizard.WizardDialog)7 HtmlScreenClass (com.twinsoft.convertigo.beans.screenclasses.HtmlScreenClass)5 DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)5 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)5 Transaction (com.twinsoft.convertigo.beans.core.Transaction)4 NewObjectWizard (com.twinsoft.convertigo.eclipse.wizards.new_object.NewObjectWizard)4 File (java.io.File)4 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)3 Sequence (com.twinsoft.convertigo.beans.core.Sequence)3 Step (com.twinsoft.convertigo.beans.core.Step)3