public void refreshVisuals() { // If the text position has been changed by user update it if (fDiagramModelConnection.getTextPosition() != fTextPosition) { fTextPosition = fDiagramModelConnection.getTextPosition(); setLabelLocator(fTextPosition); } setLabelFont(); setLabelFontColor(); setLineColor(); setConnectionText(); setLineWidth(); // Set Enabled according to current Viewpoint boolean enabled = ViewpointsManager.INSTANCE.isAllowedType(getModelConnection()); setEnabled(enabled); if (getSourceDecoration() != null) { getSourceDecoration().setEnabled(enabled); } if (getTargetDecoration() != null) { getTargetDecoration().setEnabled(enabled); } getConnectionLabel().setEnabled(enabled); }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ public void removeConnection(IDiagramModelConnection connection) { if (connection == null) { throw new IllegalArgumentException(); } if (connection.getSource() == this) { getSourceConnections().remove(connection); } if (connection.getTarget() == this) { getTargetConnections().remove(connection); } }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ public void addConnection(IDiagramModelConnection connection) { if (connection == null) { throw new IllegalArgumentException("Connection was null"); // $NON-NLS-1$ } // This used to be "if/else if". This way it is possible for source == target (recursive) if (connection.getSource() == this) { getSourceConnections().add(connection); } if (connection.getTarget() == this) { getTargetConnections().add(connection); } }
/** Set the font color to that in the model, or failing that, as per default */ protected void setLabelFontColor() { String val = fDiagramModelConnection.getFontColor(); Color c = ColorFactory.get(val); if (c == null) { c = ColorConstants.black; // have to set default color otherwise it inherits line color } if (c != fFontColor) { fFontColor = c; getConnectionLabel().setForegroundColor(c); } }
/** Set the font in the label to that in the model, or failing that, as per user's default */ protected void setLabelFont() { String fontName = fDiagramModelConnection.getFont(); Font font = FontFactory.get(fontName); // Adjust for Windows DPI if (PlatformUtils.isWindows()) { font = FontFactory.getAdjustedWindowsFont(font); } getConnectionLabel().setFont(font); }
/** Set the line color to that in the model, or failing that, as per default */ protected void setLineColor() { String val = fDiagramModelConnection.getLineColor(); Color color = ColorFactory.get(val); if (color == null) { color = ColorFactory.getDefaultLineColor(fDiagramModelConnection); } if (color != fLineColor) { fLineColor = color; setForegroundColor(color); } }
protected void setLineWidth() { setLineWidth(fDiagramModelConnection.getLineWidth()); }
protected void setConnectionText() { getConnectionLabel().setText(fDiagramModelConnection.getName()); }