Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 3d4ded09eedb72e608128d0a6584113c947b0ec0 (plain) (blame)
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
package org.eclipse.papyrus.example.core.sashwindows.fulleditor.msgpage;

import org.eclipse.papyrus.sasheditor.contentprovider.IComponentModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;

/**
 * Description of the first page
 * 
 * @author dumoulin
 */

public class MessagePartModel implements IComponentModel {

	private String title;

	private String msg;

	static private int count = 0;


	/**
	 * 
	 */
	public MessagePartModel(String msg) {
		title = "newMsg " + count++;
		this.msg = msg;
	}

	/**
	 * @param title
	 */
	public MessagePartModel(String title, String msg) {
		this.title = title;
		this.msg = msg;
	}

	/**
	 * Return the control to be shown. {@inheritDoc}
	 */
	public Composite createPartControl(Composite parent) {
		Composite composite = new Composite(parent, SWT.NONE);
		FillLayout layout = new FillLayout();
		composite.setLayout(layout);
		StyledText text;

		text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
		text.setEditable(false);

		text.setText("  " + msg + " - " + getTabTitle());
		return composite;
	}

	public Image getTabIcon() {
		return null;
	}

	public String getTabTitle() {
		return title;
	}

	/**
	 * Return this. In this implementation, the rawModel and the IEditorModel are the same.
	 * 
	 */
	public Object getRawModel() {
		return this;
	}

}

Back to the top