@Override
protected void okPressed() {
// Set channel information
- fChannelInfo = new ChannelInfo(fChannelNameText.getText());
- fChannelInfo.setSubBufferSize(fSubBufferSizeText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Long.parseLong(fSubBufferSizeText.getText()));
- fChannelInfo.setNumberOfSubBuffers(fNumberOfSubBuffersText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Integer.parseInt(fNumberOfSubBuffersText.getText()));
- fChannelInfo.setSwitchTimer(fSwitchTimerText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Long.parseLong(fSwitchTimerText.getText()));
- fChannelInfo.setReadTimer(fReadTimerText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Long.parseLong(fReadTimerText.getText()));
- fChannelInfo.setOverwriteMode(fOverwriteModeButton.getSelection());
+ ChannelInfo channelInfo = new ChannelInfo(fChannelNameText.getText());
+ channelInfo.setSubBufferSize(fSubBufferSizeText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Long.parseLong(fSubBufferSizeText.getText()));
+ channelInfo.setNumberOfSubBuffers(fNumberOfSubBuffersText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Integer.parseInt(fNumberOfSubBuffersText.getText()));
+ channelInfo.setSwitchTimer(fSwitchTimerText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Long.parseLong(fSwitchTimerText.getText()));
+ channelInfo.setReadTimer(fReadTimerText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Long.parseLong(fReadTimerText.getText()));
+ channelInfo.setOverwriteMode(fOverwriteModeButton.getSelection());
if (fTargetNodeComponent.isTraceFileRotationSupported()) {
- fChannelInfo.setMaxSizeTraceFiles(fMaxSizeTraceText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Integer.parseInt(fMaxSizeTraceText.getText()));
- fChannelInfo.setMaxNumberTraceFiles(fMaxNumberTraceText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Integer.parseInt(fMaxNumberTraceText.getText()));
+ channelInfo.setMaxSizeTraceFiles(fMaxSizeTraceText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Integer.parseInt(fMaxSizeTraceText.getText()));
+ channelInfo.setMaxNumberTraceFiles(fMaxNumberTraceText.getText().equals(DEFAULT_TEXT) ? LTTngControlServiceConstants.UNUSED_VALUE : Integer.parseInt(fMaxNumberTraceText.getText()));
}
if (fTargetNodeComponent.isBufferTypeConfigSupported()) {
if (fSharedBuffersButton.getSelection()) {
- fChannelInfo.setBufferType(BufferType.BUFFER_SHARED);
+ channelInfo.setBufferType(BufferType.BUFFER_SHARED);
} else if (fPIDBuffersButton.getSelection()) {
- fChannelInfo.setBufferType(BufferType.BUFFER_PER_PID);
+ channelInfo.setBufferType(BufferType.BUFFER_PER_PID);
} else if (fUIDBuffersButton.getSelection()) {
- fChannelInfo.setBufferType(BufferType.BUFFER_PER_UID);
+ channelInfo.setBufferType(BufferType.BUFFER_PER_UID);
} else {
- fChannelInfo.setBufferType(BufferType.BUFFER_TYPE_UNKNOWN);
+ channelInfo.setBufferType(BufferType.BUFFER_TYPE_UNKNOWN);
}
}
fIsKernel = fKernelButton.getSelection();
// Check for invalid names
- if (!fChannelInfo.getName().matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$
+ if (!channelInfo.getName().matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$
MessageDialog.openError(getShell(),
Messages.TraceControl_EnableChannelDialogTitle,
- Messages.TraceControl_InvalidChannelNameError + " (" + fChannelInfo.getName() + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.TraceControl_InvalidChannelNameError + " (" + channelInfo.getName() + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
// Check for duplicate names
- if (fDomain != null && fDomain.containsChild(fChannelInfo.getName())) {
+ if (fDomain != null && fDomain.containsChild(channelInfo.getName())) {
MessageDialog.openError(getShell(),
Messages.TraceControl_EnableChannelDialogTitle,
- Messages.TraceControl_ChannelAlreadyExistsError + " (" + fChannelInfo.getName() + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
+ Messages.TraceControl_ChannelAlreadyExistsError + " (" + channelInfo.getName() + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
+ fChannelInfo = channelInfo;
+
// validation successful -> call super.okPressed()
super.okPressed();
}
if (fIsDynamicProbe) {
String temp = fProbeEventNameText.getText();
- if (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (temp.isEmpty() ||
+ fProbeText.getText().matches("\\s*") || //$NON-NLS-1$
+ (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openError(getShell(),
Messages.TraceControl_EnableEventsDialogTitle,
Messages.TraceControl_InvalidProbeNameError + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
- if(!fProbeText.getText().matches("\\s*")) { //$NON-NLS-1$
- fProbeEventName = temp;
- // fProbeString will be validated by lttng-tools
- fProbeString = fProbeText.getText();
- }
+ fProbeEventName = temp;
+ // fProbeString will be validated by lttng-tools
+ fProbeString = fProbeText.getText();
}
// initialize function string
fFunctionString = null;
if (fIsDynamicFunctionProbe) {
String functionTemp = fFunctionEventNameText.getText();
- if (!functionTemp.matches("^[\\s]{0,}$") && !functionTemp.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (functionTemp.isEmpty() ||
+ functionTemp.matches("\\s*") || //$NON-NLS-1$
+ (!functionTemp.matches("^[\\s]{0,}$") && !functionTemp.matches("^[a-zA-Z0-9\\-\\_]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openError(getShell(),
Messages.TraceControl_EnableEventsDialogTitle,
Messages.TraceControl_InvalidProbeNameError + " (" + functionTemp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
- if(!fFunctionText.getText().matches("\\s*")) { //$NON-NLS-1$
- fFunctionEventName = functionTemp;
- // fFunctionString will be validated by lttng-tools
- fFunctionString = fFunctionText.getText();
- }
+ fFunctionEventName = functionTemp;
+ // fFunctionString will be validated by lttng-tools
+ fFunctionString = fFunctionText.getText();
}
return true;
}
String temp = fLogLevelEventNameText.getText();
- if (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (temp.isEmpty() ||
+ temp.matches("\\s*") || //$NON-NLS-1$
+ (!temp.matches("^[\\s]{0,}$") && !temp.matches("^[a-zA-Z0-9\\-\\_]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openError(getShell(),
Messages.TraceControl_EnableEventsDialogTitle,
Messages.TraceControl_InvalidLogLevelEventNameError + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
- if(!temp.matches("\\s*")) { //$NON-NLS-1$
- fLogLevelEventName = temp;
- }
+ fLogLevelEventName = temp;
TraceLogLevel[] levels = TraceLogLevel.values();
int id = fLogLevelCombo.getSelectionIndex();
fWildcard = null;
if (fIsWildcard) {
String tempWildcard = fWildcardText.getText();
- if (!tempWildcard.matches("^[\\s]{0,}$") && !tempWildcard.matches("^[a-zA-Z0-9\\-\\_\\*]{1,}$")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (tempWildcard.isEmpty() ||
+ tempWildcard.matches("\\s*") || //$NON-NLS-1$
+ (!tempWildcard.matches("^[\\s]{0,}$") && !tempWildcard.matches("^[a-zA-Z0-9\\-\\_\\*]{1,}$"))) { //$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openError(getShell(),
Messages.TraceControl_EnableEventsDialogTitle,
Messages.TraceControl_InvalidWildcardError + " (" + tempWildcard + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
- if(!tempWildcard.matches("\\s*")) { //$NON-NLS-1$
- fWildcard = tempWildcard;
- }
+ fWildcard = tempWildcard;
}
// initialize filter with null
if (fProviderGroup.isEventFilteringSupported()) {
String tempFilter = fFilterText.getText();
- if(!tempFilter.matches("\\s*")) { //$NON-NLS-1$
+ if(!tempFilter.isEmpty() && !tempFilter.matches("\\s*")) { //$NON-NLS-1$
fFilterExpression = tempFilter;
}
}
if (fSessions[0].isEventFilteringSupported() && !fIsKernel) {
String tempFilter = fFilterText.getText();
- if(!tempFilter.matches("\\s*")) { //$NON-NLS-1$
+ if(!tempFilter.isEmpty() && !tempFilter.matches("\\s*")) { //$NON-NLS-1$
fFilterExpression = tempFilter;
}
}
TraceControl_EnableEventsFilterGroupName=Filter Expression
TraceControl_EnableEventsFilterTooltip=Filter expression on event field.
-TraceControl_InvalidProbeNameError=The probe name is invalid
-TraceControl_InvalidWildcardError=The wild card name is invalid
-TraceControl_InvalidLogLevelEventNameError=The event name for log level is invalid
+TraceControl_InvalidProbeNameError=The probe name is invalid or empty
+TraceControl_InvalidWildcardError=The wild card name is invalid or empty
+TraceControl_InvalidLogLevelEventNameError=The event name for log level is invalid or empty
TraceControl_InvalidLogLevel=No log level selected
TraceControl_AddContextDialogTitle=Add Contexts