예제 #1
0
 private String abbreviateLabel(Label label, String labelText, int currentLength) {
   label.setText(labelText);
   if (label.getFont() == null) {
     label.setFont(Display.getDefault().getSystemFont());
   }
   if (label.getTextBounds().width > MAX_LABEL_WIDTH) {
     String shorterLabelText = "";
     shorterLabelText =
         StringUtils.abbreviateMiddle(label.getText(), LABEL_TEXT_SEPARATOR, currentLength);
     currentLength--;
     label.setText(shorterLabelText);
     abbreviateLabel(label, shorterLabelText, currentLength);
   }
   return label.getText();
 }
 /** @generated */
 protected void updateLabel(Label target) {
   Label source = (Label) getHostFigure();
   target.setText(source.getText());
   target.setTextAlignment(source.getTextAlignment());
   target.setFont(source.getFont());
 }