Search in sources :

Example 21 with TreeObject

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

the class ImportWizard method performFinish.

/* (non-Javadoc)
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
	 */
public boolean performFinish() {
    ProjectExplorerView explorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
    ProjectUrlParser parser = fileChooserPage.getParser();
    String filePath = fileChooserPage.getFilePath();
    if (parser.isValid()) {
        ConvertigoPlugin.infoMessageBox("Loading " + parser.getProjectName() + " in a background job.");
        Job.create("Import project " + parser.getProjectName(), (mon) -> {
            try {
                Project project = Engine.theApp.referencedProjectManager.importProject(parser, true);
                if (project != null) {
                    TreeObject tree = explorerView.getProjectRootObject(project.getName());
                    if (tree != null) {
                        explorerView.reloadProject(tree);
                    }
                    explorerView.refreshProjects();
                }
            } catch (Exception e) {
                Engine.logStudio.debug("Loading from remote URL failed", e);
            }
        }).schedule();
    }
    try {
        if (explorerView != null) {
            if (filePath != null) {
                explorerView.importProject(filePath, getTargetProjectName());
            }
        }
    } catch (Exception e) {
        ConvertigoPlugin.logException(e, "Unable to import project !");
    }
    return true;
}
Also used : IWizardPage(org.eclipse.jface.wizard.IWizardPage) Job(org.eclipse.core.runtime.jobs.Job) Engine(com.twinsoft.convertigo.engine.Engine) DatabaseObjectsManager(com.twinsoft.convertigo.engine.DatabaseObjectsManager) IOException(java.io.IOException) Wizard(org.eclipse.jface.wizard.Wizard) ProjectUrlParser(com.twinsoft.convertigo.engine.util.ProjectUrlParser) IImportWizard(org.eclipse.ui.IImportWizard) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) File(java.io.File) Project(com.twinsoft.convertigo.beans.core.Project) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) ConvertigoPlugin(com.twinsoft.convertigo.eclipse.ConvertigoPlugin) ZipUtils(com.twinsoft.convertigo.engine.util.ZipUtils) IWorkbench(org.eclipse.ui.IWorkbench) EngineException(com.twinsoft.convertigo.engine.EngineException) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ProjectUrlParser(com.twinsoft.convertigo.engine.util.ProjectUrlParser) Project(com.twinsoft.convertigo.beans.core.Project) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) IOException(java.io.IOException) EngineException(com.twinsoft.convertigo.engine.EngineException)

Example 22 with TreeObject

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

the class DeleteDesignDocumentFunctionAction 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 {
                        DesignDocumentFunctionTreeObject ddfto = (DesignDocumentFunctionTreeObject) treeObjects[i];
                        if (ddfto != 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[] { ddfto.getName() });
                            messageBox.setMessage(message);
                            if (messageBox.open() == SWT.YES) {
                                TreeParent owner = ddfto.getTreeObjectOwner();
                                IDesignTreeObject dto = ddfto.getParentDesignTreeObject();
                                if (dto != null) {
                                    dto.remove(ddfto);
                                }
                                if (owner != null) {
                                    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 function!");
    } 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) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) Cursor(org.eclipse.swt.graphics.Cursor) MessageBox(org.eclipse.swt.widgets.MessageBox) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) Shell(org.eclipse.swt.widgets.Shell) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DesignDocumentValidateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject) IDesignTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IDesignTreeObject) DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) 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)

Example 23 with TreeObject

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

Example 24 with TreeObject

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

the class DeletePropertyTableColumnAction 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 {
                        PropertyTableColumnTreeObject propertyTableColumnTreeObject = (PropertyTableColumnTreeObject) treeObjects[i];
                        if (propertyTableColumnTreeObject != 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[] { propertyTableColumnTreeObject.getName() });
                            messageBox.setMessage(message);
                            if (messageBox.open() == SWT.YES) {
                                PropertyTableRowTreeObject propertyTableRowTreeObject = (PropertyTableRowTreeObject) propertyTableColumnTreeObject.getParent();
                                TreeParent owner = propertyTableRowTreeObject.getParent().getParent();
                                propertyTableRowTreeObject.removeColumn(propertyTableColumnTreeObject);
                                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 column!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) 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) Cursor(org.eclipse.swt.graphics.Cursor) MessageBox(org.eclipse.swt.widgets.MessageBox) Shell(org.eclipse.swt.widgets.Shell) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) 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) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) Display(org.eclipse.swt.widgets.Display) HashSet(java.util.HashSet)

Example 25 with TreeObject

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

the class DeletePropertyTableRowAction 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 {
                        PropertyTableRowTreeObject propertyTableRowTreeObject = (PropertyTableRowTreeObject) treeObjects[i];
                        if (propertyTableRowTreeObject != 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[] { propertyTableRowTreeObject.getName() });
                            messageBox.setMessage(message);
                            if (messageBox.open() == SWT.YES) {
                                PropertyTableTreeObject propertyTableTreeObject = (PropertyTableTreeObject) propertyTableRowTreeObject.getParent();
                                TreeParent owner = propertyTableTreeObject.getParent();
                                propertyTableTreeObject.removeRow(propertyTableRowTreeObject);
                                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 row!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) 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) Cursor(org.eclipse.swt.graphics.Cursor) MessageBox(org.eclipse.swt.widgets.MessageBox) Shell(org.eclipse.swt.widgets.Shell) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) Display(org.eclipse.swt.widgets.Display) HashSet(java.util.HashSet)

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