use of com.cubrid.common.core.common.model.ViewDetailInfo in project cubrid-manager by CUBRID.
the class ViewDashboardEditorPart method dropView.
public void dropView() {
TableItem[] items = viewsDetailInfoTable.getTable().getSelection();
if (items.length > 0) {
List<ISchemaNode> selectNodeList = new ArrayList<ISchemaNode>();
for (TableItem item : items) {
ViewDetailInfo viewInfo = (ViewDetailInfo) item.getData();
Set<String> typeSet = new HashSet<String>();
typeSet.add(NodeType.USER_VIEW);
ICubridNode viewNode = CommonUITool.findNode(database, typeSet, viewInfo.getViewName());
selectNodeList.add((ISchemaNode) viewNode);
}
if (selectNodeList.size() > 0) {
DropViewAction action = (DropViewAction) ActionManager.getInstance().getAction(DropViewAction.ID);
ISchemaNode[] nodeArr = new ISchemaNode[selectNodeList.size()];
action.run(selectNodeList.toArray(nodeArr));
if (!action.isCanceledTask()) {
refresh();
}
}
} else {
CommonUITool.openWarningBox(Messages.viewDetailInfoPartTableNoSelectionMsg);
}
}
use of com.cubrid.common.core.common.model.ViewDetailInfo in project cubrid-manager by CUBRID.
the class OpenViewsDetailInfoPartProgress method run.
/* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor)
*/
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// FIXME move this logic to core module
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
viewList = new ArrayList<ViewDetailInfo>();
conn = JDBCConnectionManager.getConnection(database.getDatabaseInfo(), true);
StringBuilder sb = new StringBuilder();
sb.append("SELECT c.class_name, v.vclass_def, c.owner_name \n");
sb.append("FROM db_class c, db_attribute a, db_vclass v \n");
sb.append("WHERE c.class_name=a.class_name \n");
sb.append("AND c.class_name=v.vclass_name \n");
sb.append("AND c.is_system_class='NO' \n");
sb.append("AND a.from_class_name IS NULL \n");
sb.append("AND c.class_type='VCLASS' \n");
sb.append("GROUP BY c.class_name, c.class_type, \n");
//8.2.2 need to group by these 2 column
sb.append("v.vclass_def ,c.owner_name \n");
sb.append("ORDER BY c.class_type, c.class_name");
stmt = conn.createStatement();
rs = stmt.executeQuery(sb.toString());
while (rs.next()) {
ViewDetailInfo view = new ViewDetailInfo(rs.getString(1));
view.setViewDef(rs.getString(2));
view.setViewOwnerName(rs.getString(3));
viewList.add(view);
}
success = true;
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} finally {
QueryUtil.freeQuery(conn, stmt, rs);
}
}
use of com.cubrid.common.core.common.model.ViewDetailInfo in project cubrid-manager by CUBRID.
the class ViewDashboardEditorPart method createViewsDetailInfoTable.
public void createViewsDetailInfoTable(Composite parent) {
final Composite tableComposite = new Composite(parent, SWT.NONE);
{
tableComposite.setLayout(new FillLayout());
tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}
viewsDetailInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
viewsDetailInfoTable.getTable().setHeaderVisible(true);
viewsDetailInfoTable.getTable().setLinesVisible(true);
final TableViewerColumn columnViewName = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
columnViewName.getColumn().setWidth(150);
columnViewName.getColumn().setText(Messages.viewDetailInfoPartColViewName);
final TableViewerColumn scriptDescColumn = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
scriptDescColumn.getColumn().setWidth(200);
scriptDescColumn.getColumn().setText(Messages.viewDetailInfoPartTableDefColumn);
final TableViewerColumn ownerColumn = new TableViewerColumn(viewsDetailInfoTable, SWT.LEFT);
ownerColumn.getColumn().setWidth(80);
ownerColumn.getColumn().setText(Messages.viewDetailInfoPartTableOwnerColumn);
viewsDetailInfoTable.setContentProvider(new ViewsDetailTableViewerContentProvider());
viewsDetailInfoTable.setLabelProvider(new ViewsDetailTableViewerLabelProvider());
viewsDetailInfoTable.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
ViewDetailInfo oneViewDetail = (ViewDetailInfo) selection.getFirstElement();
//if had opend,set it selection
for (CTabItem tabItem : tabFolder.getItems()) {
if (tabItem.getText().equals(oneViewDetail.getViewName())) {
tabFolder.setSelection(tabItem);
return;
}
}
//if a new view info,create a new tab
ViewDashboardComposite viewComp = new ViewDashboardComposite(tabFolder, SWT.NONE);
viewComp.initialize();
SchemaInfo schemaInfo = database.getDatabaseInfo().getSchemaInfo(oneViewDetail.getViewName());
viewComp.setInput(schemaInfo);
}
});
viewsDetailInfoTable.getTable().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
if ((event.stateMask & SWT.CTRL) != 0 && event.keyCode == 'c') {
}
}
});
registerContextMenu();
}
use of com.cubrid.common.core.common.model.ViewDetailInfo in project cubrid-manager by CUBRID.
the class ViewDashboardEditorPart method editView.
public void editView() {
TableItem[] items = viewsDetailInfoTable.getTable().getSelection();
if (items.length != 0) {
TableItem item = items[0];
ViewDetailInfo viewInfo = (ViewDetailInfo) item.getData();
Set<String> typeSet = new HashSet<String>();
typeSet.add(NodeType.USER_VIEW);
ICubridNode viewNode = CommonUITool.findNode(database, typeSet, viewInfo.getViewName());
if (viewNode != null) {
EditViewAction action = (EditViewAction) ActionManager.getInstance().getAction(EditViewAction.ID);
if (action.run(database, (ISchemaNode) viewNode) == IDialogConstants.OK_ID) {
refresh();
}
}
} else {
CommonUITool.openWarningBox(Messages.viewDetailInfoPartTableNoSelectionMsg);
}
}
use of com.cubrid.common.core.common.model.ViewDetailInfo in project cubrid-manager by CUBRID.
the class ViewDashboardEditorPart method setInputs.
public void setInputs() {
viewsDetailInfoTable.setInput(viewList);
viewsDetailInfoTable.refresh();
pack();
//if a new view info,create a new tab
ViewDashboardComposite viewComp = new ViewDashboardComposite(tabFolder, SWT.NONE);
viewComp.initialize();
if (viewList.size() > 0) {
ViewDetailInfo oneViewDetail = viewList.get(0);
SchemaInfo schemaInfo = database.getDatabaseInfo().getSchemaInfo(oneViewDetail.getViewName());
viewComp.setInput(schemaInfo);
}
}
Aggregations