lttng: Fix Resources view event list
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.ui / src / org / eclipse / linuxtools / internal / lttng2 / ui / views / control / dialogs / EnableChannelDialog.java
CommitLineData
bbb3538a 1/**********************************************************************
11252342 2 * Copyright (c) 2012, 2013 Ericsson
a07c7629 3 *
bbb3538a
BH
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
a07c7629
BH
8 *
9 * Contributors:
bbb3538a 10 * Bernd Hufmann - Initial API and implementation
e799e5f3 11 * Simon Delisle - Updated for support of LTTng Tools 2.2
bbb3538a 12 **********************************************************************/
115b4a01 13package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
bbb3538a
BH
14
15import org.eclipse.jface.dialogs.Dialog;
16import org.eclipse.jface.dialogs.IDialogConstants;
17import org.eclipse.jface.dialogs.MessageDialog;
9315aeee
BH
18import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo;
19import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ChannelInfo;
115b4a01 20import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
9315aeee 21import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
e799e5f3 22import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent;
115b4a01 23import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
e799e5f3 24import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngControlServiceConstants;
bbb3538a 25import org.eclipse.swt.SWT;
e799e5f3
SD
26import org.eclipse.swt.events.FocusEvent;
27import org.eclipse.swt.events.FocusListener;
28import org.eclipse.swt.events.SelectionAdapter;
29import org.eclipse.swt.events.SelectionEvent;
bbb3538a
BH
30import org.eclipse.swt.events.VerifyEvent;
31import org.eclipse.swt.events.VerifyListener;
bbb3538a
BH
32import org.eclipse.swt.layout.GridData;
33import org.eclipse.swt.layout.GridLayout;
34import org.eclipse.swt.widgets.Button;
35import org.eclipse.swt.widgets.Composite;
36import org.eclipse.swt.widgets.Control;
37import org.eclipse.swt.widgets.Group;
38import org.eclipse.swt.widgets.Label;
39import org.eclipse.swt.widgets.Shell;
40import org.eclipse.swt.widgets.Text;
41
42/**
bbb3538a 43 * <p>
d62bfa55 44 * Dialog box for collecting channel information when enabling a channel (which will be created).
bbb3538a 45 * </p>
a07c7629 46 *
dbd4432d 47 * @author Bernd Hufmann
bbb3538a 48 */
d62bfa55 49public class EnableChannelDialog extends Dialog implements IEnableChannelDialog {
bbb3538a
BH
50
51 // ------------------------------------------------------------------------
52 // Constants
53 // ------------------------------------------------------------------------
54 /**
55 * The icon file for this dialog box.
56 */
a07c7629 57 public static final String ENABLE_CHANNEL_ICON_FILE = "icons/elcl16/add_button.gif"; //$NON-NLS-1$
bbb3538a 58
e799e5f3
SD
59 /**
60 * To indicate that the default value will be used for this field
61 */
62 private static final String DEFAULT_TEXT = "<" + Messages.EnableChannelDialog_DefaultMessage + ">"; //$NON-NLS-1$ //$NON-NLS-2$
63
bbb3538a
BH
64 // ------------------------------------------------------------------------
65 // Attributes
66 // ------------------------------------------------------------------------
bbb3538a
BH
67 /**
68 * The text widget for the channel name
69 */
70 private Text fChannelNameText = null;
0886cf00
BH
71 /**
72 * The discard mode of the channel.
73 */
74 private Button fDiscardModeButton = null;
bbb3538a
BH
75 /**
76 * The overwrite mode of the channel.
77 */
c56972bb 78 private Button fOverwriteModeButton = null;
bbb3538a
BH
79 /**
80 * The sub-buffer size of the channel.
81 */
c56972bb 82 private Text fSubBufferSizeText = null;
bbb3538a
BH
83 /**
84 * The number of sub-buffers of the channel.
85 */
c56972bb 86 private Text fNumberOfSubBuffersText = null;
bbb3538a
BH
87 /**
88 * The switch timer interval of the channel.
89 */
c56972bb 90 private Text fSwitchTimerText = null;
bbb3538a
BH
91 /**
92 * The read timer interval of the channel.
93 */
c56972bb 94 private Text fReadTimerText = null;
bbb3538a
BH
95 /**
96 * Radio button for selecting kernel domain.
97 */
c56972bb 98 private Button fKernelButton = null;
bbb3538a
BH
99 /**
100 * Radio button for selecting UST domain.
101 */
c56972bb 102 private Button fUstButton = null;
bbb3538a 103 /**
a07c7629 104 * The parent domain component where the channel node should be added.
bbb3538a
BH
105 * Null in case of creation on session level.
106 */
c56972bb 107 private TraceDomainComponent fDomain = null;
e799e5f3
SD
108 /**
109 * The target node component
110 */
111 private TargetNodeComponent fTargetNodeComponent = null;
bbb3538a 112 /**
a07c7629 113 * Common verify listener for numeric text input.
bbb3538a 114 */
c56972bb 115 private VerifyListener fVerifyListener = null;
e799e5f3
SD
116 /**
117 * Common focus listener
118 */
119 private FocusListener fFocusListener = null;
bbb3538a
BH
120 /**
121 * Output channel information.
122 */
c56972bb 123 private IChannelInfo fChannelInfo = null;
bbb3538a 124 /**
a07c7629 125 * Output domain information. True in case of Kernel domain. False for UST.
bbb3538a
BH
126 */
127 private boolean fIsKernel;
a07c7629
BH
128 /**
129 * Flag which indicates whether Kernel domain is available or not
130 */
131 private boolean fHasKernel;
e799e5f3
SD
132 /**
133 * Maximum size of trace files of the channel.
134 */
135 private Text fMaxSizeTraceText = null;
136 /**
137 * Maximum number of trace files of the channel.
138 */
139 private Text fMaxNumberTraceText = null;
140 /**
141 * CheckBox for selecting per UID buffers.
142 */
143 private Button fUIDBuffersButton = null;
144 /**
145 * CheckBox to configure metadata channel
146 */
147 private Button fMetadataChannelButton = null;
148 /**
149 * Previous channel name
150 */
151 private String fPreviousChannelName = null;
152
bbb3538a
BH
153
154 // ------------------------------------------------------------------------
155 // Constructors
156 // ------------------------------------------------------------------------
157
158 /**
159 * Constructor
160 * @param shell - a shell for the display of the dialog
161 */
d62bfa55 162 public EnableChannelDialog(Shell shell) {
d132bcc7
BH
163 super(shell);
164 fIsKernel = true;
bbb3538a
BH
165
166 // Common verify listener
167 fVerifyListener = new VerifyListener() {
168 @Override
169 public void verifyText(VerifyEvent e) {
e799e5f3
SD
170 // only numbers and default are allowed.
171 e.doit = e.text.matches("[0-9]*") || e.text.matches(DEFAULT_TEXT); //$NON-NLS-1$
bbb3538a
BH
172 }
173 };
e799e5f3
SD
174
175 // Common focus listener
176 fFocusListener = new FocusListener() {
177
178 @Override
179 public void focusLost(FocusEvent e) {
180 Text focusLostWidget = (Text) e.widget;
181 if (focusLostWidget.getText().isEmpty()) {
182 focusLostWidget.setText(DEFAULT_TEXT);
183 focusLostWidget.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
184 }
185 }
186
187 @Override
188 public void focusGained(FocusEvent e) {
189 Text focusGainedWidget = (Text) e.widget;
190 if (focusGainedWidget.getText().equals(DEFAULT_TEXT)) {
191 focusGainedWidget.setText(""); //$NON-NLS-1$
192 focusGainedWidget.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_BLACK));
193 }
194 }
195 };
196
d62bfa55 197 setShellStyle(SWT.RESIZE);
bbb3538a
BH
198 }
199
200 // ------------------------------------------------------------------------
201 // Accessors
202 // ------------------------------------------------------------------------
11252342 203
bbb3538a
BH
204 @Override
205 public IChannelInfo getChannelInfo() {
206 return fChannelInfo;
207 }
208
d132bcc7
BH
209 @Override
210 public void setDomainComponent(TraceDomainComponent domain) {
211 fDomain = domain;
212 if (fDomain != null) {
213 fIsKernel = fDomain.isKernel();
214 } else {
215 fIsKernel = true;
216 }
217 }
218
bbb3538a
BH
219 @Override
220 public boolean isKernel() {
221 return fIsKernel;
222 }
223
a07c7629
BH
224 @Override
225 public void setHasKernel(boolean hasKernel) {
226 if (fDomain != null) {
227 fIsKernel = fDomain.isKernel();
228 } else {
229 fIsKernel = hasKernel;
230 }
231
232 fHasKernel = hasKernel;
233 }
234
e799e5f3
SD
235 @Override
236 public void setTargetNodeComponent(TargetNodeComponent node) {
237 fTargetNodeComponent = node;
238 }
239
bbb3538a
BH
240 // ------------------------------------------------------------------------
241 // Operations
242 // ------------------------------------------------------------------------
11252342 243
bbb3538a
BH
244 @Override
245 protected void configureShell(Shell newShell) {
246 super.configureShell(newShell);
247 newShell.setText(Messages.TraceControl_EnableChannelDialogTitle);
31a6a4e4 248 newShell.setImage(Activator.getDefault().loadIcon(ENABLE_CHANNEL_ICON_FILE));
bbb3538a
BH
249 }
250
bbb3538a
BH
251 @Override
252 protected Control createDialogArea(Composite parent) {
a07c7629 253
bbb3538a 254 // Main dialog panel
046b6849 255 Composite dialogComposite = new Composite(parent, SWT.NONE);
d62bfa55 256 GridLayout layout = new GridLayout(3, true);
046b6849 257 dialogComposite.setLayout(layout);
bbb3538a 258
046b6849 259 Label channelNameLabel = new Label(dialogComposite, SWT.RIGHT);
bbb3538a 260 channelNameLabel.setText(Messages.TraceControl_EnableChannelNameLabel);
046b6849 261 fChannelNameText = new Text(dialogComposite, SWT.NONE);
498704b3 262 fChannelNameText.setToolTipText(Messages.TraceControl_EnableChannelNameTooltip);
a07c7629 263
046b6849 264 Label subBufferSizeLabel = new Label(dialogComposite, SWT.RIGHT);
bbb3538a 265 subBufferSizeLabel.setText(Messages.TraceControl_SubBufferSizePropertyName);
046b6849 266 fSubBufferSizeText = new Text(dialogComposite, SWT.NONE);
bbb3538a
BH
267 fSubBufferSizeText.setToolTipText(Messages.TraceControl_EnableChannelSubBufferSizeTooltip);
268 fSubBufferSizeText.addVerifyListener(fVerifyListener);
e799e5f3
SD
269 fSubBufferSizeText.addFocusListener(fFocusListener);
270 fSubBufferSizeText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
a07c7629 271
046b6849 272 Label numSubBufferLabel = new Label(dialogComposite, SWT.RIGHT);
bbb3538a 273 numSubBufferLabel.setText(Messages.TraceControl_NbSubBuffersPropertyName);
046b6849 274 fNumberOfSubBuffersText = new Text(dialogComposite, SWT.NONE);
bbb3538a
BH
275 fNumberOfSubBuffersText.setToolTipText(Messages.TraceControl_EnableChannelNbSubBuffersTooltip);
276 fNumberOfSubBuffersText.addVerifyListener(fVerifyListener);
e799e5f3 277 fNumberOfSubBuffersText.addFocusListener(fFocusListener);
bbb3538a 278
046b6849 279 Label switchTimerLabel = new Label(dialogComposite, SWT.RIGHT);
bbb3538a 280 switchTimerLabel.setText(Messages.TraceControl_SwitchTimerPropertyName);
046b6849 281 fSwitchTimerText = new Text(dialogComposite, SWT.NONE);
bbb3538a
BH
282 fSwitchTimerText.setToolTipText(Messages.TraceControl_EnableChannelSwitchTimerTooltip);
283 fSwitchTimerText.addVerifyListener(fVerifyListener);
e799e5f3 284 fSwitchTimerText.addFocusListener(fFocusListener);
bbb3538a 285
046b6849 286 Label readTimerLabel = new Label(dialogComposite, SWT.RIGHT);
bbb3538a 287 readTimerLabel.setText(Messages.TraceControl_ReadTimerPropertyName);
046b6849 288 fReadTimerText = new Text(dialogComposite, SWT.NONE);
bbb3538a
BH
289 fReadTimerText.setToolTipText(Messages.TraceControl_EnableChannelReadTimerTooltip);
290 fReadTimerText.addVerifyListener(fVerifyListener);
e799e5f3
SD
291 fReadTimerText.addFocusListener(fFocusListener);
292
293 if (fTargetNodeComponent.isTraceFileRotationSupported()) {
294 Label maxSizeTraceFilesLabel = new Label(dialogComposite, SWT.RIGHT);
295 maxSizeTraceFilesLabel.setText(Messages.TraceControl_MaxSizeTraceFilesPropertyName);
296 fMaxSizeTraceText = new Text(dialogComposite, SWT.NONE);
297 fMaxSizeTraceText.setToolTipText(Messages.TraceControl_EnbleChannelMaxSizeTraceFilesTooltip);
298 fMaxSizeTraceText.addVerifyListener(fVerifyListener);
299 fMaxSizeTraceText.addFocusListener(fFocusListener);
300
301 Label maxNumTraceFilesLabel = new Label(dialogComposite, SWT.RIGHT);
302 maxNumTraceFilesLabel.setText(Messages.TraceControl_MaxNumTraceFilesPropertyName);
303 fMaxNumberTraceText = new Text(dialogComposite, SWT.NONE);
304 fMaxNumberTraceText.setToolTipText(Messages.TraceControl_EnbleChannelMaxNumTraceFilesTooltip);
305 fMaxNumberTraceText.addVerifyListener(fVerifyListener);
306 fMaxNumberTraceText.addFocusListener(fFocusListener);
307 }
308
309 if (fTargetNodeComponent.isPeriodicalMetadataFlushSupported()) {
310 fMetadataChannelButton = new Button(dialogComposite, SWT.CHECK);
311 fMetadataChannelButton.setText(Messages.TraceControl_ConfigureMetadataChannelName);
312 fMetadataChannelButton.setSelection(false);
313
314 fMetadataChannelButton.addSelectionListener(new SelectionAdapter() {
315 @Override
316 public void widgetSelected(SelectionEvent e) {
317 if (fMetadataChannelButton.getSelection()) {
318 fPreviousChannelName = fChannelNameText.getText();
319 fChannelNameText.setText("metadata"); //$NON-NLS-1$
320 fChannelNameText.setEnabled(false);
321 } else {
322 fChannelNameText.setText(fPreviousChannelName);
323 fChannelNameText.setEnabled(true);
324 }
325 }
326 });
327 }
bbb3538a 328
046b6849 329 Group discardModeGroup = new Group(dialogComposite, SWT.SHADOW_NONE);
0886cf00
BH
330 discardModeGroup.setText(Messages.TraceControl_EnableChannelDiscardModeGroupName);
331 layout = new GridLayout(2, true);
a07c7629 332 discardModeGroup.setLayout(layout);
0886cf00
BH
333
334 fDiscardModeButton = new Button(discardModeGroup, SWT.RADIO);
335 fDiscardModeButton.setText(Messages.TraceControl_EnableChannelDiscardModeLabel);
336 fDiscardModeButton.setToolTipText(Messages.TraceControl_EnableChannelDiscardModeTooltip);
337 fDiscardModeButton.setSelection(true);
a07c7629 338
0886cf00
BH
339 fOverwriteModeButton = new Button(discardModeGroup, SWT.RADIO);
340 fOverwriteModeButton.setText(Messages.TraceControl_EnableChannelOverwriteModeLabel);
bbb3538a 341 fOverwriteModeButton.setToolTipText(Messages.TraceControl_EnableChannelOverwriteModeTooltip);
0886cf00 342 fOverwriteModeButton.setSelection(false);
bbb3538a 343
046b6849
BH
344 Group domainGroup = new Group(dialogComposite, SWT.SHADOW_NONE);
345 domainGroup.setText(Messages.TraceControl_DomainDisplayName);
bbb3538a 346 layout = new GridLayout(2, true);
046b6849 347 domainGroup.setLayout(layout);
a07c7629 348
046b6849 349 fKernelButton = new Button(domainGroup, SWT.RADIO);
bbb3538a
BH
350 fKernelButton.setText(Messages.TraceControl_KernelDomainDisplayName);
351 fKernelButton.setSelection(fIsKernel);
046b6849 352 fUstButton = new Button(domainGroup, SWT.RADIO);
bbb3538a
BH
353 fUstButton.setText(Messages.TraceControl_UstDisplayName);
354 fUstButton.setSelection(!fIsKernel);
355
e799e5f3
SD
356 if (fTargetNodeComponent.isPerUIDBuffersSupported()) {
357 Button fDummyButton = new Button(domainGroup, SWT.CHECK);
358 fDummyButton.setEnabled(false);
359 fDummyButton.setVisible(false);
360 fUIDBuffersButton = new Button(domainGroup, SWT.CHECK);
361 fUIDBuffersButton.setText(Messages.TraceControl_PerUidBuffersDisplayName);
362 fUIDBuffersButton.setSelection(false);
363 fUIDBuffersButton.setEnabled(!fIsKernel);
364
365 fUstButton.addSelectionListener(new SelectionAdapter() {
366 @Override
367 public void widgetSelected(SelectionEvent e) {
368 if (fUstButton.getSelection()) {
369 fUIDBuffersButton.setEnabled(true);
370 } else {
371 fUIDBuffersButton.setEnabled(false);
372 }
373 }
374 });
375 }
376
a07c7629 377 if ((fDomain != null) || (!fHasKernel)) {
bbb3538a
BH
378 fKernelButton.setEnabled(false);
379 fUstButton.setEnabled(false);
380 }
381
382 // layout widgets
d62bfa55 383 GridData data = new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1);
0886cf00
BH
384 discardModeGroup.setLayoutData(data);
385 data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
386 fDiscardModeButton.setLayoutData(data);
387 data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
388 fOverwriteModeButton.setLayoutData(data);
a07c7629 389
d62bfa55 390 data = new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1);
046b6849 391 domainGroup.setLayoutData(data);
bbb3538a
BH
392
393 data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
394 fKernelButton.setLayoutData(data);
395 data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
396 fUstButton.setLayoutData(data);
e799e5f3
SD
397 if (fTargetNodeComponent.isPerUIDBuffersSupported()) {
398 data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
399 fUIDBuffersButton.setLayoutData(data);
400 }
401 if (fTargetNodeComponent.isPeriodicalMetadataFlushSupported()) {
402 data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
403 fMetadataChannelButton.setLayoutData(data);
404 }
a07c7629 405
d62bfa55
BH
406 data = new GridData(GridData.FILL_HORIZONTAL);
407 data.horizontalSpan = 2;
bbb3538a
BH
408
409 fChannelNameText.setLayoutData(data);
410 fSubBufferSizeText.setLayoutData(data);
411 fNumberOfSubBuffersText.setLayoutData(data);
412 fSwitchTimerText.setLayoutData(data);
413 fReadTimerText.setLayoutData(data);
e799e5f3
SD
414 if (fTargetNodeComponent.isTraceFileRotationSupported()) {
415 fMaxNumberTraceText.setLayoutData(data);
416 fMaxSizeTraceText.setLayoutData(data);
417 }
bbb3538a 418
bbb3538a
BH
419 setDefaults();
420
046b6849 421 return dialogComposite;
bbb3538a
BH
422 }
423
bbb3538a
BH
424 @Override
425 protected void createButtonsForButtonBar(Composite parent) {
79c3db85
BH
426 createButton(parent, IDialogConstants.DETAILS_ID, "&Default", true); //$NON-NLS-1$
427 createButton(parent, IDialogConstants.CANCEL_ID, "&Cancel", true); //$NON-NLS-1$
bbb3538a
BH
428 createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$
429 }
430
bbb3538a
BH
431 @Override
432 protected void okPressed() {
433 // Set channel information
434 fChannelInfo = new ChannelInfo(fChannelNameText.getText());
e799e5f3
SD
435 fChannelInfo.setSubBufferSize(fSubBufferSizeText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Long.parseLong(fSubBufferSizeText.getText()));
436 fChannelInfo.setNumberOfSubBuffers(fNumberOfSubBuffersText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Integer.parseInt(fNumberOfSubBuffersText.getText()));
437 fChannelInfo.setSwitchTimer(fSwitchTimerText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Long.parseLong(fSwitchTimerText.getText()));
438 fChannelInfo.setReadTimer(fReadTimerText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Long.parseLong(fReadTimerText.getText()));
bbb3538a 439 fChannelInfo.setOverwriteMode(fOverwriteModeButton.getSelection());
e799e5f3
SD
440 if (fTargetNodeComponent.isTraceFileRotationSupported()) {
441 fChannelInfo.setMaxSizeTraceFiles(fMaxSizeTraceText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Integer.parseInt(fMaxSizeTraceText.getText()));
442 fChannelInfo.setMaxNumberTraceFiles(fMaxNumberTraceText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Integer.parseInt(fMaxNumberTraceText.getText()));
443 }
444 if (fTargetNodeComponent.isPerUIDBuffersSupported()) {
445 fChannelInfo.setBuffersUID(fUIDBuffersButton.getSelection());
446 }
bbb3538a 447
c56972bb 448 fIsKernel = fKernelButton.getSelection();
bbb3538a
BH
449
450 // Check for invalid names
498704b3 451 if (!fChannelInfo.getName().matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$
bbb3538a
BH
452 MessageDialog.openError(getShell(),
453 Messages.TraceControl_EnableChannelDialogTitle,
454 Messages.TraceControl_InvalidChannelNameError + " (" + fChannelInfo.getName() + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
455 return;
456 }
457
458 // Check for duplicate names
459 if (fDomain != null && fDomain.containsChild(fChannelInfo.getName())) {
460 MessageDialog.openError(getShell(),
461 Messages.TraceControl_EnableChannelDialogTitle,
462 Messages.TraceControl_ChannelAlreadyExistsError + " (" + fChannelInfo.getName() + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
463 return;
464 }
465
466 // validation successful -> call super.okPressed()
467 super.okPressed();
468 }
a07c7629 469
bbb3538a
BH
470 @Override
471 protected void buttonPressed(int buttonId) {
472 if (buttonId == IDialogConstants.DETAILS_ID) {
473 setDefaults();
474 return;
475 }
476 super.buttonPressed(buttonId);
477 }
478
479 // ------------------------------------------------------------------------
480 // Helper methods
481 // ------------------------------------------------------------------------
11252342 482
bbb3538a
BH
483 /**
484 * Sets default value depending on Kernel or UST
485 */
486 private void setDefaults() {
e799e5f3
SD
487 fSwitchTimerText.setText(DEFAULT_TEXT);
488 fSwitchTimerText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
489 fReadTimerText.setText(DEFAULT_TEXT);
490 fReadTimerText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
bbb3538a 491 fOverwriteModeButton.setSelection(IChannelInfo.DEFAULT_OVERWRITE_MODE);
e799e5f3
SD
492 if (fTargetNodeComponent.isTraceFileRotationSupported()) {
493 fMaxSizeTraceText.setText(DEFAULT_TEXT);
494 fMaxSizeTraceText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
495 fMaxNumberTraceText.setText(DEFAULT_TEXT);
496 fMaxNumberTraceText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
bbb3538a 497 }
e799e5f3
SD
498 fSubBufferSizeText.setText(DEFAULT_TEXT);
499 fSubBufferSizeText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
500 fNumberOfSubBuffersText.setText(DEFAULT_TEXT);
501 fNumberOfSubBuffersText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY));
bbb3538a
BH
502 }
503}
This page took 0.060483 seconds and 5 git commands to generate.