Java Code Examples for org.eclipse.swt.widgets.Label#getDisplay()

The following examples show how to use org.eclipse.swt.widgets.Label#getDisplay() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomAbstractInformationControl.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void createStatusLabel(final String statusFieldText, Color foreground, Color background)
{
	fStatusLabel = new Label(fStatusComposite, SWT.RIGHT);
	fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	fStatusLabel.setText(statusFieldText);

	FontData[] fontDatas = JFaceResources.getDialogFont().getFontData();
	for (int i = 0; i < fontDatas.length; i++)
	{
		fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
	}
	fStatusLabelFont = new Font(fStatusLabel.getDisplay(), fontDatas);
	fStatusLabel.setFont(fStatusLabelFont);

	// Appcelerator Mod
	updateStatusColors(foreground, background);
}
 
Example 2
Source File: LabelImageLoader.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
/**
 * Loads an image to a {@link Label}. The image will be fetched from {@code imageUrl}
 * asynchronously if not previously cached.
 *
 * Must be called in the UI context.
 */
@VisibleForTesting
public void loadImage(String imageUrl, Label label) throws MalformedURLException {
  Preconditions.checkNotNull(imageUrl);

  ImageData imageData = cache.get(imageUrl);
  if (imageData != null) {
    Image image = new Image(label.getDisplay(), imageData);
    label.addDisposeListener(new ImageDisposer(image));
    label.setImage(image);
  } else {
    loadJob = new LabelImageLoadJob(new URL(imageUrl), label);
    loadJob.schedule();
  }
}
 
Example 3
Source File: LinkSwtParameter.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
public LinkSwtParameter(Composite composite, String name_resource,
		String labelKey, String url) {
	super(name_resource);

	if (labelKey != null) {
		Label label = new Label(composite, SWT.NONE);
		Messages.setLanguageText(label, labelKey);
		setRelatedControl(label);
	}

	link_label = new Label(composite, SWT.WRAP);
	setMainControl(link_label);
	this.url = url;
	Messages.setLanguageText(link_label, name_resource);
	Display display = link_label.getDisplay();
	link_label.setCursor(display.getSystemCursor(SWT.CURSOR_HAND));
	link_label.setForeground(display.getSystemColor(SWT.COLOR_LINK_FOREGROUND));
	link_label.addListener(SWT.MouseUp, e -> {
		if (e.button == 1) {
			triggerChangeListeners(false);
		} else {
			e.doit = true;
		}
	});
	link_label.addListener(SWT.MouseDoubleClick,
			e -> triggerChangeListeners(false));
	link_label.setData(url);
	ClipboardCopy.addCopyToClipMenu(link_label);

	if (doGridData(composite) && labelKey == null) {
		GridLayout parentLayout = (GridLayout) composite.getLayout();
		if (parentLayout.numColumns >= 2) {
			GridData gridData = Utils.getWrappableLabelGridData(2,
					GridData.FILL_HORIZONTAL);
			link_label.setLayoutData(gridData);
		} else {
			link_label.setLayoutData(new GridData());
		}
	}

	if (url != null) {
		Utils.setTT(link_label, url);
	}
}
 
Example 4
Source File: LabelImageLoadJob.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
LabelImageLoadJob(URL imageUrl, Label label) {
  super("Google User Profile Picture Fetch Job");
  this.imageUrl = Preconditions.checkNotNull(imageUrl);
  this.label = label;
  display = label.getDisplay();  // Save display early while "label" is alive.
}
 
Example 5
Source File: UpdatesCheck.java    From Rel with Apache License 2.0 4 votes vote down vote up
public UpdatesCheck(Button btnSend, Label lblProgress, ProgressBar progressBar) {
	this.display = lblProgress.getDisplay();
	this.btnGo = btnSend;
	this.lblProgress = lblProgress;
	this.progressBar = progressBar;
}