private List<NormalColumn> getSelectedReferencedColulmnList() { List<NormalColumn> referencedColulmnList = new ArrayList<NormalColumn>(); TableViewEditPart parent = (TableViewEditPart) this.getParent(); TableView tableView = (TableView) parent.getModel(); for (Object object : parent.getSourceConnections()) { ConnectionEditPart connectionEditPart = (ConnectionEditPart) object; int selected = connectionEditPart.getSelected(); if (selected == EditPart.SELECTED || selected == EditPart.SELECTED_PRIMARY) { ConnectionElement connectionElement = (ConnectionElement) connectionEditPart.getModel(); if (connectionElement instanceof Relation) { Relation relation = (Relation) connectionElement; if (relation.isReferenceForPK()) { referencedColulmnList.addAll(((ERTable) tableView).getPrimaryKeys()); } else if (relation.getReferencedComplexUniqueKey() != null) { referencedColulmnList.addAll(relation.getReferencedComplexUniqueKey().getColumnList()); } else { referencedColulmnList.add(relation.getReferencedColumn()); } } } } return referencedColulmnList; }
/** @generated */ protected Command getReconnectSourceCommand(ReconnectRequest request) { ConnectionEditPart connection = request.getConnectionEditPart(); if (connection.getModel() instanceof Edge == false) { return null; } Edge edge = (Edge) connection.getModel(); String modelID = ImaginDataVisualIDRegistry.getModelID(edge); if (!DiagramEditPart.MODEL_ID.equals(modelID)) { return null; } org.eclipse.emf.common.command.Command result = null; int visualID = ImaginDataVisualIDRegistry.getVisualID(edge); switch (visualID) { case TransitionEditPart.VISUAL_ID: result = new ReconnectTransition4001SourceCommand(request); break; } if (result == null || !result.canExecute()) { return null; } return new WrappingCommand( TransactionUtil.getEditingDomain(((Node) getHost().getModel()).getDiagram().getElement()), result); }
private List<NormalColumn> getSelectedForeignKeyColulmnList() { List<NormalColumn> foreignKeyColulmnList = new ArrayList<NormalColumn>(); TableViewEditPart parent = (TableViewEditPart) this.getParent(); for (Object object : parent.getTargetConnections()) { ConnectionEditPart connectionEditPart = (ConnectionEditPart) object; int selected = connectionEditPart.getSelected(); if (selected == EditPart.SELECTED || selected == EditPart.SELECTED_PRIMARY) { ConnectionElement connectionElement = (ConnectionElement) connectionEditPart.getModel(); if (connectionElement instanceof Relation) { Relation relation = (Relation) connectionElement; foreignKeyColulmnList.addAll(relation.getForeignKeyColumns()); } } } return foreignKeyColulmnList; }
@Override public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) { if (anchorMap == null) fillAnchorMap(); ConnectionModel conn = (ConnectionModel) connection.getModel(); return anchorMap.get(conn.getTargetTerminal()); }