Search in sources :

Example 11 with ObjectsFolderTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject 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 12 with ObjectsFolderTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject in project convertigo by convertigo.

the class CreateDocumentAction method selectionChanged.

public void selectionChanged(IAction action, ISelection selection) {
    try {
        boolean enable = true;
        super.selectionChanged(action, selection);
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
        if (treeObject instanceof ObjectsFolderTreeObject)
            enable = ((ObjectsFolderTreeObject) treeObject).folderType == ObjectsFolderTreeObject.FOLDER_TYPE_DOCUMENTS;
        else if (treeObject instanceof DatabaseObjectTreeObject) {
            DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
            ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
            enable = actionModel.isEnabled;
        }
        action.setEnabled(enable);
    } catch (Exception e) {
    }
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) ActionModel(com.twinsoft.convertigo.engine.studio.ActionModel)

Example 13 with ObjectsFolderTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject in project convertigo by convertigo.

the class CreateIndexAction method selectionChanged.

public void selectionChanged(IAction action, ISelection selection) {
    try {
        boolean enable = true;
        super.selectionChanged(action, selection);
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
        if (treeObject instanceof ObjectsFolderTreeObject)
            enable = ((ObjectsFolderTreeObject) treeObject).folderType == ObjectsFolderTreeObject.FOLDER_TYPE_INDEXES;
        else if (treeObject instanceof DatabaseObjectTreeObject) {
            DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
            ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
            enable = actionModel.isEnabled;
        }
        action.setEnabled(enable);
    } catch (Exception e) {
    }
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) ActionModel(com.twinsoft.convertigo.engine.studio.ActionModel)

Example 14 with ObjectsFolderTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject in project convertigo by convertigo.

the class CreateListenerAction method selectionChanged.

public void selectionChanged(IAction action, ISelection selection) {
    try {
        boolean enable = true;
        super.selectionChanged(action, selection);
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
        if (treeObject instanceof ObjectsFolderTreeObject)
            enable = ((ObjectsFolderTreeObject) treeObject).folderType == ObjectsFolderTreeObject.FOLDER_TYPE_LISTENERS;
        else if (treeObject instanceof DatabaseObjectTreeObject) {
            DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
            ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
            enable = actionModel.isEnabled;
        }
        action.setEnabled(enable);
    } catch (Exception e) {
    }
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) ActionModel(com.twinsoft.convertigo.engine.studio.ActionModel)

Example 15 with ObjectsFolderTreeObject

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject in project convertigo by convertigo.

the class CreateMobileRouteActionComponentAction method selectionChanged.

public void selectionChanged(IAction action, ISelection selection) {
    try {
        boolean enable = true;
        super.selectionChanged(action, selection);
        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
        TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
        if (treeObject instanceof ObjectsFolderTreeObject) {
            ObjectsFolderTreeObject ofto = (ObjectsFolderTreeObject) treeObject;
            enable = ofto.folderType == ObjectsFolderTreeObject.FOLDER_TYPE_ACTIONS;
            treeObject = ofto.getParent();
        }
        if (enable && treeObject instanceof DatabaseObjectTreeObject) {
            DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
            ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
            enable = actionModel.isEnabled;
        }
        action.setEnabled(enable);
    } catch (Exception e) {
    }
}
Also used : DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) ActionModel(com.twinsoft.convertigo.engine.studio.ActionModel)

Aggregations

ObjectsFolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject)21 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)19 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)18 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)14 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 ActionModel (com.twinsoft.convertigo.engine.studio.ActionModel)11 EngineException (com.twinsoft.convertigo.engine.EngineException)5 IOException (java.io.IOException)5 Shell (org.eclipse.swt.widgets.Shell)5 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)4 PropertyTableRowTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject)4 WizardDialog (org.eclipse.jface.wizard.WizardDialog)4 Cursor (org.eclipse.swt.graphics.Cursor)4 Display (org.eclipse.swt.widgets.Display)4 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)3 IPropertyTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.IPropertyTreeObject)3 MobileUIComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileUIComponentTreeObject)3 NgxComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject)3 NgxUIComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxUIComponentTreeObject)3 PropertyTableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)3