Skip to content

Instantly share code, notes, and snippets.

@caritos
Last active January 3, 2016 19:49
Show Gist options
  • Save caritos/8510832 to your computer and use it in GitHub Desktop.
Save caritos/8510832 to your computer and use it in GitHub Desktop.
HelloWorldPart used in the code post for 2014-01-02-add-logging-via-dependency-injection.md
package com.caritos.e4.product.parts;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.osgi.service.log.LogService;
public class HelloWorldPart {
private Label label;
@Inject
private LogService log;
@PostConstruct
public void createComposite(Composite parent) {
label = new Label(parent, SWT.NONE);
label.setText("Hello World");
log.log(LogService.LOG_DEBUG, "inside createComposite");
}
@Focus
public void setFocus() {
label.setFocus();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment