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();
}
}
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();
}
}
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();
}
}
Aggregations