/**********************************************************************
- * Copyright (c) 2012 Ericsson
- *
+ * Copyright (c) 2012, 2013 Ericsson
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
+ * Bernd Hufmann - Updated for support of LTTng Tools 2.1
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel;
import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.Messages;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.LogLevelType;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TraceLogLevel;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
/**
- * <b><u>EnableEventsDialog</u></b>
* <p>
* Dialog box for collecting information events to be enabled.
* </p>
+ *
+ * @author Bernd Hufmann
*/
public class EnableEventsDialog extends Dialog implements IEnableEventsDialog {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
-
+
/**
* The icon file for this dialog box.
*/
- public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/edit.gif"; //$NON-NLS-1$
+ public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/enable_event.gif"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
*/
private EnableKernelEventComposite fKernelComposite;
/**
- * The composite with widgets for collecting information about UST events.
+ * The composite with widgets for collecting information about UST events.
*/
private EnableUstEventsComposite fUstComposite;
/**
*/
private Button fUstButton;
/**
- * The referenced trace provider group containing the kernel provider and UST
+ * The referenced trace provider group containing the kernel provider and UST
* provider component which contains a list of available tracepoints.
*/
private TraceProviderGroup fProviderGroup;
/**
- * The parent domain component where the channel node should be added.
+ * The parent domain component where the channel node should be added.
* Null in case the domain is not known (i.e. on session level).
*/
private TraceDomainComponent fDomain;
/**
- * Output domain information. True in case of Kernel domain. False for UST.
+ * Output domain information. True in case of Kernel domain. False for UST.
*/
private boolean fIsKernel;
/**
* Constructor
* @param shell - a shell for the display of the dialog
- * @param providerGroup - the trace provider group
*/
public EnableEventsDialog(Shell shell) {
super(shell);
setShellStyle(SWT.RESIZE);
}
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isTracpoints()
- */
+
@Override
public boolean isTracepoints() {
if (fIsKernel) {
}
return fUstComposite.isTracepoints();
}
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllTracePoints()
- */
+
@Override
public boolean isAllTracePoints() {
if (fIsKernel) {
}
return fUstComposite.isAllTracePoints();
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isSysCalls()
- */
+
@Override
public boolean isSysCalls() {
if (fIsKernel) {
}
return false;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllSysCalls()
- */
+
@Override
public boolean isAllSysCalls() {
if (fIsKernel) {
}
return false;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getEventNames()
- */
+
@Override
public List<String> getEventNames() {
if (fIsKernel) {
}
return fUstComposite.getEventNames();
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isDynamicProbe()
- */
+
@Override
public boolean isDynamicProbe() {
if (fIsKernel) {
}
return false;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeName()
- */
+
@Override
public String getProbeName() {
if (fIsKernel) {
}
return null;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeEventName()
- */
+
@Override
public String getProbeEventName() {
if (fIsKernel) {
}
return null;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isDynamicFunctionProbe()
- */
+
@Override
public boolean isDynamicFunctionProbe() {
if (fIsKernel) {
}
return false;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunctionEventName()
- */
+
@Override
public String getFunctionEventName() {
if (fIsKernel) {
}
return null;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunction()
- */
+
@Override
public String getFunction() {
if (fIsKernel) {
}
return null;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#isWildcard()
- */
+
@Override
public boolean isWildcard() {
if (!fIsKernel) {
return false;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getWildcard()
- */
@Override
public String getWildcard() {
if (!fIsKernel) {
return fUstComposite.getWildcard();
}
return null;
-
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#isLogLevel()
- */
@Override
public boolean isLogLevel() {
if (!fIsKernel) {
return fUstComposite.isLogLevel();
}
return false;
-
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getLogLevelType()
- */
@Override
public LogLevelType getLogLevelType() {
if (!fIsKernel) {
return fUstComposite.getLogLevelType();
}
return null;
-
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getLogLevel()
- */
+
@Override
public TraceLogLevel getLogLevel() {
if (!fIsKernel) {
return fUstComposite.getLogLevel();
}
return null;
-
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getLogLevelEventName()
- */
@Override
public String getLogLevelEventName() {
if (!fIsKernel) {
}
return null;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableEventsDialog#isKernel()
- */
+
@Override
public boolean isKernel() {
return fIsKernel;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableEventsDialog#setTraceProviderGroup(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup)
- */
+
@Override
public void setTraceProviderGroup(TraceProviderGroup providerGroup) {
fProviderGroup = providerGroup;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableEventsDialog#setTraceDomainComponent(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent)
- */
@Override
public void setTraceDomainComponent(TraceDomainComponent domain) {
fDomain = domain;
if (fDomain != null) {
fIsKernel = fDomain.isKernel();
} else {
- fIsKernel = true;
+ fIsKernel = fProviderGroup != null ? fProviderGroup.hasKernelProvider() : true;
}
}
+ @Override
+ public String getFilterExpression() {
+ if (!fIsKernel) {
+ return fUstComposite.getFilterExpression();
+ }
+ return null;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
- */
+
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setImage(Activator.getDefault().loadIcon(ENABLE_EVENT_ICON_FILE));
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
- */
@Override
protected Control createDialogArea(Composite parent) {
-
+
// Main dialog panel
fDialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, true);
fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
// ------------------------------------------------------------------------
- // Domain Group
+ // Domain Group
// ------------------------------------------------------------------------
Group domainGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
domainGroup.setText(Messages.TraceControl_DomainDisplayName);
layout = new GridLayout(2, true);
- domainGroup.setLayout(layout);
-
+ domainGroup.setLayout(layout);
+
fKernelButton = new Button(domainGroup, SWT.RADIO);
fKernelButton.setText(Messages.TraceControl_KernelDomainDisplayName);
fKernelButton.setSelection(fIsKernel);
fUstButton.setText(Messages.TraceControl_UstDisplayName);
fUstButton.setSelection(!fIsKernel);
- if (fDomain != null) {
+ if ((fDomain != null) || ((fProviderGroup != null) && (!fProviderGroup.hasKernelProvider()))) {
fKernelButton.setEnabled(false);
fUstButton.setEnabled(false);
}
fUstButton.setLayoutData(data);
// ------------------------------------------------------------------------
- // Kernel or UST event data group
+ // Kernel or UST event data group
// ------------------------------------------------------------------------
fUstComposite = null;
fKernelComposite = null;
} else {
createUstComposite();
}
-
+
fKernelButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
}
}
});
-
+
fDialogComposite.layout();
-
+
getShell().setMinimumSize(new Point(500, 650));
-
+
return fDialogComposite;
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
- */
@Override
protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.CANCEL_ID, "&Cancel", true); //$NON-NLS-1$
createButton(parent, IDialogConstants.OK_ID, "&Ok", true); //$NON-NLS-1$
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
@Override
protected void okPressed() {
fIsKernel = fKernelButton.getSelection();
if (fKernelComposite != null && !fKernelComposite.isValid()) {
return;
}
-
+
// Validate UST composite in case of UST domain
if (fUstComposite != null && !fUstComposite.isValid()) {
return;
}
-
+
// validation successful -> call super.okPressed()
super.okPressed();
}
-
+
// ------------------------------------------------------------------------
// Helper methods
// ------------------------------------------------------------------------
+
/**
* Creates the kernel composite (if not existing)
*/
* Creates the UST composite (if not existing)
*/
private void createUstComposite() {
- if (fUstComposite == null) {
+ if (fUstComposite == null) {
fUstComposite = new EnableUstEventsComposite(fDialogComposite, SWT.NONE, fProviderGroup);
GridLayout layout = new GridLayout(1, true);
fUstComposite.setLayout(layout);