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();
}
}
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();
}
}
}
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();
}
}
}
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.");
}
}
}
}
}
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);
}
Aggregations