1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
	public void createPartControl(Composite parent) {
		parent.setLayout(new FillLayout());
		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIDs.HELP_PLUGIN_ID + "." + IHelpContextIDs.WELCOME_SCREEN);

		this.boldFont = SWTResourceManager.getBoldFont(Display.getCurrent().getSystemFont());
		this.normalFont = Display.getCurrent().getSystemFont();
		
//		topComposite = toolkit.createComposite(parent);
//		topComposite.setLayout(new FillLayout());

		scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
		scrolledComposite.setLayout(new FillLayout());
		scrolledComposite.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));

		canvas = new Canvas(scrolledComposite, SWT.NONE);
		scrolledComposite.setContent(canvas);
		canvas.setLayout(new FormLayout());
		canvas.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
		{
			Image bg_image = ResourceManager.getPluginImage(Activator.getDefault().getBundle().getSymbolicName(), "icons/intro/header_bg.png");
			topArea = new Canvas(canvas, SWT.NO_REDRAW_RESIZE);
			{
				FormData formData = new FormData();
				formData.height = 25;
				formData.right = new FormAttachment(100);
				formData.left = new FormAttachment(0);
				topArea.setLayoutData(formData);
			}
			topArea.setBackgroundImage(bg_image);
			GridLayout gridLayout = new GridLayout(2, false);
			gridLayout.marginHeight = 0;
			gridLayout.verticalSpacing = 0;
			topArea.setLayout(gridLayout);
			{
				Canvas title = new Canvas(topArea, SWT.TRANSPARENT);
				title.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
				title.setBackgroundImage(bg_image); // this is needed to display the header background on OSX
				title.addPaintListener(new PaintListener() {
					public void paintControl(PaintEvent e) {
						e.gc.drawImage(ResourceManager.getPluginImage(Activator.getDefault().getBundle().getSymbolicName(),
								"icons/intro/header_title.png"), 0, 0);
					}
				});
			}

			{
				// CLOSE Button.
				Canvas title = new Canvas(topArea, SWT.NO_REDRAW_RESIZE);
				title.setBackgroundImage(ResourceManager.getPluginImage(Activator.getDefault().getBundle().getSymbolicName(),
						"icons/intro/bg_topline.png"));
				title.addPaintListener(new PaintListener() {
					public void paintControl(PaintEvent e) {
						e.gc.drawImage(ResourceManager.getPluginImage(Activator.getDefault().getBundle().getSymbolicName(), "icons/intro/close.png"),
								0, 0);

					}
				});
				title.setBounds(0, 0, 19, 19);
				// TODO: Check here if cursor has to be releases from memory again cursor.dispose(); ???
				title.setCursor(new Cursor(Display.getCurrent(), SWT.CURSOR_HAND));
				{
					GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
					gridData.heightHint = 19;
					gridData.widthHint = 19;
					title.setLayoutData(gridData);
				}
				title.addMouseListener(new MouseAdapter() {
					@Override
					public void mouseUp(MouseEvent e) {
						new CloseWelcomeScreenAction().run();
					}
				});
			}
		}
...
}