public class SomePart { @PostConstruct public void postConstruct(Composite parent) { ... Label someLabel = new Label(parent); someLabel.setData(this); ... } }
public static void updateLinkedLabel(Label label, String hyperlink) { label.setData(hyperlink); Utils.setTT(label,hyperlink); }
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(""); } }
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 ); }
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); }
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; }
@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"))); } };
@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"))); } };
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(); }
fMessage.setData(CompareUI.COMPARE_VIEWER_TITLE, Utilities.getString(fBundle, "title")); //$NON-NLS-1$
label.setData( NAME, attributes.get( NAME ) + LABEL_NAME_SUFFIX );
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; }
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; }
iconLabel.setForeground(fg); iconLabel.setBackground(bg); iconLabel.setData(new GridData());
/** * 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 ); }
@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); }
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(); }
iconLabel.setForeground(fg); iconLabel.setBackground(bg); iconLabel.setData(new GridData());
@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); } }