org.eclipse.swt.widgets.Label.setData()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中org.eclipse.swt.widgets.Label.setData()方法的一些代码示例,展示了Label.setData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setData()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Label
类名称:Label
方法名:setData

Label.setData介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public class SomePart {
  @PostConstruct
  public void postConstruct(Composite parent) {
    ...
    Label someLabel = new Label(parent);
    someLabel.setData(this);
    ...
  }
}

代码示例来源:origin: BiglySoftware/BiglyBT

public static void updateLinkedLabel(Label label, String hyperlink) {
  label.setData(hyperlink);
  Utils.setTT(label,hyperlink);
}

代码示例来源:origin: org.xworker/xworker_swt

public static void setValue(ActionContext actionContext){
  Label control = (Label) actionContext.get("control");
  Object value = actionContext.get("value");
  control.setData(value);
  if(value != null){
    control.setText(value.toString());
  }else{
    control.setText("");
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

private void createText() {
 Label textLabel = new Label( shell, SWT.WRAP );
 if( markupEnabled ) {
  textLabel.setData( RWT.MARKUP_ENABLED, Boolean.TRUE );
 }
 GridData data = new GridData( GridData.HORIZONTAL_ALIGN_FILL );
 int imageWidth = image == null ? 0 : image.getBounds().width;
 int maxTextWidth = MAX_WIDTH - imageWidth - SPACING;
 int maxLineWidth = getMaxMessageLineWidth();
 if( maxLineWidth > maxTextWidth ) {
  data.widthHint = maxTextWidth;
 }
 textLabel.setLayoutData( data );
 textLabel.setText( message );
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

private void setCSSData() {
  this.setData(CSSSWTConstants.CSS_ID_KEY, SPLASH_PROGRESS_PART_ID);
  fProgressIndicator.setData(CSSSWTConstants.CSS_ID_KEY, SPLASH_PROGRESS_INDICATOR_ID);
  fLabel.setData(CSSSWTConstants.CSS_ID_KEY, SPLASH_PROGRESS_TEXT_ID);
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

protected Combo addComboBox(Composite parent, String label, Key key, String[] values, String[] valueLabels, int indent) {
  GridData gd= new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 2, 1);
  gd.horizontalIndent= indent;
  Label labelControl= new Label(parent, SWT.LEFT);
  labelControl.setFont(JFaceResources.getDialogFont());
  labelControl.setText(label);
  labelControl.setLayoutData(gd);
  Combo comboBox= newComboControl(parent, key, values, valueLabels);
  comboBox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
  fLabels.put(comboBox, labelControl);
  labelControl.setData(DATA_PREF_HIGHLIGHT, PreferenceHighlight.addHighlight(labelControl, comboBox, true));
  return comboBox;
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
  public void handleEvent (Event event) {
    Control [] children = gRadio.getChildren ();
    for (int j=0; j<children.length; j++) {
       Control child = children [j];
       if (child instanceof Button) {
         Button button = (Button) child;
         if ((button.getStyle () & SWT.RADIO) != 0) button.setSelection (false);
       }
    }
    Button button = (Button) event.widget;
    button.setSelection (true);
    int mode = Integer.parseInt((String)button.getData("iMode"));
    text[0] = MessageText.getString("ConfigView.section.mode." + (String)button.getData("sMode"));
    labl.setText(text[0]);
    linkLabel.setText( MessageText.getString(messTexts[mode]) );
    linkLabel.setData( links[mode] );
    if(mode == 1){
      linkLabel1.setText( MessageText.getString(messTexts[3]) );
      linkLabel1.setData( links[3] );
    } else{
      linkLabel1.setText( "" );
      linkLabel1.setData( "" );
    }
    COConfigurationManager.setParameter("User Mode", Integer.parseInt((String)button.getData("iMode")));
    }
};

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
  public void handleEvent (Event event) {
    Control [] children = gRadio.getChildren ();
    for (int j=0; j<children.length; j++) {
       Control child = children [j];
       if (child instanceof Button) {
         Button button = (Button) child;
         if ((button.getStyle () & SWT.RADIO) != 0) button.setSelection (false);
       }
    }
    Button button = (Button) event.widget;
    button.setSelection (true);
    int mode = Integer.parseInt((String)button.getData("iMode"));
    selected_button[0] = button;
    setModeText.run();
    //linkLabel.setText( MessageText.getString(messTexts[mode]) );
    linkLabel.setData( links[mode] );
    /*
    if(mode == 1){
      linkLabel1.setText( MessageText.getString(messTexts[3]) );
      linkLabel1.setData( links[3] );
    } else{
      linkLabel1.setText( "" );
      linkLabel1.setData( "" );
    }
    */
    COConfigurationManager.setParameter("User Mode", Integer.parseInt((String)button.getData("iMode")));
    }
};

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

protected void highlight(final Composite parent, final Label labelControl, final Combo comboBox, final int color) {
  Object data= labelControl.getData();
  if (data == null) {
    if (color != HIGHLIGHT_NONE) {
      PaintListener painter= new HighlightPainter(parent, labelControl, comboBox, color);
      parent.addPaintListener(painter);
      labelControl.setData(painter);
    } else {
      return;
    }
  } else {
    if (color == HIGHLIGHT_NONE) {
      parent.removePaintListener((PaintListener) data);
      labelControl.setData(null);
    } else if (color != ((HighlightPainter) data).fColor){
      ((HighlightPainter) data).fColor= color;
    } else {
      return;
    }
  }
  
  parent.redraw();
}

代码示例来源:origin: org.eclipse/org.eclipse.compare

fMessage.setData(CompareUI.COMPARE_VIEWER_TITLE, Utilities.getString(fBundle, "title")); //$NON-NLS-1$

代码示例来源:origin: org.metawidget.modules/metawidget-all

label.setData( NAME, attributes.get( NAME ) + LABEL_NAME_SUFFIX );

代码示例来源:origin: BiglySoftware/BiglyBT

private HeaderInfo addHeader(String id, String title, AERunnable runnable) {
  Composite composite = new Composite(topArea, SWT.NONE);
  HeaderInfo headerInfo = new HeaderInfo(id, runnable, composite);
  composite.setBackgroundMode(SWT.INHERIT_FORCE);
  FillLayout fillLayout = new FillLayout();
  fillLayout.marginWidth = 6;
  fillLayout.marginHeight = 2;
  composite.setLayout(fillLayout);
  Display d = composite.getDisplay();
  composite.setBackground(Colors.getSystemColor(d, SWT.COLOR_LIST_BACKGROUND));
  composite.setForeground(Colors.getSystemColor(d, SWT.COLOR_LIST_FOREGROUND));
  Label control = new Label(composite, SWT.NONE);
  Messages.setLanguageText(control, title);
  control.setData("ID", headerInfo);
  control.addListener(SWT.MouseEnter, headerListener);
  control.addListener(SWT.Touch, headerListener);
  control.addListener(SWT.MouseExit, headerListener);
  control.addListener(SWT.Paint, headerListener);
  listHeaders.add(headerInfo);
  return headerInfo;
}

代码示例来源:origin: org.eclipse/org.eclipse.help.ui

private EngineDescriptor loadEngine(final EngineDescriptor edesc, Composite container, FormToolkit toolkit) {
  Label ilabel = toolkit.createLabel(container, null);
  ilabel.setImage(edesc.getIconImage());
  ilabel.setData(edesc);
  final Button master = toolkit.createButton(container, edesc.getLabel(), SWT.CHECK);
  master.setData(edesc);
  master.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
      scopeSetManager.getActiveSet().setEngineEnabled(edesc, master.getSelection());
    }
  });
  String desc = edesc.getDescription();
  if (desc != null) {
    Label spacer = toolkit.createLabel(container, null);
    spacer.setData(edesc);
    Label dlabel = toolkit.createLabel(container, desc, SWT.WRAP);
    dlabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    dlabel.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
    dlabel.setMenu(container.getMenu());
    dlabel.setData(edesc);
  }
  return edesc;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

iconLabel.setForeground(fg);
iconLabel.setBackground(bg);
iconLabel.setData(new GridData());

代码示例来源:origin: BiglySoftware/BiglyBT

/**
 * Alters a given label to make it appear like a launchable
 * link. This should preferably be done after all other changes
 * have been performed on the label - especially the setting of
 * the label's text.
 */
public static void makeLinkedLabel(Label label, String hyperlink) {
  label.setData(hyperlink);
  String tooltip = label.getToolTipText();
  // We only set a tooltip if one isn't set already and it isn't
  // identical to the label text.
  if (tooltip == null && !hyperlink.equals(label.getText())) {
    Utils.setTT(label,hyperlink.replaceAll("&", "&&"));
  }
  label.setCursor(label.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
  label.setForeground(Colors.blue);
  label.addMouseListener(new MouseAdapter() {
   @Override
   public void mouseDoubleClick(MouseEvent arg0) {
     Utils.launch((String) ((Label) arg0.widget).getData());
   }
   @Override
   public void mouseUp(MouseEvent arg0) {
     Utils.launch((String) ((Label) arg0.widget).getData());
   }
  });
  ClipboardCopy.addCopyToClipMenu( label );
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

@Override
public void createControl(Composite parent) {
  projectComposite = SWTUtils.createHVFillComposite(parent, 1);
  initializeDialogUnits(projectComposite);
  Label label = createLabel (projectComposite, TeamUIMessages.ExportProjectSetMainPage_SelectButton);
  GridData grid = (GridData) label.getLayoutData();
  label.setData(grid);
  SashForm form = new SashForm(projectComposite, SWT.HORIZONTAL);
  form.setLayout(new FillLayout());
  GridData data = new GridData(GridData.FILL_BOTH);
  form.setLayoutData(data);
  // Adds the working set table
  addWorkingSetSection(form);
  addProjectSection(form);
  form.setWeights(new int[] { 50, 50 });
  addButtons(projectComposite);
  setPageComplete(false);
}

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

public void createControl(Composite parent) {
    projectComposite = SWTUtils.createHVFillComposite(parent, 1);			
  initializeDialogUnits(projectComposite);
  Label label = createLabel (projectComposite, TeamUIMessages.ExportProjectSetMainPage_SelectButton);
  GridData grid = (GridData) label.getLayoutData();
  label.setData(grid);
  
  SashForm form = new SashForm(projectComposite, SWT.HORIZONTAL);
  form.setLayout(new FillLayout());
  GridData data = new GridData(GridData.FILL_BOTH);
  form.setLayoutData(data);
  // Adds the working set table
  addWorkingSetSection(form);
  addProjectSection(form);
  form.setWeights(new int[] { 75, 25 });
  addButtons(projectComposite);
  updateEnablement();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

iconLabel.setForeground(fg);
iconLabel.setBackground(bg);
iconLabel.setData(new GridData());

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

@Override
  public void paintControl(PaintEvent e) {
    if (((GridData) fLabelControl.getLayoutData()).exclude) {
      fParent.removePaintListener(this);
      fLabelControl.setData(null);
      return;
    }
    
    int GAP= 7;
    int ARROW= 3;
    Rectangle l= fLabelControl.getBounds();
    Point c= fComboBox.getLocation();
    
    e.gc.setForeground(e.display.getSystemColor(fColor));
    int x2= c.x - GAP;
    int y= l.y + l.height / 2 + 1;
    
    e.gc.drawLine(l.x + l.width + GAP, y, x2, y);
    e.gc.drawLine(x2 - ARROW, y - ARROW, x2, y);
    e.gc.drawLine(x2 - ARROW, y + ARROW, x2, y);
  }
}

代码示例来源:origin: openaudible/openaudible

d.setData(e);

相关文章