use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.
the class TableSchemaCompareExtraColumnLabelProvider method getText.
public String getText(Object element) {
TableSchemaCompareModel cm = (TableSchemaCompareModel) element;
TableDetailInfo tableInfo = null;
if (focus == 0) {
if (cm.getCompareStatus() != TableSchemaCompareModel.SCHEMA_SMISS) {
tableInfo = cm.getSourceTableDetailInfo();
}
} else if (focus == 1) {
if (cm.getCompareStatus() != TableSchemaCompareModel.SCHEMA_TMISS) {
tableInfo = cm.getTargetTableDetailInfo();
if (tableInfo == null) {
TableSchema tableSchema = (TableSchema) cm.getRight();
SchemaInfo schemaInfo = cm.getTargetSchemas().get(tableSchema.getName());
int columnCount = schemaInfo.getAttributes().size();
int idxCount = 0;
int pk = 0;
for (Constraint constraint : schemaInfo.getConstraints()) {
if (constraint.getType().equals(ConstraintType.PRIMARYKEY.getText())) {
pk++;
continue;
} else {
idxCount++;
}
}
tableInfo = new TableDetailInfo();
tableInfo.setPkCount(pk);
tableInfo.setColumnsCount(columnCount);
tableInfo.setIndexCount(idxCount);
}
}
}
if (type == RECORDS_COUNT) {
long tableRecordCount = 0;
if (tableInfo != null) {
tableRecordCount = tableInfo.getRecordsCount();
}
if (focus == 0) {
cm.setSourceRecords(tableRecordCount);
} else if (focus == 1) {
cm.setTargetRecords(tableRecordCount);
}
if (tableRecordCount < 0) {
return Messages.notCount;
}
return String.valueOf(tableRecordCount);
} else if (type == ATTRIBUTES_COUNT) {
int attributeCount = 0;
if (tableInfo != null) {
attributeCount = tableInfo.getColumnsCount();
}
return String.valueOf(attributeCount);
} else if (type == INDEX_COUNT) {
int indexCount = 0;
if (tableInfo != null) {
indexCount = tableInfo.getIndexCount();
}
return String.valueOf(indexCount);
} else if (type == PK_STATUS) {
int pkCount = 0;
if (tableInfo != null) {
pkCount = tableInfo.getPkCount();
}
if (pkCount > 0) {
return "Y";
}
return "";
}
return "";
}
use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method nodeChanged.
/**
* Perform node change event
*/
public void nodeChanged(CubridNodeChangedEvent event) {
if (CubridNodeChangedEventType.SERVER_DISCONNECTED.equals(event.getType())) {
close(event, database.getServer());
}
if (CubridNodeChangedEventType.DATABASE_LOGOUT.equals(event.getType()) || CubridNodeChangedEventType.DATABASE_STOP.equals(event.getType())) {
close(event, database);
}
ICubridNode node = event.getCubridNode();
if (NodeType.USER_TABLE.equals(node.getType()) || NodeType.USER_PARTITIONED_TABLE.equals(node.getType())) {
if (CubridNodeChangedEventType.NODE_ADD.equals(event.getType()) || CubridNodeChangedEventType.NODE_REFRESH.equals(event.getType())) {
refresh(node.getName());
}
if (CubridNodeChangedEventType.NODE_REMOVE.equals(event.getType())) {
TableDetailInfo tableInfo = findTableInfo(node.getName());
if (tableInfo != null) {
tableList.remove(tableInfo);
tableListView.refresh();
fireTableDetailChanged(tableInfo.getTableName());
}
}
if (CubridNodeChangedEventType.NODE_REFRESH.equals(event.getType())) {
refresh(node.getName());
fireTableDetailChanged(node.getName());
}
}
}
use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method copySelectedTableNamesToClipboard.
public void copySelectedTableNamesToClipboard() {
List<String> nameList = new ArrayList<String>();
List<Integer> selectIndex = new ArrayList<Integer>();
for (int i = 0; i < tableListView.getTable().getSelectionIndices().length; i++) {
selectIndex.add(tableListView.getTable().getSelectionIndices()[i]);
}
for (int i = 0; i < selectIndex.size(); i++) {
TableDetailInfo tableInfo = tableList.get(selectIndex.get(i));
if (tableInfo == null) {
continue;
}
nameList.add(tableInfo.getTableName());
}
copyNamesToClipboard(nameList);
}
use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method refresh.
/**
* Refresh the data
*
* @param name
*/
private void refresh(String name) {
final LoadTableDetailInfoTask loadTableDetailInfoTask = new LoadTableDetailInfoTask(Messages.tablesDetailInfoLoadingDataTitle, database, name);
CommonTaskExec taskExec = new CommonTaskExec(Messages.bind(Messages.tablesDetailInfoLoadingData, name));
taskExec.addTask(loadTableDetailInfoTask);
new ExecTaskWithProgress(taskExec).busyCursorWhile();
if (taskExec.isSuccess()) {
TableDetailInfo tableInfo = loadTableDetailInfoTask.getTableInfo();
if (tableInfo != null) {
TableDetailInfo oldTableInfo = findTableInfo(name);
if (oldTableInfo != null) {
TableDetailInfo.copyAllAttribute(tableInfo, oldTableInfo);
tableListView.refresh();
} else {
tableList.add(tableInfo);
tableListView.refresh();
}
}
}
}
use of com.cubrid.common.core.common.model.TableDetailInfo in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method getFirstSelectedNode.
/**
* Get first selected node
*
* @return
*/
private ICubridNode getFirstSelectedNode() {
TableItem[] items = tableListView.getTable().getSelection();
if (items.length > 0) {
TableItem item = items[0];
TableDetailInfo tableInfo = (TableDetailInfo) item.getData();
Set<String> typeSet = new HashSet<String>();
typeSet.add(NodeType.USER_TABLE);
typeSet.add(NodeType.USER_PARTITIONED_TABLE);
ICubridNode tableNode = CommonUITool.findNode(database, typeSet, tableInfo.getTableName());
return tableNode;
}
return null;
}
Aggregations