use of com.twinsoft.convertigo.beans.core.DatabaseObject 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.beans.core.DatabaseObject in project convertigo by convertigo.
the class StringComboBoxPropertyDescriptor method getTags.
public static String[] getTags(DatabaseObjectTreeObject databaseObjectTreeObject, String propertyName) {
DatabaseObject bean = (DatabaseObject) databaseObjectTreeObject.getObject();
ITagsProperty tagsProperty = null;
if (bean instanceof ITagsProperty) {
tagsProperty = (ITagsProperty) bean;
} else {
return new String[] { "" };
}
String[] sResults = tagsProperty.getTagsForProperty(propertyName);
return sResults;
}
use of com.twinsoft.convertigo.beans.core.DatabaseObject in project convertigo by convertigo.
the class NgxSmartSourcePropertyDescriptor method getTags.
public static String[] getTags(DatabaseObjectTreeObject databaseObjectTreeObject, String propertyName) {
DatabaseObject bean = (DatabaseObject) databaseObjectTreeObject.getObject();
ITagsProperty tagsProperty = null;
if (bean instanceof ITagsProperty) {
tagsProperty = (ITagsProperty) bean;
} else {
return new String[] { "" };
}
String[] sResults = tagsProperty.getTagsForProperty(propertyName);
return sResults;
}
use of com.twinsoft.convertigo.beans.core.DatabaseObject in project convertigo by convertigo.
the class NgxSmartSourceTypeCellEditor method getTags.
private String[] getTags() {
if (databaseObjectTreeObject != null && propertyDescriptor != null) {
String propertyName = (String) propertyDescriptor.getId();
DatabaseObject bean = (DatabaseObject) databaseObjectTreeObject.getObject();
if (bean instanceof ITagsProperty) {
return ((ITagsProperty) bean).getTagsForProperty(propertyName);
}
}
return new String[] { "" };
}
use of com.twinsoft.convertigo.beans.core.DatabaseObject in project convertigo by convertigo.
the class StepSourceEditorComposite method findStepInTree.
private TreeItem findStepInTree(Object parent, long priority) {
TreeItem[] items = null;
if (parent == null) {
items = tree.getItems();
} else {
DatabaseObject databaseObject = (DatabaseObject) ((TreeItem) parent).getData();
if (databaseObject instanceof Step) {
if ((databaseObject).priority == priority) {
return (TreeItem) parent;
}
}
items = ((TreeItem) parent).getItems();
}
for (int i = 0; i < items.length; i++) {
TreeItem tItem = findStepInTree(items[i], priority);
if (tItem != null)
return tItem;
}
return null;
}
Aggregations