01: package net.sourceforge.tracelog.ui;
02:
03: import net.sourceforge.tracelog.utils.ProjectProperties;
04: import net.sourceforge.tracelog.utils.Util;
05:
06: import org.eclipse.swt.widgets.Composite;
07: import org.eclipse.swt.widgets.Display;
08: import org.eclipse.swt.widgets.Shell;
09:
10: public abstract class AbstractWidget {
11: protected String appTitle;
12: protected String appVersion;
13: protected String authorName;
14: protected Display display;
15: protected IMediator mediator;
16: protected Composite parentComposite;
17: protected Shell parentShell;
18: protected ProjectProperties projectProperties;
19: protected WidgetFactory widgetFactory;
20:
21: protected AbstractWidget() {
22: this .mediator = null;
23: this .parentShell = null;
24: this .parentComposite = null;
25: this .display = UIUtil.getDisplay();
26: this .projectProperties = ProjectProperties.getInstance();
27: this .appTitle = projectProperties.getApplicationTitle();
28: this .authorName = projectProperties.getAuthorName();
29: this .appVersion = Util.getLatestVersion();
30: this .widgetFactory = WidgetFactory.getInstance();
31: }
32:
33: public abstract void run();
34:
35: public final void setMediator(IMediator mediator) {
36: this .mediator = mediator;
37:
38: if (mediator != null) {
39: this .mediator.register(this );
40: }
41: }
42:
43: public final void setParentComposite(Composite parentComposite) {
44: this .parentComposite = parentComposite;
45: }
46:
47: public final void setParentShell(Shell parentShell) {
48: this.parentShell = parentShell;
49: }
50: }
|