use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView 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();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView 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();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView 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();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class DisableMobileRouteActionComponentAction 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(false);
componentTreeObject.setEnabled(false);
componentTreeObject.hasBeenModified(true);
TreeObjectEvent treeObjectEvent = new TreeObjectEvent(componentTreeObject, "isEnabled", true, false);
explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
}
}
explorerView.refreshSelectedTreeObjects();
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to disable action!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView in project convertigo by convertigo.
the class DatabaseObjectCreateAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
TreeObject parentTreeObject = null;
DatabaseObject databaseObject = null;
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
parentTreeObject = explorerView.getFirstSelectedTreeObject();
if (parentTreeObject instanceof ObjectsFolderTreeObject) {
parentTreeObject = ((ObjectsFolderTreeObject) parentTreeObject).getParent();
databaseObject = (DatabaseObject) parentTreeObject.getObject();
} else {
databaseObject = (DatabaseObject) parentTreeObject.getObject();
}
NewObjectWizard newObjectWizard = new NewObjectWizard(databaseObject, databaseObjectClassName);
WizardDialog wzdlg = new WizardDialog(shell, newObjectWizard);
wzdlg.setPageSize(850, 650);
wzdlg.open();
int result = wzdlg.getReturnCode();
if ((result != Window.CANCEL) && (newObjectWizard.newBean != null)) {
postCreate(parentTreeObject, newObjectWizard.newBean);
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to create a new database object '" + databaseObjectClassName + "'!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
Aggregations