未验证 提交 f0566c36 编写于 作者: S Serge Rider 提交者: GitHub

Merge pull request #13462 from dbeaver/erd-columns-navigate-fix#12824

#12824 Extend bounds of column's figure to prevent navigation bugs
......@@ -20,6 +20,8 @@ import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.ToolbarLayout;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.jkiss.code.NotNull;
......@@ -155,4 +157,21 @@ public class AttributeItemFigure extends Figure
((Label)rightPanel).setText(rightText);
}
}
@Override
public Rectangle getBounds() {
final IFigure parent = getParent();
if (parent != null && parent.getBorder() != null) {
// Extend bounds to the parent's width. This is required for navigation to work correctly:
// If there's two attributes whose names have different length (e.g. 'id' and 'description'),
// descending direction between them would be 'east', not 'south', since that's what GEF thinks.
// See org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler.getNavigationPoint
final Insets insets = parent.getBorder().getInsets(this);
final Rectangle bounds = parent.getBounds();
return super.getBounds().getCopy()
.setX(bounds.x + insets.left)
.setWidth(bounds.width - insets.left - insets.right);
}
return super.getBounds();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册