Skip to main content
summaryrefslogtreecommitdiffstats
blob: 949e0d8fb17edc7e20111734e1a535dff7a3ea16 (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
74
75
76
77
78
79
80
81
/*****************************************************************************
 * Copyright (c) 2009 CEA LIST & LIFL 
 *
 *    
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Cedric Dumoulin  Cedric.dumoulin@lifl.fr - Initial API and implementation
 *
 *****************************************************************************/
package org.eclipse.papyrus.example.core.sashwindows.fulleditor.texteditor;

import org.eclipse.papyrus.sasheditor.contentprovider.IEditorModel;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorActionBarContributor;

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

public class TextEditorPartModel implements IEditorModel {

	/** The text editor used in page 0. */
	private TabTextEditor editor;

	private String title;

	static private int count = 0;

	/**
	 * @param title
	 */
	public TextEditorPartModel(String title) {
		this.title = title;
	}

	/**
		 * 
		 */
	public TextEditorPartModel() {
		title = "newText" + count++;
	}

	public IEditorPart createIEditorPart() throws PartInitException {
		editor = new TabTextEditor();
		if(title == null)
			title = "newText" + count++;
		return editor;
	}

	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;
	}

	/**
	 * Return the ActionBarContributor dedicated to the created editor.
	 * Can return null if no particular ActionBarContributor is required.;
	 */
	public EditorActionBarContributor getActionBarContributor() {
		return null;
	}
}

Back to the top