Search in sources :

Example 6 with TreeObjectEvent

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

the class UnloadedProjectDeleteAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    MultipleDeletionDialog dialog;
    try {
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            if (treeObjects.length == 1) {
                dialog = new MultipleDeletionDialog(shell, "Project Deletion", false);
            } else {
                dialog = new MultipleDeletionDialog(shell, "Project Deletion", true);
            }
            dialog.setToggle("Delete project content on disk (cannot be undone)", false);
            if (treeObjects != null && treeObjects.length > 0) {
                for (TreeObject treeObject : treeObjects) {
                    if (treeObject instanceof UnloadedProjectTreeObject) {
                        String projectName = ((UnloadedProjectTreeObject) treeObject).getName();
                        if (dialog.shouldBeDeleted("Do you really want to delete the project \"" + projectName + "\" and all its sub-objects?")) {
                            // Deleted project will be backup, car will be deleted to avoid its deployment at engine restart
                            // Engine.theApp.databaseObjectsManager.deleteProject(projectName);
                            Job rmProject = new Job("Remove '" + projectName + "' project") {

                                @Override
                                protected IStatus run(IProgressMonitor monitor) {
                                    try {
                                        if (dialog.getToggleState()) {
                                            Engine.theApp.databaseObjectsManager.deleteProjectAndCar(projectName);
                                        }
                                        ConvertigoPlugin.getDefault().deleteProjectPluginResource(dialog.getToggleState(), projectName);
                                    } catch (Exception e) {
                                        ConvertigoPlugin.logException(e, "Unable to delete the '" + projectName + "' project.");
                                        return new MultiStatus(ConvertigoPlugin.PLUGIN_UNIQUE_ID, IStatus.ERROR, "Failed to remove the '" + projectName + "' project.", e);
                                    }
                                    return Status.OK_STATUS;
                                }
                            };
                            rmProject.schedule();
                            explorerView.removeProjectTreeObject(treeObject);
                            explorerView.fireTreeObjectRemoved(new TreeObjectEvent(treeObject));
                        }
                    }
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to delete the project!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) MultiStatus(org.eclipse.core.runtime.MultiStatus) MultipleDeletionDialog(com.twinsoft.convertigo.eclipse.dialogs.MultipleDeletionDialog) Cursor(org.eclipse.swt.graphics.Cursor) Shell(org.eclipse.swt.widgets.Shell) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) Job(org.eclipse.core.runtime.jobs.Job) Display(org.eclipse.swt.widgets.Display)

Example 7 with TreeObjectEvent

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

the class EnableMobilePageComponentAction 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) {
            DatabaseObjectTreeObject treeObject = null;
            PageComponent component = null;
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            for (int i = treeObjects.length - 1; i >= 0; i--) {
                treeObject = (DatabaseObjectTreeObject) treeObjects[i];
                if (treeObject instanceof MobilePageComponentTreeObject) {
                    MobilePageComponentTreeObject componentTreeObject = (MobilePageComponentTreeObject) treeObject;
                    component = (PageComponent) componentTreeObject.getObject();
                    component.setEnabled(true);
                    componentTreeObject.setEnabled(true);
                    componentTreeObject.hasBeenModified(true);
                    TreeObjectEvent treeObjectEvent = new TreeObjectEvent(componentTreeObject, "isEnabled", false, true);
                    explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
                }
            }
            explorerView.refreshSelectedTreeObjects();
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to enable page!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) MobilePageComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobilePageComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) Cursor(org.eclipse.swt.graphics.Cursor) PageComponent(com.twinsoft.convertigo.beans.mobile.components.PageComponent) Display(org.eclipse.swt.widgets.Display)

Example 8 with TreeObjectEvent

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

the class EnableMobileRouteComponentAction 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) {
            DatabaseObjectTreeObject treeObject = null;
            RouteComponent component = null;
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            for (int i = treeObjects.length - 1; i >= 0; i--) {
                treeObject = (DatabaseObjectTreeObject) treeObjects[i];
                if (treeObject instanceof MobileRouteComponentTreeObject) {
                    MobileRouteComponentTreeObject componentTreeObject = (MobileRouteComponentTreeObject) treeObject;
                    component = (RouteComponent) componentTreeObject.getObject();
                    component.setEnabled(true);
                    componentTreeObject.setEnabled(true);
                    componentTreeObject.hasBeenModified(true);
                    TreeObjectEvent treeObjectEvent = new TreeObjectEvent(componentTreeObject, "isEnabled", false, true);
                    explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
                }
            }
            explorerView.refreshSelectedTreeObjects();
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to enable route!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) RouteComponent(com.twinsoft.convertigo.beans.mobile.components.RouteComponent) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) MobileRouteComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteComponentTreeObject) MobileRouteComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 9 with TreeObjectEvent

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

the class EnableMobileUIComponentAction 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) {
            DatabaseObjectTreeObject treeObject = null;
            UIComponent component = null;
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            for (int i = treeObjects.length - 1; i >= 0; i--) {
                treeObject = (DatabaseObjectTreeObject) treeObjects[i];
                if (treeObject instanceof MobileUIComponentTreeObject) {
                    MobileUIComponentTreeObject componentTreeObject = (MobileUIComponentTreeObject) treeObject;
                    component = (UIComponent) componentTreeObject.getObject();
                    component.setEnabled(true);
                    componentTreeObject.setEnabled(true);
                    componentTreeObject.hasBeenModified(true);
                    TreeObjectEvent treeObjectEvent = new TreeObjectEvent(componentTreeObject, "isEnabled", false, true);
                    explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
                }
            }
            explorerView.refreshSelectedTreeObjects();
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to enable component!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) UIComponent(com.twinsoft.convertigo.beans.mobile.components.UIComponent) MobileUIComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Example 10 with TreeObjectEvent

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

the class EnableMobileRouteActionComponentAction 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) {
            DatabaseObjectTreeObject treeObject = null;
            RouteActionComponent component = null;
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            for (int i = treeObjects.length - 1; i >= 0; i--) {
                treeObject = (DatabaseObjectTreeObject) treeObjects[i];
                if (treeObject instanceof MobileRouteActionComponentTreeObject) {
                    MobileRouteActionComponentTreeObject componentTreeObject = (MobileRouteActionComponentTreeObject) treeObject;
                    component = (RouteActionComponent) componentTreeObject.getObject();
                    component.setEnabled(true);
                    componentTreeObject.setEnabled(true);
                    componentTreeObject.hasBeenModified(true);
                    TreeObjectEvent treeObjectEvent = new TreeObjectEvent(componentTreeObject, "isEnabled", false, true);
                    explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
                }
            }
            explorerView.refreshSelectedTreeObjects();
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to enable action!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) RouteActionComponent(com.twinsoft.convertigo.beans.mobile.components.RouteActionComponent) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) MobileRouteActionComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteActionComponentTreeObject) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) Cursor(org.eclipse.swt.graphics.Cursor) MobileRouteActionComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteActionComponentTreeObject) Display(org.eclipse.swt.widgets.Display)

Aggregations

TreeObjectEvent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent)33 Display (org.eclipse.swt.widgets.Display)22 Shell (org.eclipse.swt.widgets.Shell)22 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)21 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)21 Cursor (org.eclipse.swt.graphics.Cursor)21 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)20 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)8 ArrayList (java.util.ArrayList)6 PageComponent (com.twinsoft.convertigo.beans.mobile.components.PageComponent)5 Sequence (com.twinsoft.convertigo.beans.core.Sequence)4 PageComponent (com.twinsoft.convertigo.beans.ngx.components.PageComponent)4 EngineException (com.twinsoft.convertigo.engine.EngineException)4 CoreException (org.eclipse.core.runtime.CoreException)4 FullSyncConnector (com.twinsoft.convertigo.beans.connectors.FullSyncConnector)3 RouteActionComponent (com.twinsoft.convertigo.beans.mobile.components.RouteActionComponent)3 RouteEventComponent (com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent)3 UIComponent (com.twinsoft.convertigo.beans.mobile.components.UIComponent)3 UIComponent (com.twinsoft.convertigo.beans.ngx.components.UIComponent)3 StepTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject)3