use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject in project convertigo by convertigo.
the class DatabaseObjectIncreasePriorityAction method increasePriority.
private void increasePriority(TreeObject treeObject) throws EngineException {
int count = counter;
if (treeObject instanceof DatabaseObjectTreeObject) {
DatabaseObject databaseObject = (DatabaseObject) treeObject.getObject();
DatabaseObject parent = databaseObject.getParent();
if (parent != null && parent instanceof IContainerOrdered) {
IContainerOrdered containerOrdered = (IContainerOrdered) parent;
while (count-- > 0) {
containerOrdered.increasePriority(databaseObject);
}
if (parent.hasChanged) {
TreeParent parentTreeObject = null;
TreeParent treeParent = treeObject.getParent();
if (treeParent instanceof FolderTreeObject) {
parentTreeObject = treeObject.getParent().getParent();
} else {
parentTreeObject = treeParent;
}
if (!treeNodesToUpdate.contains(parentTreeObject)) {
treeNodesToUpdate.add(parentTreeObject);
}
}
}
} else {
DatabaseObjectTreeObject databaseObjectTreeObject = null;
if (treeObject instanceof PropertyTableRowTreeObject) {
PropertyTableTreeObject propertyTableTreeObject = (PropertyTableTreeObject) treeObject.getParent();
while (count-- > 0) {
if ((treeObject = propertyTableTreeObject.moveRow((PropertyTableRowTreeObject) treeObject, true)) != null) {
databaseObjectTreeObject = (DatabaseObjectTreeObject) propertyTableTreeObject.getParent();
}
}
} else if (treeObject instanceof PropertyTableColumnTreeObject) {
PropertyTableRowTreeObject propertyTableRowTreeObject = (PropertyTableRowTreeObject) treeObject.getParent();
PropertyTableTreeObject propertyTableTreeObject = (PropertyTableTreeObject) propertyTableRowTreeObject.getParent();
while (count-- > 0) {
if ((treeObject = propertyTableRowTreeObject.moveColumn((PropertyTableColumnTreeObject) treeObject, true)) != null) {
databaseObjectTreeObject = (DatabaseObjectTreeObject) propertyTableTreeObject.getParent();
}
}
}
if (databaseObjectTreeObject != null) {
if (databaseObjectTreeObject.hasChanged()) {
DatabaseObjectTreeObject parentTreeObject = null;
TreeParent treeParent = databaseObjectTreeObject.getParent();
if (treeParent instanceof FolderTreeObject)
parentTreeObject = (DatabaseObjectTreeObject) treeParent.getParent();
else
parentTreeObject = (DatabaseObjectTreeObject) treeParent;
if (!treeNodesToUpdate.contains(parentTreeObject)) {
treeNodesToUpdate.add(parentTreeObject);
}
}
}
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject 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.model.PropertyTableColumnTreeObject in project convertigo by convertigo.
the class ProjectExplorerView method handleKeyReleased.
private void handleKeyReleased(KeyEvent event) {
boolean bCtrl = (((event.stateMask & SWT.CONTROL) != 0) || ((event.stateMask & SWT.CTRL) != 0));
// boolean bAlt = (event.stateMask & SWT.ALT) != 0;
int stateMask = event.stateMask;
int keyCode = event.keyCode;
char c = event.character;
if (stateMask == 0) {
// F2 for renaming
if (keyCode == SWT.F2) {
renameSelectedTreeObject();
}
// F5 for refreshing and executing selected requestable
if (keyCode == SWT.F5) {
refreshTree();
Object object = getFirstSelectedDatabaseObject();
if (object instanceof Transaction) {
executeTransaction.run();
} else if (object instanceof Sequence) {
executeSequence.run();
} else if (object instanceof TestCase) {
executeTestCase.run();
}
}
// DEL for deleting
if (c == SWT.DEL) {
Object object = getFirstSelectedTreeObject();
if (object instanceof DatabaseObjectTreeObject) {
deleteDatabaseObjectAction.runWithEvent(null);
} else if (object instanceof PropertyTableRowTreeObject) {
deletePropertyTableRowAction.run();
} else if (object instanceof PropertyTableColumnTreeObject) {
deletePropertyTableColumnAction.run();
}
}
}
if (bCtrl) {
// Copy/Cut/Paste
if (c == 'c') {
copyAction.runWithEvent(null);
}
if (c == 'x') {
cutAction.runWithEvent(null);
}
if (c == 'v') {
pasteAction.runWithEvent(null);
}
if (c == 'g') {
transactionEditHandlersAction.run();
}
// Saving
if ((c == 's') || (keyCode == 115)) {
projectExplorerSaveAllAction.run();
}
// F5 for executing default transaction
if (keyCode == SWT.F5) {
executeDefaultTransaction.run();
}
}
// +/- for Priority
if ((c == '+') || (keyCode == SWT.KEYPAD_ADD)) {
increasePriorityAction.runWithEvent(null);
}
if ((c == '-') || (keyCode == SWT.KEYPAD_SUBTRACT)) {
decreasePriorityAction.runWithEvent(null);
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject in project convertigo by convertigo.
the class TreeObjectSorter method compare.
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if ((e1 instanceof DatabaseObjectTreeObject) && (e2 instanceof DatabaseObjectTreeObject)) {
DatabaseObject d1 = ((DatabaseObjectTreeObject) e1).getObject();
DatabaseObject d2 = ((DatabaseObjectTreeObject) e2).getObject();
DatabaseObjectTreeObject p1 = ((DatabaseObjectTreeObject) e1).getOwnerDatabaseObjectTreeObject();
DatabaseObjectTreeObject p2 = ((DatabaseObjectTreeObject) e2).getOwnerDatabaseObjectTreeObject();
if (p1.equals(p2)) {
DatabaseObject p = (DatabaseObject) p1.getObject();
try {
Object o1 = p.getOrder(d1);
Object o2 = p.getOrder(d2);
if ((o1 instanceof Long) && (o2 instanceof Long)) {
long l1 = ((Long) o1).longValue();
long l2 = ((Long) o2).longValue();
int dp = (int) (l1 - l2);
if (dp != 0)
return dp;
}
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Error while sorting objects \"" + d1.getQName() + "\" and \"" + d2.getQName() + "\" in Tree.");
}
}
} else if ((e1 instanceof PropertyTableRowTreeObject) && (e2 instanceof PropertyTableRowTreeObject)) {
PropertyTableRowTreeObject r1 = (PropertyTableRowTreeObject) e1;
PropertyTableRowTreeObject r2 = (PropertyTableRowTreeObject) e2;
int i1 = r1.getParent().indexOf(r1);
int i2 = r2.getParent().indexOf(r2);
return i1 - i2;
} else if ((e1 instanceof PropertyTableColumnTreeObject) && (e2 instanceof PropertyTableColumnTreeObject)) {
PropertyTableColumnTreeObject c1 = (PropertyTableColumnTreeObject) e1;
PropertyTableColumnTreeObject c2 = (PropertyTableColumnTreeObject) e2;
int i1 = c1.getParent().indexOf(c1);
int i2 = c2.getParent().indexOf(c2);
return i1 - i2;
} else if ((e1 instanceof ObjectsFolderTreeObject) && !(e2 instanceof ObjectsFolderTreeObject)) {
return -1;
} else if (!(e1 instanceof ObjectsFolderTreeObject) && (e2 instanceof ObjectsFolderTreeObject)) {
return 1;
}
return super.compare(viewer, e1, e2);
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject in project convertigo by convertigo.
the class DatabaseObjectDecreasePriorityAction method decreasePriority.
private void decreasePriority(TreeObject treeObject) throws EngineException {
int count = counter;
if (treeObject instanceof DatabaseObjectTreeObject) {
DatabaseObject databaseObject = (DatabaseObject) treeObject.getObject();
DatabaseObject parent = databaseObject.getParent();
if (parent != null && parent instanceof IContainerOrdered) {
IContainerOrdered containerOrdered = (IContainerOrdered) parent;
while (count-- > 0) {
containerOrdered.decreasePriority(databaseObject);
}
if (parent.hasChanged) {
DatabaseObjectTreeObject parentTreeObject = null;
TreeParent treeParent = treeObject.getParent();
if (treeParent instanceof FolderTreeObject) {
parentTreeObject = (DatabaseObjectTreeObject) treeParent.getParent();
} else {
parentTreeObject = (DatabaseObjectTreeObject) treeParent;
}
if (!treeNodesToUpdate.contains(parentTreeObject)) {
treeNodesToUpdate.add(parentTreeObject);
}
}
}
} else {
DatabaseObjectTreeObject databaseObjectTreeObject = null;
if (treeObject instanceof PropertyTableRowTreeObject) {
PropertyTableTreeObject propertyTableTreeObject = (PropertyTableTreeObject) treeObject.getParent();
while (count-- > 0) {
if ((treeObject = propertyTableTreeObject.moveRow((PropertyTableRowTreeObject) treeObject, false)) != null) {
databaseObjectTreeObject = (DatabaseObjectTreeObject) propertyTableTreeObject.getParent();
}
}
} else if (treeObject instanceof PropertyTableColumnTreeObject) {
PropertyTableRowTreeObject propertyTableRowTreeObject = (PropertyTableRowTreeObject) treeObject.getParent();
PropertyTableTreeObject propertyTableTreeObject = (PropertyTableTreeObject) propertyTableRowTreeObject.getParent();
while (count-- > 0) {
if ((treeObject = propertyTableRowTreeObject.moveColumn((PropertyTableColumnTreeObject) treeObject, false)) != null) {
databaseObjectTreeObject = (DatabaseObjectTreeObject) propertyTableTreeObject.getParent();
}
}
}
if (databaseObjectTreeObject != null) {
if (databaseObjectTreeObject.hasChanged()) {
DatabaseObjectTreeObject parentTreeObject = null;
TreeParent treeParent = databaseObjectTreeObject.getParent();
if (treeParent instanceof FolderTreeObject)
parentTreeObject = (DatabaseObjectTreeObject) treeParent.getParent();
else
parentTreeObject = (DatabaseObjectTreeObject) treeParent;
if (!treeNodesToUpdate.contains(parentTreeObject)) {
treeNodesToUpdate.add(parentTreeObject);
}
}
}
}
}
Aggregations