blob: e57dc9c1f9ad6e56fa34cadddfa38b569b2caf70 (
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/*****************************************************************************
* 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.infra.core.sasheditor.tests.texteditor;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
import org.eclipse.papyrus.infra.core.sasheditor.tests.utils.trace.ITraceRecords;
import org.eclipse.papyrus.infra.core.sasheditor.tests.utils.trace.TraceRecordsFactory;
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 {
/**
* Records used to record traces.
*/
private ITraceRecords traceRecords;
private String title;
static private int count = 0;
/**
* @param title
*/
public TextEditorPartModel(String title) {
this( title, false);
}
/**
* @param title
*/
public TextEditorPartModel(String title, boolean isRecording) {
this(title, TraceRecordsFactory.createTraceRecords(isRecording));
}
/**
*
*/
public TextEditorPartModel() {
this( null, false);
}
/**
* @param title
*/
public TextEditorPartModel(String title, ITraceRecords traceRecords) {
this.title = title;
if( title == null)
this.title = "newText" + count++;
this.traceRecords = traceRecords;
}
/**
* @return the traceRecords
*/
public ITraceRecords getTraceRecords() {
return traceRecords;
}
/**
* @param traceRecords the traceRecords to set
*/
public void setTraceRecords(ITraceRecords traceRecords) {
this.traceRecords = traceRecords;
}
public IEditorPart createIEditorPart() throws PartInitException {
// Create an editor with the requested traceRecords
TestTextEditor editor = new TestTextEditor(title, traceRecords);
editor.setPartName(title);
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;
}
}
|