Search in sources :

Example 6 with UnloadedProjectTreeObject

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

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

the class SequenceExecuteSelectedAction method loadProject.

private void loadProject(ProjectExplorerView explorerView, String projectName) {
    if (!explorerView.isProjectLoaded(projectName)) {
        TreeObject unloadedProjectTreeObject;
        try {
            unloadedProjectTreeObject = ((ViewContentProvider) explorerView.viewer.getContentProvider()).getProjectRootObject(projectName);
            explorerView.loadProject((UnloadedProjectTreeObject) unloadedProjectTreeObject);
            try {
                while (!explorerView.isProjectLoaded(projectName)) Thread.sleep(10000);
            } catch (InterruptedException e) {
            }
        } catch (EngineException e) {
            e.printStackTrace();
        }
    }
}
Also used : EngineException(com.twinsoft.convertigo.engine.EngineException) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)

Example 8 with UnloadedProjectTreeObject

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

the class SequenceExecuteSelectedFromStubAction method loadProject.

private void loadProject(ProjectExplorerView explorerView, String projectName) {
    if (!explorerView.isProjectLoaded(projectName)) {
        TreeObject unloadedProjectTreeObject;
        try {
            unloadedProjectTreeObject = ((ViewContentProvider) explorerView.viewer.getContentProvider()).getProjectRootObject(projectName);
            explorerView.loadProject((UnloadedProjectTreeObject) unloadedProjectTreeObject);
            try {
                while (!explorerView.isProjectLoaded(projectName)) Thread.sleep(10000);
            } catch (InterruptedException e) {
            }
        } catch (EngineException e) {
            e.printStackTrace();
        }
    }
}
Also used : EngineException(com.twinsoft.convertigo.engine.EngineException) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)

Example 9 with UnloadedProjectTreeObject

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

the class ReferencesView method handleSelectedObjectInRefView.

private void handleSelectedObjectInRefView(Object firstElement) {
    if (firstElement != null) {
        if (firstElement instanceof AbstractNodeWithDatabaseObjectReference) {
            AbstractNodeWithDatabaseObjectReference abstractNode = (AbstractNodeWithDatabaseObjectReference) firstElement;
            DatabaseObject selectedDatabaseObject = abstractNode.getRefDatabaseObject();
            ProjectExplorerView projectExplorerView = ConvertigoPlugin.getDefault().getProjectExplorerView();
            TreeObject selectedTreeObject = projectExplorerView.findTreeObjectByUserObject(selectedDatabaseObject);
            if (selectedTreeObject != null) {
                projectExplorerView.setSelectedTreeObject(selectedTreeObject);
                if (selectedTreeObject instanceof UnloadedProjectTreeObject) {
                    ConvertigoPlugin.infoMessageBox("This project is closed. Please open the project first.");
                }
            }
        }
    }
}
Also used : ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) SequenceTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject) UrlMappingOperationTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UrlMappingOperationTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) TransactionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TransactionTreeObject) StepTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) ScreenClassTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject) AbstractNodeWithDatabaseObjectReference(com.twinsoft.convertigo.eclipse.views.references.model.AbstractNodeWithDatabaseObjectReference)

Example 10 with UnloadedProjectTreeObject

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

the class ProjectExplorerView method importProjectTreeObject.

public void importProjectTreeObject(String projectName, boolean isCopy, String originalName) throws CoreException {
    TreeParent invisibleRoot = ((ViewContentProvider) viewer.getContentProvider()).getTreeRoot();
    UnloadedProjectTreeObject unloadedProjectTreeObject = new UnloadedProjectTreeObject(viewer, projectName);
    invisibleRoot.addChild(unloadedProjectTreeObject);
    loadProject(unloadedProjectTreeObject, isCopy, originalName);
}
Also used : UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject)

Aggregations

UnloadedProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject)15 ProjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject)10 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)8 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)6 SequenceTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.SequenceTreeObject)6 Project (com.twinsoft.convertigo.beans.core.Project)4 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)4 DesignDocumentFunctionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject)4 DesignDocumentViewTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject)4 HandlersDeclarationTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.HandlersDeclarationTreeObject)4 ObjectsFolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject)4 PropertyTableColumnTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject)4 PropertyTableRowTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject)4 PropertyTableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)4 ScreenClassTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ScreenClassTreeObject)4 CriteriaTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.CriteriaTreeObject)3 DesignDocumentFilterTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)3 DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)3 DesignDocumentUpdateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)3 DesignDocumentValidateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject)3