Search in sources :

Example 16 with DatabaseObject

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);
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) EngineException(com.twinsoft.convertigo.engine.EngineException) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) UnloadedProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.UnloadedProjectTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject)

Example 17 with DatabaseObject

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;
}
Also used : ITagsProperty(com.twinsoft.convertigo.beans.core.ITagsProperty) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Example 18 with DatabaseObject

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;
}
Also used : ITagsProperty(com.twinsoft.convertigo.beans.core.ITagsProperty) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Example 19 with DatabaseObject

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[] { "" };
}
Also used : ITagsProperty(com.twinsoft.convertigo.beans.core.ITagsProperty) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject)

Example 20 with DatabaseObject

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;
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) Step(com.twinsoft.convertigo.beans.core.Step)

Aggregations

DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)296 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)98 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)97 EngineException (com.twinsoft.convertigo.engine.EngineException)88 Shell (org.eclipse.swt.widgets.Shell)46 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)45 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)43 Cursor (org.eclipse.swt.graphics.Cursor)42 Display (org.eclipse.swt.widgets.Display)42 Sequence (com.twinsoft.convertigo.beans.core.Sequence)41 Project (com.twinsoft.convertigo.beans.core.Project)38 CoreException (org.eclipse.core.runtime.CoreException)36 IOException (java.io.IOException)35 Step (com.twinsoft.convertigo.beans.core.Step)33 ActionModel (com.twinsoft.convertigo.engine.studio.ActionModel)33 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)31 Element (org.w3c.dom.Element)30 ObjectsFolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject)27 StepTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject)27 PartInitException (org.eclipse.ui.PartInitException)26