Java 类org.eclipse.ui.views.properties.tabbed.AbstractPropertySection 实例源码

项目:seg.jUCMNav    文件:GEFTabbedPropertySheetPage.java   
public int getLabelWidth(AbstractGEFPropertySection section, Composite parent, String[] labels) {
    int standardLabelWidth = AbstractPropertySection.STANDARD_LABEL_WIDTH;

    String stringWidth = (String) maxLabelWidth.get(sectionToTab.get(section));

    GC gc = new GC(parent);
    int indent = gc.textExtent("XXX").x; //$NON-NLS-1$

    int width = gc.textExtent(stringWidth).x;
    if (width + indent > standardLabelWidth) {
        standardLabelWidth = width + indent;
    } else
        standardLabelWidth = Math.max(width + indent, standardLabelWidth);

    gc.dispose();

    return standardLabelWidth;
}