1
1
/*******************************************************************************
2
- * Copyright (c) 2000, 2020 IBM Corporation and others.
2
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
3
3
*
4
4
* This program and the accompanying materials
5
5
* are made available under the terms of the Eclipse Public License 2.0
18
18
19
19
import org .eclipse .debug .internal .ui .DebugUIPlugin ;
20
20
import org .eclipse .debug .internal .ui .IDebugHelpContextIds ;
21
+ import org .eclipse .debug .internal .ui .SWTFactory ;
21
22
import org .eclipse .jface .preference .BooleanFieldEditor ;
22
23
import org .eclipse .jface .preference .ColorFieldEditor ;
23
24
import org .eclipse .jface .preference .FieldEditor ;
30
31
import org .eclipse .swt .events .SelectionEvent ;
31
32
import org .eclipse .swt .layout .GridData ;
32
33
import org .eclipse .swt .widgets .Button ;
34
+ import org .eclipse .swt .widgets .Combo ;
33
35
import org .eclipse .swt .widgets .Composite ;
34
36
import org .eclipse .ui .IWorkbench ;
35
37
import org .eclipse .ui .IWorkbenchPreferencePage ;
@@ -87,6 +89,9 @@ protected void clearErrorMessage() {
87
89
private BooleanFieldEditor2 fInterpretControlCharactersEditor ;
88
90
private BooleanFieldEditor2 fInterpretCrAsControlCharacterEditor ;
89
91
92
+ private BooleanFieldEditor2 fshowElapsedTime ;
93
+ private Combo fElapsedFormat ;
94
+
90
95
/**
91
96
* Create the console page.
92
97
*/
@@ -107,6 +112,7 @@ public void createControl(Composite parent) {
107
112
/**
108
113
* Create all field editors for this page
109
114
*/
115
+ @ SuppressWarnings ("nls" )
110
116
@ Override
111
117
public void createFieldEditors () {
112
118
@@ -159,6 +165,27 @@ public void widgetSelected(SelectionEvent e) {
159
165
addField (new BooleanFieldEditor (IDebugPreferenceConstants .CONSOLE_OPEN_ON_OUT , DebugPreferencesMessages .ConsolePreferencePage_Show__Console_View_when_there_is_program_output_3 , SWT .NONE , getFieldEditorParent ()));
160
166
addField (new BooleanFieldEditor (IDebugPreferenceConstants .CONSOLE_OPEN_ON_ERR , DebugPreferencesMessages .ConsolePreferencePage_Show__Console_View_when_there_is_program_error_3 , SWT .NONE , getFieldEditorParent ()));
161
167
168
+ fshowElapsedTime = new BooleanFieldEditor2 (IDebugPreferenceConstants .CONSOLE_ELAPSED_TIME ,
169
+ DebugPreferencesMessages .ConsoleElapsedTime , SWT .NONE , getFieldEditorParent ());
170
+ SWTFactory .createLabel (getFieldEditorParent (), "Format " , 1 ); //$NON-NLS-1$
171
+ fElapsedFormat = new Combo (getFieldEditorParent (), SWT .BORDER |SWT .READ_ONLY );
172
+ fElapsedFormat
173
+ .setItems (new String [] { "H:MM:SS" , "HH:MM:SS" , "HH:MM:SS.mmm" , "MM:SS.mmm" ,
174
+ "HHh MMm SSs" });
175
+ int defaultFormat = DebugUIPlugin .getDefault ().getPreferenceStore ()
176
+ .getInt (IDebugPreferenceConstants .CONSOLE_ELAPSED_FORMAT );
177
+ fElapsedFormat .select (defaultFormat );
178
+
179
+ fshowElapsedTime .getChangeControl (getFieldEditorParent ()).addSelectionListener (new SelectionAdapter () {
180
+ @ Override
181
+ public void widgetSelected (SelectionEvent e ) {
182
+ updateElapsedTimePreferences ();
183
+ }
184
+ });
185
+ addField (fshowElapsedTime );
186
+
187
+
188
+
162
189
ColorFieldEditor sysout = new ColorFieldEditor (IDebugPreferenceConstants .CONSOLE_SYS_OUT_COLOR , DebugPreferencesMessages .ConsolePreferencePage_Standard_Out__2 , getFieldEditorParent ());
163
190
ColorFieldEditor syserr = new ColorFieldEditor (IDebugPreferenceConstants .CONSOLE_SYS_ERR_COLOR , DebugPreferencesMessages .ConsolePreferencePage_Standard_Error__3 , getFieldEditorParent ());
164
191
ColorFieldEditor sysin = new ColorFieldEditor (IDebugPreferenceConstants .CONSOLE_SYS_IN_COLOR , DebugPreferencesMessages .ConsolePreferencePage_Standard_In__4 , getFieldEditorParent ());
@@ -197,6 +224,8 @@ public boolean performOk() {
197
224
int low = store .getInt (IDebugPreferenceConstants .CONSOLE_LOW_WATER_MARK );
198
225
int high = low + 8000 ;
199
226
store .setValue (IDebugPreferenceConstants .CONSOLE_HIGH_WATER_MARK , high );
227
+ DebugUIPlugin .getDefault ().getPreferenceStore ().setValue (IDebugPreferenceConstants .CONSOLE_ELAPSED_FORMAT ,
228
+ fElapsedFormat .getSelectionIndex ());
200
229
return ok ;
201
230
}
202
231
@@ -211,6 +240,8 @@ protected void initialize() {
211
240
updateBufferSizeEditor ();
212
241
updateInterpretCrAsControlCharacterEditor ();
213
242
updateWordWrapEditorFromConsolePreferences ();
243
+ updateElapsedTimePreferences ();
244
+
214
245
}
215
246
216
247
/**
@@ -266,6 +297,7 @@ protected void performDefaults() {
266
297
updateWidthEditor ();
267
298
updateBufferSizeEditor ();
268
299
updateInterpretCrAsControlCharacterEditor ();
300
+ updateElapsedTimePreferences ();
269
301
}
270
302
271
303
protected boolean canClearErrorMessage () {
@@ -301,4 +333,12 @@ public void propertyChange(PropertyChangeEvent event) {
301
333
super .propertyChange (event );
302
334
}
303
335
}
336
+
337
+ protected void updateElapsedTimePreferences () {
338
+ Button b = fshowElapsedTime .getChangeControl (getFieldEditorParent ());
339
+ fElapsedFormat .setEnabled (b .getSelection ());
340
+ IPreferenceStore pref = DebugUIPlugin .getDefault ().getPreferenceStore ();
341
+ pref .setValue (IDebugPreferenceConstants .CONSOLE_ELAPSED_TIME , b .getSelection ());
342
+ pref .setValue (IDebugPreferenceConstants .CONSOLE_ELAPSED_FORMAT , fElapsedFormat .getSelectionIndex ());
343
+ }
304
344
}
0 commit comments