Search in sources :

Example 96 with ProjectExplorerView

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

the class ChangeToQueryParameterAction 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();
            Object databaseObject = treeObject.getObject();
            if ((databaseObject != null) && (databaseObject instanceof UrlMappingParameter)) {
                UrlMappingParameter parameter = (UrlMappingParameter) databaseObject;
                TreeParent treeParent = treeObject.getParent();
                DatabaseObjectTreeObject parentTreeObject = null;
                if (treeParent instanceof DatabaseObjectTreeObject)
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent;
                else
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent.getParent();
                if (parentTreeObject != null) {
                    // Create new Query parameter
                    QueryParameter queryParameter = new QueryParameter();
                    if (DatabaseObjectsManager.acceptDatabaseObjects(parameter.getParent(), queryParameter)) {
                        queryParameter.setComment(parameter.getComment());
                        queryParameter.setInputType(parameter.getInputType());
                        queryParameter.setArray(parameter.isArray());
                        queryParameter.setExposed(parameter.isExposed());
                        queryParameter.setMultiValued(parameter.isMultiValued());
                        queryParameter.setRequired(parameter.isRequired());
                        queryParameter.setValueOrNull(parameter.getValueOrNull());
                        queryParameter.setMappedVariableName(parameter.getMappedVariableName());
                        queryParameter.bNew = true;
                        queryParameter.hasChanged = true;
                        // Add new parameter to parent operation
                        UrlMappingOperation operation = (UrlMappingOperation) parameter.getParent();
                        operation.changeTo(queryParameter);
                        // Add new parameter in Tree
                        UrlMappingParameterTreeObject parameterTreeObject = new UrlMappingParameterTreeObject(explorerView.viewer, queryParameter);
                        treeParent.addChild(parameterTreeObject);
                        // Delete old parameter
                        parameter.delete();
                        // Rename new parameter
                        queryParameter.setName(parameter.getName());
                        // Reload in tree
                        parentTreeObject.hasBeenModified(true);
                        explorerView.reloadTreeObject(parentTreeObject);
                        explorerView.setSelectedTreeObject(explorerView.findTreeObjectByUserObject(queryParameter));
                    } else {
                        throw new EngineException("You cannot paste to a " + parameter.getParent().getClass().getSimpleName() + " a database object of type " + queryParameter.getClass().getSimpleName());
                    }
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to change to Query parameter!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : QueryParameter(com.twinsoft.convertigo.beans.rest.QueryParameter) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) UrlMappingOperation(com.twinsoft.convertigo.beans.core.UrlMappingOperation) UrlMappingParameter(com.twinsoft.convertigo.beans.core.UrlMappingParameter) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) EngineException(com.twinsoft.convertigo.engine.EngineException) Cursor(org.eclipse.swt.graphics.Cursor) Shell(org.eclipse.swt.widgets.Shell) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) UrlMappingParameterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingParameterTreeObject) Display(org.eclipse.swt.widgets.Display)

Example 97 with ProjectExplorerView

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

the class ChangeToSourceStepAction method run.

/* (non-Javadoc)
	 * @see com.twinsoft.convertigo.eclipse.popup.actions.MyAbstractAction#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();
            Object databaseObject = treeObject.getObject();
            if ((databaseObject != null) && (databaseObject instanceof SimpleSourceStep)) {
                SimpleSourceStep jSimpleSourceStep = (SimpleSourceStep) databaseObject;
                TreeParent treeParent = treeObject.getParent();
                DatabaseObjectTreeObject parentTreeObject = null;
                if (treeParent instanceof DatabaseObjectTreeObject)
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent;
                else
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent.getParent();
                if (parentTreeObject != null) {
                    // New jSource step
                    SourceStep jSourceStep = new SourceStep();
                    // Set properties
                    jSourceStep.setSourceDefinition(jSimpleSourceStep.getSourceDefinition());
                    jSourceStep.setComment(jSimpleSourceStep.getComment());
                    jSourceStep.setVariableName(jSimpleSourceStep.getVariableName());
                    jSourceStep.setEnabled(jSimpleSourceStep.isEnabled());
                    jSourceStep.setOutput(jSimpleSourceStep.isOutput());
                    jSourceStep.setName(jSimpleSourceStep.getName());
                    jSourceStep.bNew = true;
                    jSourceStep.hasChanged = true;
                    // Add new jSource step to parent
                    DatabaseObject parentDbo = jSimpleSourceStep.getParent();
                    parentDbo.add(jSourceStep);
                    // Set correct order
                    if (parentDbo instanceof StepWithExpressions)
                        ((StepWithExpressions) parentDbo).insertAtOrder(jSourceStep, jSimpleSourceStep.priority);
                    else if (parentDbo instanceof Sequence)
                        ((Sequence) parentDbo).insertAtOrder(jSourceStep, jSimpleSourceStep.priority);
                    // Add new jSource step in Tree
                    StepTreeObject stepTreeObject = new StepTreeObject(explorerView.viewer, jSourceStep);
                    treeParent.addChild(stepTreeObject);
                    // Delete jSimpleSource step
                    long oldPriority = jSimpleSourceStep.priority;
                    jSimpleSourceStep.delete();
                    // Simulate move of jSimpleSource to jSource step
                    jSourceStep.getSequence().fireStepMoved(new StepEvent(jSourceStep, String.valueOf(oldPriority)));
                    parentTreeObject.hasBeenModified(true);
                    explorerView.reloadTreeObject(parentTreeObject);
                    explorerView.setSelectedTreeObject(explorerView.findTreeObjectByUserObject(jSourceStep));
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to change step to jSource step!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : StepEvent(com.twinsoft.convertigo.beans.core.StepEvent) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) StepWithExpressions(com.twinsoft.convertigo.beans.core.StepWithExpressions) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Cursor(org.eclipse.swt.graphics.Cursor) SimpleSourceStep(com.twinsoft.convertigo.beans.steps.SimpleSourceStep) Shell(org.eclipse.swt.widgets.Shell) SourceStep(com.twinsoft.convertigo.beans.steps.SourceStep) SimpleSourceStep(com.twinsoft.convertigo.beans.steps.SimpleSourceStep) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) 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) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) Display(org.eclipse.swt.widgets.Display)

Example 98 with ProjectExplorerView

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

the class AbstractStubAction 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;
                Sequence sequence = sequenceTreeObject.getObject();
                File stubDir = new File(sequence.getProject().getDirPath() + "/stubs");
                stubDir.mkdirs();
                File stubFile = new File(stubDir, sequence.getName() + ".xml");
                Document dom = getXML(treeObject);
                writeStub(dom, stubFile);
            } else if ((treeObject != null) && (treeObject instanceof TransactionTreeObject)) {
                TransactionTreeObject transactionTreeObject = (TransactionTreeObject) treeObject;
                Transaction transaction = transactionTreeObject.getObject();
                File stubDir = new File(transaction.getProject().getDirPath() + "/stubs");
                stubDir.mkdirs();
                File stubFile = new File(stubDir, transaction.getParent().getName() + "." + transaction.getName() + ".xml");
                Document dom = getXML(treeObject);
                writeStub(dom, stubFile);
            }
        }
    } catch (NoSuchElementException e) {
        ConvertigoPlugin.logException(e, "No previous XML file found");
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to execute the selected sequence!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Cursor(org.eclipse.swt.graphics.Cursor) Document(org.w3c.dom.Document) Shell(org.eclipse.swt.widgets.Shell) Transaction(com.twinsoft.convertigo.beans.core.Transaction) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) File(java.io.File) NoSuchElementException(java.util.NoSuchElementException) Display(org.eclipse.swt.widgets.Display)

Example 99 with ProjectExplorerView

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

the class BuildLocallyAction method build.

/**
 * Function which made the build
 * @param option
 * @param run
 * @param target
 */
public void build(final String option, final boolean run, final String target) {
    Cursor waitCursor = null;
    if (parentShell != null) {
        waitCursor = new Cursor(ConvertigoPlugin.getDisplay(), SWT.CURSOR_WAIT);
        parentShell.setCursor(waitCursor);
    }
    try {
        if (mobilePlatform != null) {
            // Check endpoint url is empty or not
            MobileApplication mobileApplication = mobilePlatform.getObject().getParent();
            String[] exEndpoint = { mobileApplication.getEndpoint() };
            String[] curEndpoint = { exEndpoint[0] };
            try {
                MobileApplicationEndpointEditorComposite[] mob = new MobileApplicationEndpointEditorComposite[1];
                Dialog dialog = new Dialog(parentShell) {

                    @Override
                    protected void createButtonsForButtonBar(Composite parent) {
                        createButton(parent, IDialogConstants.OK_ID, "Build (temporary end point)", true);
                        createButton(parent, IDialogConstants.FINISH_ID, "Build (permanent end point)", false);
                        createButton(parent, IDialogConstants.CANCEL_ID, "Cancel Build", false);
                    }

                    @Override
                    protected void buttonPressed(int buttonId) {
                        super.buttonPressed(buttonId);
                        if (IDialogConstants.FINISH_ID == buttonId) {
                            setReturnCode(buttonId);
                            close();
                        }
                    }

                    @Override
                    protected Control createDialogArea(Composite parent) {
                        Composite composite = (Composite) super.createDialogArea(parent);
                        mob[0] = new MobileApplicationEndpointEditorComposite(composite, SWT.NONE, mobileApplication);
                        return composite;
                    }
                };
                int code = dialog.open();
                if (code == Dialog.OK || code == IDialogConstants.FINISH_ID) {
                    curEndpoint[0] = mob[0].getValue();
                } else {
                    return;
                }
                if (code == IDialogConstants.FINISH_ID) {
                    String s = mobileApplication.getEndpoint();
                    if (!s.equals(curEndpoint[0])) {
                        mobileApplication.setEndpoint(curEndpoint[0]);
                        mobilePlatform.getParentDatabaseObjectTreeObject().hasBeenModified(true);
                        ProjectExplorerView explorerView = getProjectExplorerView();
                        if (explorerView != null) {
                            ConvertigoPlugin.getDisplay().asyncExec(() -> {
                                explorerView.viewer.refresh(mobilePlatform.getProjectTreeObject(), true);
                            });
                        }
                    }
                    exEndpoint[0] = null;
                }
            } catch (Exception e) {
            }
            if (curEndpoint[0].equals("")) {
                if (parentShell != null) {
                    MessageBox informDialog = new MessageBox(parentShell, SWT.ICON_INFORMATION | SWT.OK);
                    informDialog.setText("Endpoint URL is empty");
                    informDialog.setMessage("You need to have an endpoint URL to continue the local build.\n" + "Please enter a valid endpoint URL in the property \"Convertigo server endpoint\" present on \"" + mobileApplication.getName() + "\" object.");
                    informDialog.open();
                } else {
                // TODO
                }
                return;
            }
            IApplicationComponent app = mobileApplication.getApplicationComponent();
            String msg = app != null ? app.getUnbuiltMessage() : null;
            if (msg != null && parentShell != null) {
                MessageBox informDialog = new MessageBox(parentShell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
                informDialog.setText("Application not ready");
                informDialog.setMessage(msg + "\nThen launch the Local Build again.\n" + "Do you want to build now anyway?");
                int result = informDialog.open();
                if (result == SWT.NO) {
                    return;
                }
            }
            // OK we are sure we have a Cordova environment.. Start the build
            Job buildJob = new Job("Local Cordova Build " + (run ? "and Run " : "") + "in progress...") {

                @Override
                protected IStatus run(IProgressMonitor progressMonitor) {
                    BuildLocally.Status status = buildLocally.installCordova();
                    if (status == BuildLocally.Status.CANCEL) {
                        return org.eclipse.core.runtime.Status.CANCEL_STATUS;
                    }
                    try {
                        mobileApplication.setEndpoint(curEndpoint[0]);
                        status = buildLocally.runBuild(option, run, target);
                        if (status == BuildLocally.Status.OK) {
                            return org.eclipse.core.runtime.Status.OK_STATUS;
                        }
                        return org.eclipse.core.runtime.Status.CANCEL_STATUS;
                    } finally {
                        if (exEndpoint[0] != null) {
                            mobileApplication.setEndpoint(exEndpoint[0]);
                        }
                    }
                }

                @Override
                protected void canceling() {
                    buildLocally.cancelBuild(run);
                }
            };
            buildJob.setUser(true);
            buildJob.schedule();
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to build locally with Cordova");
    } finally {
        parentShell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : BuildLocally(com.twinsoft.convertigo.engine.localbuild.BuildLocally) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) MobileApplicationEndpointEditorComposite(com.twinsoft.convertigo.eclipse.property_editors.MobileApplicationEndpointEditorComposite) Composite(org.eclipse.swt.widgets.Composite) Cursor(org.eclipse.swt.graphics.Cursor) MessageBox(org.eclipse.swt.widgets.MessageBox) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) MobileApplication(com.twinsoft.convertigo.beans.core.MobileApplication) Dialog(org.eclipse.jface.dialogs.Dialog) BuildLocallyEndingDialog(com.twinsoft.convertigo.eclipse.dialogs.BuildLocallyEndingDialog) MobileApplicationEndpointEditorComposite(com.twinsoft.convertigo.eclipse.property_editors.MobileApplicationEndpointEditorComposite) Job(org.eclipse.core.runtime.jobs.Job) IApplicationComponent(com.twinsoft.convertigo.beans.core.IApplicationComponent)

Example 100 with ProjectExplorerView

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

the class ChangeToAttributeStepAction method run.

/* (non-Javadoc)
	 * @see com.twinsoft.convertigo.eclipse.popup.actions.MyAbstractAction#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();
            Object databaseObject = treeObject.getObject();
            // XMLAttribute
            if ((databaseObject != null) && (databaseObject instanceof XMLAttributeStep)) {
                XMLAttributeStep xmlAttributeStep = (XMLAttributeStep) databaseObject;
                TreeParent treeParent = treeObject.getParent();
                DatabaseObjectTreeObject parentTreeObject = null;
                if (treeParent instanceof DatabaseObjectTreeObject)
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent;
                else
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent.getParent();
                if (parentTreeObject != null) {
                    // New Attribute step
                    AttributeStep attributeStep = new AttributeStep();
                    if (DatabaseObjectsManager.acceptDatabaseObjects(xmlAttributeStep.getParent(), attributeStep)) {
                        // Set properties
                        attributeStep.setOutput(xmlAttributeStep.isOutput());
                        attributeStep.setEnabled(xmlAttributeStep.isEnabled());
                        attributeStep.setComment(xmlAttributeStep.getComment());
                        // attributeStep.setExpression(elementStep.getExpression());
                        attributeStep.setNodeText(xmlAttributeStep.getNodeText());
                        attributeStep.setNodeName(xmlAttributeStep.getNodeName());
                        attributeStep.bNew = true;
                        attributeStep.hasChanged = true;
                        // Add new Attribute step to parent
                        DatabaseObject parentDbo = xmlAttributeStep.getParent();
                        parentDbo.add(attributeStep);
                        // Set correct order
                        if (parentDbo instanceof StepWithExpressions)
                            ((StepWithExpressions) parentDbo).insertAtOrder(attributeStep, xmlAttributeStep.priority);
                        else if (parentDbo instanceof Sequence)
                            ((Sequence) parentDbo).insertAtOrder(attributeStep, xmlAttributeStep.priority);
                        // Add new Attribute step in Tree
                        StepTreeObject stepTreeObject = new StepTreeObject(explorerView.viewer, xmlAttributeStep);
                        treeParent.addChild(stepTreeObject);
                        // Delete Element step
                        long oldPriority = xmlAttributeStep.priority;
                        xmlAttributeStep.delete();
                        attributeStep.getSequence().fireStepMoved(new StepEvent(attributeStep, String.valueOf(oldPriority)));
                        parentTreeObject.hasBeenModified(true);
                        explorerView.reloadTreeObject(parentTreeObject);
                        explorerView.setSelectedTreeObject(explorerView.findTreeObjectByUserObject(attributeStep));
                    } else {
                        throw new EngineException("You cannot paste to a " + xmlAttributeStep.getParent().getClass().getSimpleName() + " a database object of type " + attributeStep.getClass().getSimpleName());
                    }
                }
            }
            // Element
            if ((databaseObject != null) && (databaseObject instanceof ElementStep)) {
                ElementStep elementStep = (ElementStep) databaseObject;
                TreeParent treeParent = treeObject.getParent();
                DatabaseObjectTreeObject parentTreeObject = null;
                if (treeParent instanceof DatabaseObjectTreeObject)
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent;
                else
                    parentTreeObject = (DatabaseObjectTreeObject) treeParent.getParent();
                if (parentTreeObject != null) {
                    // New Attribute step
                    AttributeStep attributeStep = new AttributeStep();
                    if (DatabaseObjectsManager.acceptDatabaseObjects(elementStep.getParent(), attributeStep)) {
                        // Set properties
                        attributeStep.setOutput(elementStep.isOutput());
                        attributeStep.setEnabled(elementStep.isEnabled());
                        attributeStep.setComment(elementStep.getComment());
                        attributeStep.setExpression(elementStep.getExpression());
                        attributeStep.setNodeText(elementStep.getNodeText());
                        attributeStep.setNodeName(elementStep.getNodeName());
                        attributeStep.bNew = true;
                        attributeStep.hasChanged = true;
                        // Add new Attribute step to parent
                        DatabaseObject parentDbo = elementStep.getParent();
                        parentDbo.add(attributeStep);
                        // Set correct order
                        if (parentDbo instanceof StepWithExpressions)
                            ((StepWithExpressions) parentDbo).insertAtOrder(attributeStep, elementStep.priority);
                        else if (parentDbo instanceof Sequence)
                            ((Sequence) parentDbo).insertAtOrder(attributeStep, elementStep.priority);
                        // Add new Attribute step in Tree
                        StepTreeObject stepTreeObject = new StepTreeObject(explorerView.viewer, elementStep);
                        treeParent.addChild(stepTreeObject);
                        // Delete Element step
                        long oldPriority = elementStep.priority;
                        elementStep.delete();
                        attributeStep.getSequence().fireStepMoved(new StepEvent(attributeStep, String.valueOf(oldPriority)));
                        parentTreeObject.hasBeenModified(true);
                        explorerView.reloadTreeObject(parentTreeObject);
                        explorerView.setSelectedTreeObject(explorerView.findTreeObjectByUserObject(attributeStep));
                    } else {
                        throw new EngineException("You cannot paste to a " + elementStep.getParent().getClass().getSimpleName() + " a database object of type " + attributeStep.getClass().getSimpleName());
                    }
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to change to Attribute step!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : StepEvent(com.twinsoft.convertigo.beans.core.StepEvent) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) StepWithExpressions(com.twinsoft.convertigo.beans.core.StepWithExpressions) EngineException(com.twinsoft.convertigo.engine.EngineException) XMLAttributeStep(com.twinsoft.convertigo.beans.steps.XMLAttributeStep) Sequence(com.twinsoft.convertigo.beans.core.Sequence) Cursor(org.eclipse.swt.graphics.Cursor) Shell(org.eclipse.swt.widgets.Shell) AttributeStep(com.twinsoft.convertigo.beans.steps.AttributeStep) XMLAttributeStep(com.twinsoft.convertigo.beans.steps.XMLAttributeStep) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) 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) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) ElementStep(com.twinsoft.convertigo.beans.steps.ElementStep) Display(org.eclipse.swt.widgets.Display)

Aggregations

ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)175 Cursor (org.eclipse.swt.graphics.Cursor)144 Display (org.eclipse.swt.widgets.Display)144 Shell (org.eclipse.swt.widgets.Shell)144 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)113 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)73 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)49 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)38 Sequence (com.twinsoft.convertigo.beans.core.Sequence)35 EngineException (com.twinsoft.convertigo.engine.EngineException)26 Project (com.twinsoft.convertigo.beans.core.Project)24 Step (com.twinsoft.convertigo.beans.core.Step)22 TreeObjectEvent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent)22 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)22 StepTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject)21 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)19 CompositeEvent (com.twinsoft.convertigo.eclipse.editors.CompositeEvent)19 StepEvent (com.twinsoft.convertigo.beans.core.StepEvent)15 Transaction (com.twinsoft.convertigo.beans.core.Transaction)14 File (java.io.File)14