Skip to content

Commit

Permalink
Revert maximum width of connection label
Browse files Browse the repository at this point in the history
- This is not desired behaviour
- This is not needed if a label expression is used like ${wordwrap:60:${name}}
- See #1056
  • Loading branch information
Phillipus committed Jul 9, 2024
1 parent 42f4319 commit 11ca641
Showing 1 changed file with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.ConnectionLocator;
import org.eclipse.draw2d.FigureUtilities;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Locator;
import org.eclipse.draw2d.geometry.Dimension;
// line-curves patch by Jean-Baptiste Sarrodie (aka Jaiguru)
// Use alternate PolylineConnection
//import org.eclipse.draw2d.PolylineConnection;
Expand Down Expand Up @@ -57,9 +55,6 @@ public abstract class AbstractDiagramConnectionFigure

private static Color TARGET_FEEDBACK_COLOR = new Color(0, 0, 255);

// Max width of text label
private static final int TEXT_LABEL_MAX_WIDTH = 300;

protected boolean SHOW_TARGET_FEEDBACK = false;

@Override
Expand Down Expand Up @@ -122,21 +117,7 @@ public TextFlow getConnectionLabel() {
fTextFlow = new TextFlow();
//fTextFlow.setLayoutManager(new ParagraphTextLayout(fTextFlow, ParagraphTextLayout.WORD_WRAP_HARD));

FlowPage flowPage = new FlowPage() {
@Override
public Dimension getPreferredSize(int wHint, int hHint) {
if(fTextFlow.getText().length() == 0) {
return new Dimension();
}

Dimension d = FigureUtilities.getTextExtents(fTextFlow.getText(), fTextFlow.getFont());
if(d.width > TEXT_LABEL_MAX_WIDTH) {
d = super.getPreferredSize(TEXT_LABEL_MAX_WIDTH, -1);
}
return d;
}
};

FlowPage flowPage = new FlowPage();
flowPage.add(fTextFlow);

add(flowPage);
Expand Down

0 comments on commit 11ca641

Please sign in to comment.