Mam debugger oparty na CDT i chcę dodać trochę informacji do napisu w węźle wątku. Chcę, aby napis otoczony czerwonym prostokątem wyświetlał dodatkowe informacje (patrz zrzut ekranu poniżej).Jak zmienić tekst na ekranie grupy wątków w debugerze Eclipse opartym na CDT?
AFAIR, ciąg formatu dla tej etykiety jest ustawiony w nieruchomości ThreadVMNode_No_columns__text_format
w pliku C:\Users\...\workspace\org.eclipse.cdt.dsf.gdb.ui\src\org\eclipse\cdt\dsf\gdb\internal\ui\viewmodel\launch\MessagesForGdbLaunchVM.properties
.
# {0} - name available, 0=not available/1=available
# {1} - name
# {2} - ID available, 0=not available/1=available
# {3} - ID
# {4} - OS Thread ID available, 0=not available/1=available
# {5} - OS Thread ID
# {6} - Core available, 0=not available/1=available
# {7} - Core
# {8} - 0=running/1=suspended
# {9} - state change reason available, 0=not available/1=available
# {10} - state change reason
# {11} - state change details available, 0=not available/1=available
# {12} - state change details
ThreadVMNode_No_columns__text_format={0,choice,0#Thread|1#{1}}{2,choice,0#|1# [{3}]}{4,choice,0#|1# {5}}{6,choice,0#|1# [core: {7}]} ({8,choice,0#Running|1#Suspended}{9,choice,0#|1# : {10}}{11,choice,0#|1# : {12}})
Ciąg ten format jest stosowany w metodzie org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.ThreadVMNode.createLabelProvider()
:
public class ThreadVMNode extends AbstractThreadVMNode
implements IElementLabelProvider, IElementMementoProvider
{
[...]
@Override
protected IElementLabelProvider createLabelProvider() {
PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider();
provider.setColumnInfo(
PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS,
new LabelColumnInfo(new LabelAttribute[] {
// Text is made of the thread name followed by its state and state change reason.
new GdbExecutionContextLabelText(
MessagesForGdbLaunchVM.ThreadVMNode_No_columns__text_format,
new String[] {
ExecutionContextLabelText.PROP_NAME_KNOWN,
PROP_NAME,
ExecutionContextLabelText.PROP_ID_KNOWN,
ILaunchVMConstants.PROP_ID,
IGdbLaunchVMConstants.PROP_OS_ID_KNOWN,
IGdbLaunchVMConstants.PROP_OS_ID,
IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN,
IGdbLaunchVMConstants.PROP_CORES_ID,
ILaunchVMConstants.PROP_IS_SUSPENDED,
ExecutionContextLabelText.PROP_STATE_CHANGE_REASON_KNOWN,
ILaunchVMConstants.PROP_STATE_CHANGE_REASON,
ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN,
ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS}),
AFAIK, aby dodać nową informację do wyświetlacza konieczne jest
- ręcznym ciągu formatu
MessagesForGdbLaunchVM.properties
i - dodać nowy ciąg do tablicy ciągów w wywołaniu do konstruktora
GdbExecutionContextLabelText
.
Jaki jest najlepszy sposób na wykonanie obu tych czynności (najlepiej niezmienianie kodu klas podstawowych Eclipse/CDT)?
Update 1 (12.09.2014 19:56 MSK): próbował użyć modelu prezentacji niestandardowych debugowania dodając rozszerzenie, ale klasa MyCompanyDebugModelPresentation
nie nazywa anyhwere.
<extension
point="org.eclipse.debug.ui.debugModelPresentations">
<debugModelPresentation
class="com.mycompany.internal.debug.ui.model.MyCompanyDebugModelPresentation"
id="com.mycompany.internal.debug.ui.model.MyCompanyDebugModelPresentation">
</debugModelPresentation>
</extension>
Witam, znalazłeś rozwiązanie? Wystąpił ten sam problem, w którym mój niestandardowy model prezentacji debugowania nie jest wywoływany. Dzięki. – Witriol
@ Witriol Tak, rozwiązałem to. Spójrz na moją odpowiedź poniżej. –