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