use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class CubridSystemTableFolderLoader method load.
/**
*
* Load children object for parent
*
* @param parent the parent node
* @param monitor the IProgressMonitor object
*/
public void load(ICubridNode parent, final IProgressMonitor monitor) {
synchronized (this) {
if (isLoaded()) {
return;
}
CubridDatabase database = ((ISchemaNode) parent).getDatabase();
if (!database.isLogined() || database.getRunningType() == DbRunningType.STANDALONE) {
database.getDatabaseInfo().setSysTableInfoList(null);
parent.removeAllChild();
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
return;
}
DatabaseInfo databaseInfo = database.getDatabaseInfo();
final GetAllClassListTask task = new GetAllClassListTask(databaseInfo);
monitorCancel(monitor, new ITask[] { task });
List<ClassInfo> allClassInfoList = task.getSchema(false, true);
final String errorMsg = task.getErrorMsg();
if (!monitor.isCanceled() && errorMsg != null && errorMsg.trim().length() > 0) {
parent.removeAllChild();
openErrorBox(errorMsg);
setLoaded(true);
return;
}
if (monitor.isCanceled()) {
setLoaded(true);
return;
}
parent.removeAllChild();
if (allClassInfoList != null) {
for (ClassInfo classInfo : allClassInfoList) {
String id = parent.getId() + NODE_SEPARATOR + classInfo.getClassName();
ICubridNode classNode = new DefaultSchemaNode(id, classInfo.getClassName(), "icons/navigator/schema_table_item.png");
classNode.setType(NodeType.SYSTEM_TABLE);
classNode.setEditorId(SchemaInfoEditorPart.ID);
classNode.setContainer(false);
classNode.setModelObj(classInfo);
parent.addChild(classNode);
}
}
database.getDatabaseInfo().setSysTableInfoList(allClassInfoList);
Collections.sort(parent.getChildren());
setLoaded(true);
CubridNodeManager.getInstance().fireCubridNodeChanged(new CubridNodeChangedEvent((ICubridNode) parent, CubridNodeChangedEventType.CONTAINER_NODE_REFRESH));
}
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class CubridProcedureFolderLoader method createProcedureNode.
/**
*
* Create procedure node
*
* @param id The node id
* @param spInfo The model object
* @return ICubridNode
*/
public static ICubridNode createProcedureNode(String id, SPInfo spInfo) {
ICubridNode spNode = new DefaultSchemaNode(id, spInfo.getSpName(), "icons/navigator/procedure_sp_item.png");
spNode.setType(NodeType.STORED_PROCEDURE_PROCEDURE);
spNode.setModelObj(spInfo);
spNode.setContainer(false);
return spNode;
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class ExportConnectionUtil method createDialogArea.
/**
* Create dialog area content
*
* @param parent the parent composite
* @return the control
*/
@SuppressWarnings("deprecation")
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
tableViewer = new CheckboxTreeViewer(composite, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
tableViewer.getTree().setLinesVisible(true);
tableViewer.getTree().setHeaderVisible(true);
tableViewer.getTree().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
/* Name */
final TreeColumn nameColumn = new TreeColumn(tableViewer.getTree(), SWT.LEFT);
nameColumn.setText(Messages.nameColumn);
nameColumn.setWidth(120);
nameColumn.setImage(CommonUIPlugin.getImage("icons/checked_green.png"));
nameColumn.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
selectAll = !selectAll;
tableViewer.setAllChecked(selectAll);
Image image = selectAll ? CommonUIPlugin.getImage("icons/checked_green.png") : CommonUIPlugin.getImage("icons/unchecked.gif");
nameColumn.setImage(image);
tableViewer.refresh();
updateWidgetStatus();
}
});
/* IP */
TreeColumn ipColumn = new TreeColumn(tableViewer.getTree(), SWT.LEFT);
ipColumn.setText(Messages.iPColumn);
ipColumn.setWidth(100);
/* Port */
TreeColumn portColumn = new TreeColumn(tableViewer.getTree(), SWT.LEFT);
portColumn.setText(Messages.portColumn);
portColumn.setWidth(80);
/* DB user */
TreeColumn userColumn = new TreeColumn(tableViewer.getTree(), SWT.LEFT);
userColumn.setText(Messages.userColumn);
userColumn.setWidth(100);
/* Comment */
TreeColumn commentColumn = new TreeColumn(tableViewer.getTree(), SWT.LEFT);
commentColumn.setText(Messages.commentColumn);
commentColumn.setWidth(120);
/* Java Url */
TreeColumn javaUrlColumn = new TreeColumn(tableViewer.getTree(), SWT.LEFT);
javaUrlColumn.setText(Messages.javaUrlColumn);
javaUrlColumn.setWidth(300);
TreeColumn phpUrlColumn = new TreeColumn(tableViewer.getTree(), SWT.LEFT);
phpUrlColumn.setText(Messages.phpUrlColumn);
phpUrlColumn.setWidth(300);
tableViewer.setContentProvider(new TreeViewerContentProvider());
tableViewer.setLabelProvider(new TreeViewerLabelProvider());
tableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
if (event.getChecked()) {
CheckboxTreeViewer viewer = (CheckboxTreeViewer) event.getSource();
/* Select the sub node */
if (event.getElement() instanceof CubridServer) {
viewer.setSubtreeChecked(event.getElement(), true);
} else if (event.getElement() instanceof CubridDatabase) {
CubridDatabase database = (CubridDatabase) event.getElement();
viewer.setChecked(database.getServer(), true);
}
} else {
CheckboxTreeViewer viewer = (CheckboxTreeViewer) event.getSource();
ICubridNode element = (ICubridNode) event.getElement();
viewer.setSubtreeChecked(element, false);
if (element instanceof CubridDatabase) {
CubridDatabase database = (CubridDatabase) element;
/* Check the parent state */
ICubridNode parent = database.getParent();
if (parent != null) {
List<ICubridNode> children = parent.getChildren();
boolean isSelected = false;
for (ICubridNode child : children) {
DefaultSchemaNode childNode = (DefaultSchemaNode) child;
if (viewer.getChecked(childNode.getDatabase())) {
isSelected = true;
break;
}
}
viewer.setChecked(database.getServer(), isSelected);
}
}
}
updateWidgetStatus();
}
});
tableViewer.setInput(selections);
tableViewer.expandAll();
tableViewer.setAllChecked(true);
setTitle(Messages.titleExportConnection);
setMessage(Messages.msgExportConnection);
return parentComp;
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class ERSchemaTableNodesLoader method getAllTablesNode.
/**
* Get all the user tables node. If the table folder hasnot been expanded,
* it cannot get all nodes
*
* @return List<DefaultSchemaNode>
*/
public List<DefaultSchemaNode> getAllTablesNode() {
List<DefaultSchemaNode> nodes = new ArrayList<DefaultSchemaNode>();
if (!dbNode.isLogined()) {
return nodes;
}
String tablesFolderId = dbNode.getId() + CubridTablesFolderLoader.TABLES_FULL_FOLDER_SUFFIX_ID;
ICubridNode tablesFolder = dbNode.getChild(tablesFolderId);
if (null == tablesFolder) {
return nodes;
}
List<ICubridNode> children = tablesFolder.getChildren();
for (ICubridNode node : children) {
if (NodeType.USER_TABLE.equals(node.getType()) && node instanceof DefaultSchemaNode) {
nodes.add((DefaultSchemaNode) node);
}
}
return nodes;
}
use of com.cubrid.common.ui.spi.model.DefaultSchemaNode in project cubrid-manager by CUBRID.
the class FileToTableMappingComposite method getSelectedTableNode.
public List<DefaultSchemaNode> getSelectedTableNode() {
List<DefaultSchemaNode> result = new ArrayList<DefaultSchemaNode>();
Object[] itemArray = treeViewer.getCheckedElements();
for (Object object : itemArray) {
DefaultSchemaNode node = (DefaultSchemaNode) object;
result.add(node);
}
return result;
}
Aggregations