use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.
the class SchemaDiagramPart method handleViewModelChange.
@Override
protected void handleViewModelChange(PropertyChangeEvent evt) {
List<EditPart> children = getChildren();
for (EditPart part : children) {
if (part instanceof TablePart) {
TablePart tablePart = (TablePart) part;
tablePart.handleViewModelChange(evt);
}
}
}
use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.
the class SchemaDiagramPart method getEditor.
public ERSchemaEditor getEditor() {
EditPart parentP = getParent();
if (parentP instanceof ScalableFreeformRootEditPart) {
ScalableFreeformRootEditPart parentEditor = (ScalableFreeformRootEditPart) parentP;
EditPartViewer viewer = parentEditor.getViewer();
if (viewer instanceof ValidationGraphicalViewer) {
ValidationGraphicalViewer gViewer = (ValidationGraphicalViewer) viewer;
EditDomain domain = gViewer.getEditDomain();
if (domain instanceof ERSchemaEditDomain) {
ERSchemaEditDomain erEditorDomain = (ERSchemaEditDomain) domain;
return (ERSchemaEditor) erEditorDomain.getEditorPart();
}
}
}
return null;
}
use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.
the class ERSchemaEditDomain method mouseDown.
/**
* the button in the para of mouseEvent, that was pressed or released; 1 for
* the left click, 2 for the double left-click, and 3 for the right click,
* etc.
*/
public void mouseDown(MouseEvent mouseEvent, EditPartViewer viewer) {
ERSchemaEditor erschemaEditor = (ERSchemaEditor) this.getEditorPart();
Point location = new Point(mouseEvent.x, mouseEvent.y);
EditPart part = erschemaEditor.getGraphicalViewer().findObjectAt(location);
if (part != null && ((part instanceof SchemaDiagramPart) || (part instanceof FreeformGraphicalRootEditPart))) {
if (getDefaultTool().equals(getActiveTool())) {
setActiveTool(erDragTool);
// when click on "FreeformGraphicalRootEditPart", its on the
// extending space of "EXDefaultRangeModel"
}
}
if (mouseEvent.button == 3 && !getDefaultTool().equals(getActiveTool())) {
// mouseEvent.button == 3 : right click
setActiveTool(getDefaultTool());
}
super.mouseDown(mouseEvent, viewer);
if (part != null && part instanceof SchemaDiagramPart) {
erschemaEditor.setAllFiguresOrigin();
}
}
use of org.eclipse.gef.EditPart 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));
}
}
use of org.eclipse.gef.EditPart in project cubrid-manager by CUBRID.
the class ImportERwinDataAction method createImportERwinDataCommand.
public Command createImportERwinDataCommand() {
if (!(getSelectedObjects().get(0) instanceof EditPart)) {
return null;
}
EditPart object = (EditPart) getSelectedObjects().get(0);
Request addTablesReq = new Request(ImportERwinDataAction.ID);
return object.getCommand(addTablesReq);
}
Aggregations