Search in sources :

Example 76 with EditPart

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);
        }
    }
}
Also used : ScalableFreeformRootEditPart(org.eclipse.gef.editparts.ScalableFreeformRootEditPart) EditPart(org.eclipse.gef.EditPart)

Example 77 with EditPart

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;
}
Also used : ValidationGraphicalViewer(com.cubrid.common.ui.er.ValidationGraphicalViewer) EditDomain(org.eclipse.gef.EditDomain) ERSchemaEditDomain(com.cubrid.common.ui.er.editor.ERSchemaEditDomain) ScalableFreeformRootEditPart(org.eclipse.gef.editparts.ScalableFreeformRootEditPart) ERSchemaEditor(com.cubrid.common.ui.er.editor.ERSchemaEditor) ScalableFreeformRootEditPart(org.eclipse.gef.editparts.ScalableFreeformRootEditPart) EditPart(org.eclipse.gef.EditPart) ERSchemaEditDomain(com.cubrid.common.ui.er.editor.ERSchemaEditDomain) EditPartViewer(org.eclipse.gef.EditPartViewer)

Example 78 with EditPart

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();
    }
}
Also used : SchemaDiagramPart(com.cubrid.common.ui.er.part.SchemaDiagramPart) FreeformGraphicalRootEditPart(org.eclipse.gef.editparts.FreeformGraphicalRootEditPart) EditPart(org.eclipse.gef.EditPart) Point(org.eclipse.draw2d.geometry.Point) FreeformGraphicalRootEditPart(org.eclipse.gef.editparts.FreeformGraphicalRootEditPart)

Example 79 with EditPart

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));
    }
}
Also used : EditPart(org.eclipse.gef.EditPart) TablePart(com.cubrid.common.ui.er.part.TablePart) LinkedList(java.util.LinkedList) RelationshipPart(com.cubrid.common.ui.er.part.RelationshipPart) ColumnPart(com.cubrid.common.ui.er.part.ColumnPart) List(java.util.List) LinkedList(java.util.LinkedList) HashSet(java.util.HashSet)

Example 80 with EditPart

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);
}
Also used : EditPart(org.eclipse.gef.EditPart) Request(org.eclipse.gef.Request)

Aggregations

EditPart (org.eclipse.gef.EditPart)132 List (java.util.List)50 ArrayList (java.util.ArrayList)37 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)26 NodeContainerEditPart (org.knime.workbench.editor2.editparts.NodeContainerEditPart)20 ProcessPart (org.talend.designer.core.ui.editor.process.ProcessPart)19 SubjobContainerPart (org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart)18 Point (org.eclipse.draw2d.geometry.Point)17 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)17 Command (org.eclipse.gef.commands.Command)16 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)16 ConnectionEditPart (org.eclipse.gef.ConnectionEditPart)15 ConnectionContainerEditPart (org.knime.workbench.editor2.editparts.ConnectionContainerEditPart)14 Node (org.talend.designer.core.ui.editor.nodes.Node)13 RootEditPart (org.eclipse.gef.RootEditPart)11 ConnLabelEditPart (org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)11 NodeContainerPart (org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart)11 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)10 ScalableFreeformRootEditPart (org.eclipse.gef.editparts.ScalableFreeformRootEditPart)10 INode (org.talend.core.model.process.INode)10