From 5f1f22f8d67a12bc0ea747dde9df126fdbf9422a Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Wed, 28 Mar 2012 15:51:55 -0400 Subject: [PATCH] Minor updates in LTTng 2.0 trace control --- .../lttng2/ui/views/control/ControlView.java | 3 + .../control/dialogs/CreateSessionDialog.java | 16 +-- .../dialogs/EnableKernelEventComposite.java | 81 ++++++------- .../dialogs/EnableUstEventsComposite.java | 106 ++++++++++-------- 4 files changed, 111 insertions(+), 95 deletions(-) diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/ControlView.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/ControlView.java index ccb1164f76..efe93a79bc 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/ControlView.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/ControlView.java @@ -24,6 +24,7 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent; import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponentChangedListener; import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlRoot; +import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Menu; @@ -102,6 +103,8 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang createContextMenu(); getSite().setSelectionProvider(fTreeViewer); + + RSECorePlugin.getTheSystemRegistry(); // to load RSE } /* diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java index c975e0518d..2b95f217d2 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/CreateSessionDialog.java @@ -90,6 +90,7 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog */ public CreateSessionDialog(Shell shell) { super(shell); + setShellStyle(SWT.RESIZE); } // ------------------------------------------------------------------------ @@ -154,8 +155,9 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog // Main dialog panel fDialogComposite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(2, true); - fDialogComposite.setLayout(layout); + GridLayout layout = new GridLayout(4, true); + fDialogComposite.setLayout(layout); + fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); Label sessionNameLabel = new Label(fDialogComposite, SWT.RIGHT); sessionNameLabel.setText(Messages.TraceControl_CreateSessionNameLabel); @@ -168,16 +170,14 @@ public class CreateSessionDialog extends Dialog implements ICreateSessionDialog fSessionPathText.setToolTipText(Messages.TraceControl_CreateSessionPathTooltip); // layout widgets - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - fSessionPathText.setText("666.666.666.666"); //$NON-NLS-1$ - Point minSize = fSessionPathText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - data.widthHint = minSize.x + 5; + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 3; fSessionNameText.setLayoutData(data); fSessionPathText.setLayoutData(data); - - fSessionPathText.setText(""); //$NON-NLS-1$ + getShell().setMinimumSize(new Point(300, 150)); + return fDialogComposite; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableKernelEventComposite.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableKernelEventComposite.java index b448ab6a86..126ae04804 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableKernelEventComposite.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableKernelEventComposite.java @@ -273,53 +273,58 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern fIsDynamicProbe = fProbeActivateButton.getSelection(); fIsDynamicFunctionProbe = fFunctionActivateButton.getSelection(); - List comps = fProviderGroup.getChildren(KernelProviderComponent.class); - fIsAllTracepoints = fTracepointsViewer.getChecked(comps.get(0)); - - Object[] checkedElements = fTracepointsViewer.getCheckedElements(); + // initialize tracepoint fields + fIsAllTracepoints = false; fSelectedEvents = new ArrayList(); - for (int i = 0; i < checkedElements.length; i++) { - ITraceControlComponent component = (ITraceControlComponent)checkedElements[i]; - if (component instanceof BaseEventComponent) { - fSelectedEvents.add(component.getName()); + + if (fIsTracepoints) { + List comps = fProviderGroup.getChildren(KernelProviderComponent.class); + fIsAllTracepoints = fTracepointsViewer.getChecked(comps.get(0)); + + Object[] checkedElements = fTracepointsViewer.getCheckedElements(); + for (int i = 0; i < checkedElements.length; i++) { + ITraceControlComponent component = (ITraceControlComponent)checkedElements[i]; + if (component instanceof BaseEventComponent) { + fSelectedEvents.add(component.getName()); + } } } - - // initialize probe string - fProbeEventName = null; - fProbeString = null; - String temp = fProbeEventNameText.getText(); - if (!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 (fIsDynamicProbe) { + String temp = fProbeEventNameText.getText(); + if (!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(); + } } - - if(!fProbeText.getText().matches("\\s*")) { //$NON-NLS-1$ - fProbeEventName = temp; - // fProbeString will be validated by lttng-tools - fProbeString = fProbeText.getText(); - } // initialize function string fFunctionEventName = null; 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$ + MessageDialog.openError(getShell(), + Messages.TraceControl_EnableEventsDialogTitle, + Messages.TraceControl_InvalidProbeNameError + " (" + functionTemp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$ + + return false; + } - temp = fFunctionEventNameText.getText(); - if (!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(!fFunctionText.getText().matches("\\s*")) { //$NON-NLS-1$ - fFunctionEventName = temp; - // fFunctionString will be validated by lttng-tools - fFunctionString = fFunctionText.getText(); + if(!fFunctionText.getText().matches("\\s*")) { //$NON-NLS-1$ + fFunctionEventName = functionTemp; + // fFunctionString will be validated by lttng-tools + fFunctionString = fFunctionText.getText(); + } } return true; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java index 34571df59f..b11e9ce801 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java @@ -267,69 +267,77 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve fIsWildcard = fWildcardActivateButton.getSelection(); fIsLogLevel = fLogLevelActivateButton.getSelection(); - fIsAllTracepoints = fTracepointsViewer.getChecked(fProviderGroup); - - Set set = new HashSet(); - Object[] checkedElements = fTracepointsViewer.getCheckedElements(); + // initialize tracepoint fields + fIsAllTracepoints = false; fSelectedEvents = new ArrayList(); - for (int i = 0; i < checkedElements.length; i++) { - ITraceControlComponent component = (ITraceControlComponent)checkedElements[i]; - if (!set.contains(component.getName()) && (component instanceof BaseEventComponent)) { - set.add(component.getName()); - fSelectedEvents.add(component.getName()); + if (fIsTracepoints) { + fIsAllTracepoints = fTracepointsViewer.getChecked(fProviderGroup); + Set set = new HashSet(); + Object[] checkedElements = fTracepointsViewer.getCheckedElements(); + for (int i = 0; i < checkedElements.length; i++) { + ITraceControlComponent component = (ITraceControlComponent)checkedElements[i]; + if (!set.contains(component.getName()) && (component instanceof BaseEventComponent)) { + set.add(component.getName()); + fSelectedEvents.add(component.getName()); + } } } - if (fLogLevelButton.getSelection()) { - fLogLevelType = LogLevelType.LOGLEVEL; - } else if (fLogLevelOnlyButton.getSelection()) { - fLogLevelType = LogLevelType.LOGLEVEL_ONLY; - } else { - fLogLevelType = LogLevelType.LOGLEVEL_NONE; - } - // initialize log level event name string + fLogLevelType = LogLevelType.LOGLEVEL_NONE; fLogLevelEventName = null; - String temp = fLogLevelEventNameText.getText(); - if (!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 (fIsLogLevel) { + if (fLogLevelButton.getSelection()) { + fLogLevelType = LogLevelType.LOGLEVEL; + } else if (fLogLevelOnlyButton.getSelection()) { + fLogLevelType = LogLevelType.LOGLEVEL_ONLY; + } - if(!temp.matches("\\s*")) { //$NON-NLS-1$ - fLogLevelEventName = temp; - } + String temp = fLogLevelEventNameText.getText(); + if (!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$ - TraceLogLevel[] levels = TraceLogLevel.values(); - int id = fLogLevelCombo.getSelectionIndex(); - if ((id < 0) && fIsLogLevel) { - MessageDialog.openError(getShell(), - Messages.TraceControl_EnableEventsDialogTitle, - Messages.TraceControl_InvalidLogLevel + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$ - - return false; - } else { - fLogLevel = levels[id]; + return false; + } + + if(!temp.matches("\\s*")) { //$NON-NLS-1$ + fLogLevelEventName = temp; + } + + TraceLogLevel[] levels = TraceLogLevel.values(); + int id = fLogLevelCombo.getSelectionIndex(); + + if (id < 0) { + MessageDialog.openError(getShell(), + Messages.TraceControl_EnableEventsDialogTitle, + Messages.TraceControl_InvalidLogLevel + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$ + + return false; + } else { + fLogLevel = levels[id]; + } } - // initialize log level event name string + // initialize wildcard with the event name string fWildcard = null; - temp = fWildcardText.getText(); - if (!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_InvalidWildcardError + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$ + if (fIsWildcard) { + String tempWildcard = fWildcardText.getText(); + if (!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; + } - return false; - } - - if(!temp.matches("\\s*")) { //$NON-NLS-1$ - fWildcard = temp; + if(!tempWildcard.matches("\\s*")) { //$NON-NLS-1$ + fWildcard = tempWildcard; + } } - + // validation successful -> call super.okPressed() return true; } -- 2.34.1