blob: d6171dd0518275b8dd690c4015fa01fe078d8347 (
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
|
/*******************************************************************************
* Copyright (c) 2012 protos software gmbh (http://www.protos.de).
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* CONTRIBUTORS:
* Henrik Rentz-Reichert (initial contribution)
*
*******************************************************************************/
package org.eclipse.etrice.core.etphys.ui.labeling;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.etrice.core.common.base.Import;
import org.eclipse.etrice.core.common.ui.labeling.BaseLabelProvider;
import org.eclipse.etrice.core.etphys.eTPhys.NodeClass;
import org.eclipse.etrice.core.etphys.eTPhys.NodeRef;
import org.eclipse.etrice.core.etphys.eTPhys.PhysicalModel;
import org.eclipse.etrice.core.etphys.eTPhys.PhysicalSystem;
import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread;
import org.eclipse.etrice.core.etphys.eTPhys.RuntimeClass;
import org.eclipse.jface.viewers.StyledString;
import com.google.inject.Inject;
/**
* Provides labels for a EObjects.
*
* see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
*/
public class ETPhysLabelProvider extends BaseLabelProvider {
@Inject
public ETPhysLabelProvider(AdapterFactoryLabelProvider delegate) {
super(delegate);
}
String image(PhysicalModel mdl) {
return "etphys_PhysicalModel.png";
}
@Override
public String image(Import mdl) {
return "etphys_Import.png";
}
String image(NodeClass mdl) {
return "etphys_NodeClass.png";
}
String image(NodeRef mdl) {
return "etphys_NodeRef.png";
}
String image(PhysicalSystem mdl) {
return "etphys_PhysicalSystem.png";
}
String image(PhysicalThread mdl) {
return "etphys_PhysicalThread.png";
}
String image(RuntimeClass mdl) {
return "etphys_RuntimeClass.png";
}
String text(PhysicalModel mdl) {
return "PhysicalModel "+mdl.getName();
}
String text(NodeClass mdl) {
return "NodeClass "+mdl.getName();
}
String text(PhysicalSystem mdl) {
return "PhysicalSystem "+mdl.getName();
}
String text(PhysicalThread mdl) {
return "PhysicalThread "+mdl.getName();
}
String text(RuntimeClass rc) {
return rc.getName()+"("+rc.getThreadModel().getLiteral()+")";
}
StyledString text(NodeRef ref) {
String cls = ref.getType()!=null? (" : "+ref.getType().getName()):"";
StyledString txt = new StyledString("NodeRef "+ref.getName()+cls);
if (!cls.isEmpty())
txt.setStyle(txt.length()-cls.length()+2, cls.length()-2, getTypeStyler());
return txt;
}
}
|