Search in sources :

Example 6 with TreeParent

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

the class DatabaseObjectIncreasePriorityAction method run.

public void run() {
    Display display = Display.getDefault();
    Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    Shell shell = getParentShell();
    shell.setCursor(waitCursor);
    try {
        treeNodesToUpdate = new ArrayList<TreeParent>();
        ProjectExplorerView explorerView = getProjectExplorerView();
        if (explorerView != null) {
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            String[] selectedPaths = new String[treeObjects.length];
            if (treeObjects != null) {
                // Increase priority
                TreeObject treeObject = null;
                for (int i = 0; i < treeObjects.length; i++) {
                    treeObject = treeObjects[i];
                    selectedPaths[i] = treeObject.getPath();
                    increasePriority(treeObject);
                }
                // Updating the tree and the properties panel
                Enumeration<TreeParent> enumeration = Collections.enumeration(treeNodesToUpdate);
                TreeParent parentTreeObject = null;
                while (enumeration.hasMoreElements()) {
                    parentTreeObject = enumeration.nextElement();
                    explorerView.reloadTreeObject(parentTreeObject);
                }
                // Restore selection
                TreeObjectEvent treeObjectEvent;
                for (int i = 0; i < selectedPaths.length; i++) {
                    String previousPath = selectedPaths[i];
                    treeObject = explorerView.findTreeObjectByPath(parentTreeObject, previousPath);
                    if (treeObject != null) {
                        treeObjects[i] = treeObject;
                        treeObjectEvent = new TreeObjectEvent(treeObject);
                        explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
                    }
                }
                explorerView.setSelectedTreeObjects(treeObjects);
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to increase priority!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) Cursor(org.eclipse.swt.graphics.Cursor) Shell(org.eclipse.swt.widgets.Shell) PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) Display(org.eclipse.swt.widgets.Display)

Example 7 with TreeParent

use of com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent 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);
                }
            }
        }
    }
}
Also used : PropertyTableRowTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) IContainerOrdered(com.twinsoft.convertigo.beans.core.IContainerOrdered) DatabaseObject(com.twinsoft.convertigo.beans.core.DatabaseObject) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) PropertyTableColumnTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableColumnTreeObject) PropertyTableTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)

Example 8 with TreeParent

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

the class CreateNgxUIComponentAction 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 oft = (ObjectsFolderTreeObject) treeObject;
            if (oft.folderType == ObjectsFolderTreeObject.FOLDER_TYPE_PAGES) {
                enable = false;
            } else {
                TreeParent treeParent = oft.getParent();
                enable = treeParent != null && treeParent instanceof NgxComponentTreeObject;
            }
        } 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) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) ObjectsFolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ObjectsFolderTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) NgxComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxComponentTreeObject) 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 9 with TreeParent

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

the class CreateDesignDocumentFilterAction 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) {
            DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) explorerView.getFirstSelectedTreeObject();
            DesignDocumentFilterTreeObject ddfto = ddto.addNewFilter();
            if (ddto.hasChanged()) {
                TreeParent treeParent = ddto.getParent();
                if (treeParent instanceof FolderTreeObject)
                    treeParent = treeParent.getParent();
                explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), ddfto.getPath()));
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to create a new filter!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) Cursor(org.eclipse.swt.graphics.Cursor) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) Display(org.eclipse.swt.widgets.Display) DesignDocumentFilterTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)

Example 10 with TreeParent

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

the class CreateDesignDocumentUpdateAction 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) {
            DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) explorerView.getFirstSelectedTreeObject();
            DesignDocumentUpdateTreeObject dduto = ddto.addNewUpdate();
            if (ddto.hasChanged()) {
                TreeParent treeParent = ddto.getParent();
                if (treeParent instanceof FolderTreeObject)
                    treeParent = treeParent.getParent();
                explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), dduto.getPath()));
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to create a new update!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) TreeParent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent) Cursor(org.eclipse.swt.graphics.Cursor) FolderTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject) CompositeEvent(com.twinsoft.convertigo.eclipse.editors.CompositeEvent) Display(org.eclipse.swt.widgets.Display) DesignDocumentUpdateTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)

Aggregations

TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)48 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)40 Shell (org.eclipse.swt.widgets.Shell)39 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)38 Cursor (org.eclipse.swt.graphics.Cursor)37 Display (org.eclipse.swt.widgets.Display)37 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)35 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)31 FolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject)18 Sequence (com.twinsoft.convertigo.beans.core.Sequence)17 StepEvent (com.twinsoft.convertigo.beans.core.StepEvent)15 StepWithExpressions (com.twinsoft.convertigo.beans.core.StepWithExpressions)15 StepTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.StepTreeObject)15 EngineException (com.twinsoft.convertigo.engine.EngineException)12 TreePath (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreePath)11 Step (com.twinsoft.convertigo.beans.core.Step)10 CompositeEvent (com.twinsoft.convertigo.eclipse.editors.CompositeEvent)9 PropertyTableRowTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableRowTreeObject)9 ThenStep (com.twinsoft.convertigo.beans.steps.ThenStep)8 PropertyTableTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.PropertyTableTreeObject)8