Search in sources :

Example 11 with DesignDocumentTreeObject

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

the class CreateDesignDocumentViewAction 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();
            DesignDocumentViewTreeObject ddvto = ddto.addNewView();
            if (ddto.hasChanged()) {
                TreeParent treeParent = ddto.getParent();
                if (treeParent instanceof FolderTreeObject)
                    treeParent = treeParent.getParent();
                explorerView.objectChanged(new CompositeEvent(treeParent.getObject(), ddvto.getPath()));
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to create a new view!");
    } 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) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) 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)

Example 12 with DesignDocumentTreeObject

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

the class CreateDesignDocumentViewReduceAction 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) {
            DesignDocumentViewTreeObject ddvto = (DesignDocumentViewTreeObject) explorerView.getFirstSelectedTreeObject();
            DesignDocumentFunctionTreeObject ddfto = ddvto.addReduce();
            DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) ddvto.getParent().getParent();
            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 reduce function!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : DesignDocumentFunctionTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject) 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) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) 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)

Example 13 with DesignDocumentTreeObject

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

the class ViewExecuteSelectedAction method run.

@Override
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 treeObject = explorerView.getFirstSelectedTreeObject();
            if ((treeObject != null) && (treeObject instanceof DesignDocumentViewTreeObject)) {
                DesignDocumentViewTreeObject viewTreeObject = (DesignDocumentViewTreeObject) treeObject;
                DesignDocumentTreeObject ddto = (DesignDocumentTreeObject) viewTreeObject.getTreeObjectOwner();
                ConnectorTreeObject cto = (ConnectorTreeObject) ddto.getOwnerDatabaseObjectTreeObject();
                ProjectTreeObject projectTreeObject = cto.getProjectTreeObject();
                CouchDbConnector connector = (CouchDbConnector) cto.getObject();
                cto.openConnectorEditor();
                ConnectorEditor connectorEditor = projectTreeObject.getConnectorEditor(connector);
                if (connectorEditor != null) {
                    // activate connector's editor
                    getActivePage().activate(connectorEditor);
                    // set transaction's parameters
                    Transaction transaction = connector.getTransactionByName(CouchDbConnector.internalView);
                    ((GetViewTransaction) transaction).setViewname(viewTreeObject.getDocViewName());
                    Variable view_reduce = ((GetViewTransaction) transaction).getVariable(CouchParam.prefix + "reduce");
                    view_reduce.setValueOrNull(viewTreeObject.hasReduce() ? isReduceRequested() : false);
                    // execute view transaction
                    connectorEditor.getDocument(CouchDbConnector.internalView, isStubRequested());
                }
            }
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to execute the selected view!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) Variable(com.twinsoft.convertigo.beans.core.Variable) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) Cursor(org.eclipse.swt.graphics.Cursor) ConnectorEditor(com.twinsoft.convertigo.eclipse.editors.connector.ConnectorEditor) CouchDbConnector(com.twinsoft.convertigo.beans.connectors.CouchDbConnector) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) Shell(org.eclipse.swt.widgets.Shell) GetViewTransaction(com.twinsoft.convertigo.beans.transactions.couchdb.GetViewTransaction) GetViewTransaction(com.twinsoft.convertigo.beans.transactions.couchdb.GetViewTransaction) Transaction(com.twinsoft.convertigo.beans.core.Transaction) DesignDocumentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject) DesignDocumentViewTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) ConnectorTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) ProjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject) Display(org.eclipse.swt.widgets.Display)

Aggregations

DesignDocumentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentTreeObject)13 FolderTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.FolderTreeObject)10 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)8 Shell (org.eclipse.swt.widgets.Shell)8 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)7 DesignDocumentViewTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentViewTreeObject)7 Cursor (org.eclipse.swt.graphics.Cursor)7 Display (org.eclipse.swt.widgets.Display)7 CompositeEvent (com.twinsoft.convertigo.eclipse.editors.CompositeEvent)6 TreeParent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeParent)6 DesignDocumentFilterTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFilterTreeObject)4 DesignDocumentUpdateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentUpdateTreeObject)4 DesignDocumentValidateTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentValidateTreeObject)4 ConnectorTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ConnectorTreeObject)3 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)3 DesignDocumentFunctionTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DesignDocumentFunctionTreeObject)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)2 HandlerStatement (com.twinsoft.convertigo.beans.statements.HandlerStatement)2 RequestableVariable (com.twinsoft.convertigo.beans.variables.RequestableVariable)2