use of com.cubrid.common.ui.er.part.ColumnPart in project cubrid-manager by CUBRID.
the class ColumnDirectEditPolicy method showCurrentEditValue.
@Override
protected void showCurrentEditValue(DirectEditRequest request) {
String value = (String) request.getCellEditor().getValue();
ColumnPart columnPart = (ColumnPart) getHost();
columnPart.handleNameChange(value);
}
use of com.cubrid.common.ui.er.part.ColumnPart in project cubrid-manager by CUBRID.
the class ColumnDirectEditPolicy method revertOldEditValue.
@Override
protected void revertOldEditValue(DirectEditRequest request) {
CellEditor cellEditor = request.getCellEditor();
cellEditor.setValue(oldValue);
ColumnPart columnPart = (ColumnPart) getHost();
columnPart.revertNameChange(oldValue);
}
use of com.cubrid.common.ui.er.part.ColumnPart in project cubrid-manager by CUBRID.
the class SchemaContextMenuProvider method buildContextMenu.
@Override
public void buildContextMenu(IMenuManager menu) {
if (!(menu instanceof SchemaContextMenuProvider)) {
return;
}
SchemaContextMenuProvider menuProvider = (SchemaContextMenuProvider) menu;
EditPartViewer viewer = menuProvider.getViewer();
if (viewer == null) {
return;
}
buildPublicMenuItems(menu);
List selectParts = viewer.getSelectedEditParts();
// blank right-click
if (selectParts == null || selectParts.size() == 0) {
return;
}
// multi-objects right-click
if (selectParts.size() > 1) {
buildMultiFiguresMenuItems(menu);
return;
}
// one object right-click
Object object = selectParts.get(0);
if (object instanceof TablePart) {
buildTableMenuItems(menu);
} else if (object instanceof ColumnPart) {
buildColumnMenuItems(menu);
} else if (object instanceof RelationshipPart) {
buildRelationshipLineMenuItems(menu);
}
}
use of com.cubrid.common.ui.er.part.ColumnPart in project cubrid-manager by CUBRID.
the class TableLayoutEditPolicy method createAddCommand.
@Override
protected Command createAddCommand(EditPart child, EditPart after) {
if (!(child instanceof ColumnPart) || !(after instanceof ColumnPart)) {
return null;
}
ERTableColumn toMove = (ERTableColumn) child.getModel();
ERTableColumn afterModel = (ERTableColumn) after.getModel();
TablePart originalTablePart = (TablePart) child.getParent();
ERTable originalTable = (ERTable) originalTablePart.getModel();
TablePart newTablePart = (TablePart) after.getParent();
ERTable newTable = newTablePart.getTable();
int oldIndex = originalTablePart.getChildren().indexOf(child);
int newIndex = newTablePart.getChildren().indexOf(after);
return new TransferColumnCommand(toMove, afterModel, originalTable, newTable, oldIndex, newIndex);
}
use of com.cubrid.common.ui.er.part.ColumnPart in project cubrid-manager by CUBRID.
the class DeleteAction method run.
/**
* 1. First, delete relationship connection line; <br>
* 2. Then, delete column; <br>
* 3. Delete table at last.
*/
public void run() {
List objects = getSelectedObjects();
if (objects.isEmpty()) {
return;
}
List<EditPart> lineParts = new LinkedList<EditPart>();
List<EditPart> columnParts = new LinkedList<EditPart>();
List<EditPart> tableParts = new LinkedList<EditPart>();
List<String> tableNames = new LinkedList<String>();
Set<String> columnNames = new HashSet<String>();
int lineCount = 0;
for (Object obj : objects) {
if (obj == null) {
continue;
}
if (obj instanceof RelationshipPart) {
lineParts.add((RelationshipPart) obj);
lineCount++;
} else if (obj instanceof ColumnPart) {
columnParts.add((ColumnPart) obj);
columnNames.add(((ColumnPart) obj).getName());
} else if (obj instanceof TablePart) {
tableParts.add((TablePart) obj);
tableNames.add(((TablePart) obj).getName());
}
}
List<EditPart> allParts = new LinkedList<EditPart>(lineParts);
allParts.addAll(columnParts);
allParts.addAll(tableParts);
StringBuilder msg = new StringBuilder(Messages.msgConfirmDelete);
if (!tableNames.isEmpty()) {
msg.append(StringUtil.NEWLINE).append(Messages.msgConfirmDeleteTableList).append(tableNames.toString());
}
if (!columnNames.isEmpty()) {
msg.append(StringUtil.NEWLINE).append(Messages.msgConfirmDeleteColumnList).append(columnNames.toString());
}
if (lineCount != 0) {
msg.append(StringUtil.NEWLINE).append(Messages.msgConfirmDeleteLineCount).append(lineCount);
}
boolean delete = CommonUITool.openConfirmBox(getWorkbenchPart().getSite().getShell(), msg.toString());
if (delete) {
execute(buildDeleteCommands(allParts));
}
}
Aggregations