Search in sources :

Example 1 with DesignDocumentTreeObject

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

the class CreateDesignDocumentFilterAction 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();
            DesignDocumentFilterTreeObject ddfto = ddto.addNewFilter();
            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 new filter!");
    } 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) 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) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)

Example 2 with DesignDocumentTreeObject

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

the class CreateDesignDocumentValidateAction 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();
            DesignDocumentValidateTreeObject ddvto = ddto.addNewValidate();
            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 Validate!");
    } 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) Cursor(org.eclipse.swt.graphics.Cursor) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) Display(org.eclipse.swt.widgets.Display)

Example 3 with DesignDocumentTreeObject

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

the class CreateDesignDocumentUpdateAction 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();
            DesignDocumentUpdateTreeObject dduto = ddto.addNewUpdate();
            if (ddto.hasChanged()) {
                TreeParent treeParent = ddto.getParent();
                if (treeParent instanceof FolderTreeObject)
                    treeParent = treeParent.getParent();
                explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), dduto.getPath()));
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to create a new update!");
    } 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) 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) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)

Example 4 with DesignDocumentTreeObject

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

the class CreateDesignDocumentUpdateAction 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 DesignDocumentTreeObject) {
        action.setText(((DesignDocumentTreeObject) treeObject).getDefaultUpdateName());
    }
}
Also used : DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 5 with DesignDocumentTreeObject

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

the class DeleteDesignDocumentViewAction 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) {
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            if (treeObjects != null) {
                HashSet<TreeParent> treeParentToReload = new HashSet<TreeParent>();
                HashSet<TreeParent> treeParentToRefresh = new HashSet<TreeParent>();
                int len = treeObjects.length;
                for (int i = 0; i < len; i++) {
                    try {
                        DesignDocumentViewTreeObject ddvto = (DesignDocumentViewTreeObject) treeObjects[i];
                        if (ddvto != null) {
                            MessageBox messageBox = new MessageBox(shell, SWT.YES | SWT.NO | SWT.CANCEL | SWT.ICON_QUESTION | SWT.APPLICATION_MODAL);
                            String message = java.text.MessageFormat.format("Do you really want to delete the object \"{0}\" and all its sub-objects?", new Object[] { ddvto.getName() });
                            messageBox.setMessage(message);
                            if (messageBox.open() == SWT.YES) {
                                DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) ddvto.getParent().getParent();
                                if (ddto != null) {
                                    TreeParent owner = ddto;
                                    ddto.removeView(ddvto);
                                    if (owner instanceof DatabaseObjectTreeObject) {
                                        DatabaseObjectTreeObject databaseObjectTreeObject = (DatabaseObjectTreeObject) owner;
                                        if (databaseObjectTreeObject.hasChanged()) {
                                            TreeParent treeParent = databaseObjectTreeObject.getParent();
                                            if (treeParent instanceof FolderTreeObject)
                                                treeParent = treeParent.getParent();
                                            treeParentToReload.add(treeParent);
                                        }
                                    } else
                                        treeParentToRefresh.add(owner);
                                }
                            }
                        }
                    } catch (ClassCastException e) {
                    }
                }
                for (TreeParent treeParent : treeParentToReload) {
                    explorerView.reloadTreeObject(treeParent);
                }
                for (TreeParent owner : treeParentToRefresh) {
                    explorerView.refreshTreeObject(owner, true);
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to delete view!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : 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) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) MessageBox(org.eclipse.swt.widgets.MessageBox) Shell(org.eclipse.swt.widgets.Shell) 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) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) Display(org.eclipse.swt.widgets.Display) HashSet(java.util.HashSet)

Aggregations

DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)13 FolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject)10 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)8 Shell (org.eclipse.swt.widgets.Shell)8 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)7 DesignDocumentViewTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject)7 Cursor (org.eclipse.swt.graphics.Cursor)7 Display (org.eclipse.swt.widgets.Display)7 CompositeEvent (com.twinsoft.convertigo.eclipse.editors.CompositeEvent)6 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)6 DesignDocumentFilterTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)4 DesignDocumentUpdateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)4 DesignDocumentValidateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject)4 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)3 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)3 DesignDocumentFunctionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)2 HandlerStatement (com.twinsoft.convertigo.beans.statements.HandlerStatement)2 RequestableVariable (com.twinsoft.convertigo.beans.variables.RequestableVariable)2