/*******************************************************************************
- * Copyright (c) 2010, 2011 Ericsson
+ * Copyright (c) 2010, 2011, 202 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.core.runtime.IPath;
/**
- * <b><u>ITmfProjectModelElement</u></b>
- * <p>
- * TODO: Make ITmfProjectModelElement extend IAdaptable
+ * The TMF project model interface.
+ *
+ * The TMF tracing project is integrated in the Common Navigator framework.
+ * Each tracing tree element has to implement this interface to be visible in the
+ * Project Explorer.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public interface ITmfProjectModelElement {
-
+
+ /**
+ * Returns the name of the project model element.
+ * @return the name of the project element.
+ */
public String getName();
-
+ /**
+ * Returns the resource associated with the project model element.
+ * @return the model resource.
+ */
public IResource getResource();
-
+ /**
+ * Returns the path of the project model resource.
+ * @return the resource path.
+ */
public IPath getPath();
-
+ /**
+ * Returns the URI (location) of the resource.
+ * @return the resource URI.
+ */
public URI getLocation();
-
+ /**
+ * Returns the project model element.
+ * @return the project model element.
+ */
public TmfProjectElement getProject();
-
+ /**
+ * Returns the parent of this model element.
+ * @return the parent of this model element.
+ */
public ITmfProjectModelElement getParent();
-
+ /**
+ * Returns whether this model element has children or not.
+ * @return <code>true</code> if this model has children else <code>false</code>
+ */
public boolean hasChildren();
-
+ /**
+ * Returns a list of children model elements.
+ * @return a list of children model elements.
+ */
public List<ITmfProjectModelElement> getChildren();
-
+ /**
+ * Method to add a child to the model element.
+ * @param child A child element to add.
+ */
public void addChild(ITmfProjectModelElement child);
-
+ /**
+ * Method to remove a child from the model element.
+ * @param child A child element to remove
+ */
public void removeChild(ITmfProjectModelElement child);
-
+ /**
+ * Method to request to refresh the project.
+ */
public void refresh();
}
/*******************************************************************************
- * Copyright (c) 2010 Ericsson
+ * Copyright (c) 2010, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
/**
- * <b><u>TmfExperimentElement</u></b>
+ * Implementation of TMF Experiment Model Element.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
+ *
*/
public class TmfExperimentElement extends TmfProjectModelElement implements IPropertySource2 {
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor
+ * @param name The name of the experiment
+ * @param folder The folder reference
+ * @param parent The experiment folder reference.
+ */
public TmfExperimentElement(String name, IFolder folder, TmfExperimentFolder parent) {
super(name, folder, parent);
parent.addChild(this);
// TmfProjectModelElement
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#getResource()
+ */
@Override
public IFolder getResource() {
return (IFolder) fResource;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getProject()
+ */
@Override
public TmfProjectElement getProject() {
return (TmfProjectElement) getParent().getParent();
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+ /**
+ * Returns a list of TmfTraceElements contained in this experiment.
+ * @return a list of TmfTraceElements
+ */
public List<TmfTraceElement> getTraces() {
List<ITmfProjectModelElement> children = getChildren();
List<TmfTraceElement> traces = new ArrayList<TmfTraceElement>();
// IPropertySource2
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
+ */
@Override
public Object getEditableValue() {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
+ */
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
+ */
@Override
public Object getPropertyValue(Object id) {
return null;
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
+ */
@Override
public void resetPropertyValue(Object id) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
+ */
@Override
public void setPropertyValue(Object id, Object value) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertyResettable(java.lang.Object)
+ */
@Override
public boolean isPropertyResettable(Object id) {
return false;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertySet(java.lang.Object)
+ */
@Override
public boolean isPropertySet(Object id) {
return false;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
/**
- * <b><u>TmfExperimentFolder</u></b>
+ * Implementation of the model element for the experiment folder.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
+ *
*/
public class TmfExperimentFolder extends TmfProjectModelElement implements IPropertySource2 {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
-
+ /**
+ * The name of the experiment folder.
+ */
public static final String EXPER_FOLDER_NAME = "Experiments"; //$NON-NLS-1$
// Property View stuff
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor.
+ * Creates a TmfExperimentFolder model element.
+ * @param name The name of the folder
+ * @param folder The folder reference
+ * @param parent The parent (project element)
+ */
public TmfExperimentFolder(String name, IFolder folder, TmfProjectElement parent) {
super(name, folder, parent);
parent.addChild(this);
// ------------------------------------------------------------------------
// TmfProjectModelElement
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#getResource()
+ */
@Override
public IFolder getResource() {
return (IFolder) fResource;
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getProject()
+ */
@Override
public TmfProjectElement getProject() {
return (TmfProjectElement) getParent();
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#refresh()
+ */
@Override
public void refresh() {
TmfProjectElement project = (TmfProjectElement) getParent();
project.refresh();
}
- // ------------------------------------------------------------------------}
- // IPropertySource2\r // ------------------------------------------------------------------------\r\r @Override\r public Object getEditableValue() {\r return null;\r }\r\r @Override\r public IPropertyDescriptor[] getPropertyDescriptors() {\r return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null;\r }\r\r @Override\r public Object getPropertyValue(Object id) {\r\r if (sfName.equals(id))\r return getName();\r\r if (sfPath.equals(id))\r return getPath().toString();\r\r if (sfLocation.equals(id))\r return getLocation().toString();\r\r return null;\r }\r\r @Override\r public void resetPropertyValue(Object id) {\r }\r\r @Override\r public void setPropertyValue(Object id, Object value) {\r }\r\r @Override\r public boolean isPropertyResettable(Object id) {\r return false;\r }\r\r @Override\r public boolean isPropertySet(Object id) {\r return false;\r }
+ // ------------------------------------------------------------------------
+ // IPropertySource2\r // ------------------------------------------------------------------------\r
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
+ */\r @Override\r public Object getEditableValue() {\r return null;\r }\r
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
+ */\r @Override\r public IPropertyDescriptor[] getPropertyDescriptors() {\r return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null;\r }\r
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
+ */\r @Override\r public Object getPropertyValue(Object id) {\r\r if (sfName.equals(id))\r return getName();\r\r if (sfPath.equals(id))\r return getPath().toString();\r\r if (sfLocation.equals(id))\r return getLocation().toString();\r\r return null;\r }\r /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
+ */\r @Override\r public void resetPropertyValue(Object id) {\r }\r
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
+ */\r @Override\r public void setPropertyValue(Object id, Object value) {\r }\r
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertyResettable(java.lang.Object)
+ */\r @Override\r public boolean isPropertyResettable(Object id) {\r return false;\r }\r
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertySet(java.lang.Object)
+ */\r @Override\r public boolean isPropertySet(Object id) {\r return false;\r }
}\r\r
\ No newline at end of file
/*******************************************************************************
- * Copyright (c) 2010, 2011 Ericsson
+ * Copyright (c) 2010, 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.navigator.PipelinedViewerUpdate;
/**
- * <b><u>TmfNavigatorContentProvider</u></b>
+ * The TMF project content provider for the tree viewer in the project explorer view.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TmfNavigatorContentProvider implements ICommonContentProvider, IPipelinedTreeContentProvider {
// ------------------------------------------------------------------------
// ICommonContentProvider
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
+ */
@Override
public Object[] getElements(Object inputElement) {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+ */
@Override
public Object getParent(Object element) {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+ */
@Override
public boolean hasChildren(Object element) {
if (element instanceof IProject) {
return false;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
@Override
public void dispose() {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento)
+ */
@Override
public void restoreState(IMemento aMemento) {
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
+ */
@Override
public void saveState(IMemento aMemento) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
+ */
@Override
public void init(ICommonContentExtensionSite aConfig) {
}
// ------------------------------------------------------------------------
// ICommonContentProvider - getChildren()
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+ */
@Override
public synchronized Object[] getChildren(Object parentElement) {
return new Object[0];
}
+ // ------------------------------------------------------------------------
+ // Helper method
+ // ------------------------------------------------------------------------
private Object[] getProjectChildren(IProject project) {
// The children structure
List<Object> children = new ArrayList<Object>();
// IPipelinedTreeContentProvider
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedChildren(java.lang.Object, java.util.Set)
+ */
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getPipelinedChildren(Object parent, Set currentChildren) {
customizeTmfElements(getChildren(parent), currentChildren);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedElements(java.lang.Object, java.util.Set)
+ */
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getPipelinedElements(Object input, Set currentElements) {
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#getPipelinedParent(java.lang.Object, java.lang.Object)
+ */
@Override
public Object getPipelinedParent(Object anObject, Object aSuggestedParent) {
return aSuggestedParent;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptAdd(org.eclipse.ui.navigator.PipelinedShapeModification)
+ */
@Override
public PipelinedShapeModification interceptAdd(PipelinedShapeModification anAddModification) {
return anAddModification;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptRemove(org.eclipse.ui.navigator.PipelinedShapeModification)
+ */
@Override
public PipelinedShapeModification interceptRemove(PipelinedShapeModification aRemoveModification) {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptRefresh(org.eclipse.ui.navigator.PipelinedViewerUpdate)
+ */
@Override
public boolean interceptRefresh(PipelinedViewerUpdate aRefreshSynchronization) {
return false;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IPipelinedTreeContentProvider#interceptUpdate(org.eclipse.ui.navigator.PipelinedViewerUpdate)
+ */
@Override
public boolean interceptUpdate(PipelinedViewerUpdate anUpdateSynchronization) {
return false;
}
-
}
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.osgi.framework.Bundle;
/**
- * <b><u>TmfNavigatorLabelProvider</u></b>
+ * The TMF project label provider for the tree viewer in the project explorer view.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TmfNavigatorLabelProvider implements ICommonLabelProvider {
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor.
+ *
+ * Creates the TMF navigator content provider.
+ */
public TmfNavigatorLabelProvider() {
Bundle bundle = Activator.getDefault().getBundle();
fDefaultTraceIcon = loadIcon(bundle, fTraceIconFile);
// ------------------------------------------------------------------------
// ICommonLabelProvider
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
@Override
public Image getImage(Object element) {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
@Override
public String getText(Object element) {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
@Override
public void addListener(ILabelProviderListener listener) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+ */
@Override
public void dispose() {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+ */
@Override
public boolean isLabelProperty(Object element, String property) {
return false;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+ */
@Override
public void removeListener(ILabelProviderListener listener) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento)
+ */
@Override
public void restoreState(IMemento aMemento) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento)
+ */
@Override
public void saveState(IMemento aMemento) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.IDescriptionProvider#getDescription(java.lang.Object)
+ */
@Override
public String getDescription(Object anElement) {
return getText(anElement);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.navigator.ICommonLabelProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
+ */
@Override
public void init(ICommonContentExtensionSite aConfig) {
}
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.navigator.CommonViewer;
/**
- * <b><u>TmfProjectElement</u></b>
- * <p>
+ * The implementation of TMF project model element.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TmfProjectElement extends TmfProjectModelElement {
// Attributes
// ------------------------------------------------------------------------
- TmfTraceFolder fTraceFolder = null;
- TmfExperimentFolder fExperimentFolder = null;
+ private TmfTraceFolder fTraceFolder = null;
+ private TmfExperimentFolder fExperimentFolder = null;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor.
+ *
+ * Creates the TMF project model element.
+ * @param name The name of the project.
+ * @param project The project reference.
+ * @param parent The parent element
+ */
public TmfProjectElement(String name, IProject project, ITmfProjectModelElement parent) {
super(name, project, parent);
}
// TmfProjectModelElement
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#getResource()
+ */
@Override
public IProject getResource() {
return (IProject) fResource;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#addChild(org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement)
+ */
@Override
public void addChild(ITmfProjectModelElement child) {
super.addChild(child);
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
-
+ /**
+ * Returns the containing trace folder element.
+ * @return the TMF trace folder element.
+ */
public TmfTraceFolder getTracesFolder() {
return fTraceFolder;
}
+ /**
+ * Returns the containing experiment folder element.
+ * @return the TMF experiment folder element.
+ */
public TmfExperimentFolder getExperimentsFolder() {
return fExperimentFolder;
}
// TmfProjectElement
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#refresh()
+ */
@Override
public void refresh() {
Display.getDefault().asyncExec(new Runnable(){
}});
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
+ */
@Override
public void resourceChanged(IResourceChangeEvent event) {
if (event.getType() == IResourceChangeEvent.POST_CHANGE) {
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getProject()
+ */
@Override
public TmfProjectElement getProject() {
return this;
}
-
}
/*******************************************************************************
- * Copyright (c) 2010 Ericsson
+ * Copyright (c) 2010, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Bernd Hufmann - Added supplementary files/folder handling
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.project.model;
import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
/**
- * <b><u>TmfProjectModelElement</u></b>
+ * The implementation of the base TMF project model element. It provides default implementation
+ * of the <code>ITmfProjectModelElement</code> interface.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public abstract class TmfProjectModelElement implements ITmfProjectModelElement, IResourceChangeListener {
// ------------------------------------------------------------------------
private final String fName;
+ /**
+ * The project model element resource.
+ */
protected final IResource fResource;
+ /**
+ * The project model resource location (URI)
+ */
protected final URI fLocation;
+ /**
+ * The project model path of a resource.
+ */
protected final IPath fPath;
private final ITmfProjectModelElement fParent;
+ /**
+ * The list of children elements.
+ */
protected final List<ITmfProjectModelElement> fChildren;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor.
+ *
+ * Creates a base project model element.
+ * @param name The name of the element.
+ * @param resource The element resource.
+ * @param parent The parent model element.
+ */
protected TmfProjectModelElement(String name, IResource resource, ITmfProjectModelElement parent) {
fName = name;
fResource = resource;
// ------------------------------------------------------------------------
// ITmfProjectModelElement
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getName()
+ */
@Override
public String getName() {
return fName;
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getResource()
+ */
@Override
public IResource getResource() {
return fResource;
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getPath()
+ */
@Override
public IPath getPath() {
return fPath;
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getLocation()
+ */
@Override
public URI getLocation() {
return fLocation;
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getParent()
+ */
@Override
public ITmfProjectModelElement getParent() {
return fParent;
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#hasChildren()
+ */
@Override
public boolean hasChildren() {
return fChildren.size() > 0;
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getChildren()
+ */
@Override
public List<ITmfProjectModelElement> getChildren() {
return fChildren;
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#addChild(org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement)
+ */
@Override
public void addChild(ITmfProjectModelElement child) {
fChildren.add(child);
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#removeChild(org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement)
+ */
@Override
public void removeChild(ITmfProjectModelElement child) {
fChildren.remove(child);
refresh();
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#refresh()
+ */
@Override
public void refresh() {
// Do nothing by default: sub-classes override this on an "as-needed"
// ------------------------------------------------------------------------
// IResourceChangeListener
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
+ */
@Override
public void resourceChanged(IResourceChangeEvent event) {
// Do nothing by default: sub-classes override this on an "as-needed"
// ------------------------------------------------------------------------
// Object
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
@Override
public int hashCode() {
final int prime = 31;
result = prime * result + ((fPath == null) ? 0 : fPath.hashCode());
return result;
}
-
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
@Override
public boolean equals(Object other) {
if (this == other)
TmfProjectModelElement element = (TmfProjectModelElement) other;
return element.fName.equals(fName) && element.fLocation.equals(fLocation);
}
-
/**
* Returns the trace specific supplementary directory under the project's supplementary folder.
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.core.resources.IProject;
/**
- * <b><u>TmfProjectRegistry</u></b>
+ * Factory class storing TMF tracing projects and creating TMF project model elements.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TmfProjectRegistry {
/*******************************************************************************
- * Copyright (c) 2010, 2011 Ericsson
+ * Copyright (c) 2010, 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Bernd Hufmann - Added supplementary files handling
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.project.model;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
/**
- * <b><u>TmfTraceElement</u></b>
- * <p>
+ * Implementation of trace model element representing a trace. It provides methods to instantiate
+ * <code>ITmfTrace</code> and <code>ITmfEvent</code> as well as editor ID from the trace type
+ * extension definition.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TmfTraceElement extends TmfProjectModelElement implements IActionFilter, IPropertySource2 {
// ------------------------------------------------------------------------
// Other attributes
+ /**
+ * Bundle attribute name
+ */
public static final String BUNDLE = "bundle"; //$NON-NLS-1$
+ /**
+ * IsLinked attribute name.
+ */
public static final String IS_LINKED = "isLinked"; //$NON-NLS-1$
// Property View stuff
private static final Map<String, IConfigurationElement> sfTraceTypeAttributes = new HashMap<String, IConfigurationElement>();
private static final Map<String, IConfigurationElement> sfTraceCategories = new HashMap<String, IConfigurationElement>();
- // Initialize statically at startup
+ /**
+ * Initialize statically at startup by getting extensions from the platform extension registry.
+ */
public static void init() {
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfTraceType.TMF_TRACE_TYPE_ID);
for (IConfigurationElement ce : config) {
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor.
+ * Creates trace model element under the trace folder.
+ * @param name The name of trace
+ * @param trace The trace resource.
+ * @param parent The parent element (trace folder)
+ */
public TmfTraceElement(String name, IResource trace, TmfTraceFolder parent) {
this(name, trace, (TmfProjectModelElement) parent);
}
-
+ /**
+ * Constructor.
+ * Creates trace model element under the experiment folder.
+ * @param name The name of trace
+ * @param trace The trace resource.
+ * @param parent The parent element (experiment folder)
+ */
public TmfTraceElement(String name, IResource trace, TmfExperimentElement parent) {
this(name, trace, (TmfProjectModelElement) parent);
}
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+ /**
+ * Returns the trace type ID.
+ * @return trace type ID.
+ */
public String getTraceType() {
return fTraceTypeId;
}
+ /**
+ * Refreshes the trace type filed by reading the trace type persistent property of the resource
+ * referenece.
+ */
public void refreshTraceType() {
try {
fTraceTypeId = getResource().getPersistentProperty(TmfCommonConstants.TRACETYPE);
}
}
+ /**
+ * Instantiate a <code>ITmfTrace</code> object based on the trace type and the corresponding extension.
+ *
+ * @return the <code>ITmfTrace</code> or <code>null</code> for an error
+ */
public ITmfTrace<?> instantiateTrace() {
try {
return null;
}
+ /**
+ * Instantiate a <code>ITmfEvent</code> object based on the trace type and the corresponding extension.
+ *
+ * @return the <code>ITmfEvent</code> or <code>null</code> for an error
+ */
public ITmfEvent instantiateEvent() {
try {
if (fTraceTypeId != null) {
return null;
}
+ /**
+ * Returns the optional editor ID from the trace type extension.
+ * @return the editor ID or <code>null</code> if not defined.
+ */
public String getEditorId() {
if (fTraceTypeId != null) {
if (fTraceTypeId.startsWith(CustomTxtTrace.class.getCanonicalName())) {
// ------------------------------------------------------------------------
// TmfTraceElement
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getProject()
+ */
@Override
public TmfProjectElement getProject() {
if (getParent() instanceof TmfTraceFolder) {
// IPropertySource2
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
+ */
@Override
public Object getEditableValue() {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
+ */
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
+ */
@Override
public Object getPropertyValue(Object id) {
return "[no category]"; //$NON-NLS-1$
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
+ */
@Override
public void resetPropertyValue(Object id) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
+ */
@Override
public void setPropertyValue(Object id, Object value) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertyResettable(java.lang.Object)
+ */
@Override
public boolean isPropertyResettable(Object id) {
return false;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertySet(java.lang.Object)
+ */
@Override
public boolean isPropertySet(Object id) {
return false;
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
/**
- * <b><u>TmfTraceFolder</u></b>
+ * Implementation of trace folder model element representing the trace folder in the project.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TmfTraceFolder extends TmfProjectModelElement implements IPropertySource2 {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
-
+ /**
+ * The name of the trace folder
+ */
public static final String TRACE_FOLDER_NAME = "Traces"; //$NON-NLS-1$
// Property View stuff
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor.
+ * Creates trace folder model element under the project.
+ * @param name The name of trace folder.
+ * @param trace The folder resource.
+ * @param parent The parent element (project).
+ */
public TmfTraceFolder(String name, IFolder resource, TmfProjectElement parent) {
super(name, resource, parent);
parent.addChild(this);
// ------------------------------------------------------------------------
// TmfProjectModelElement
// ------------------------------------------------------------------------
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#getResource()
+ */
@Override
public IFolder getResource() {
return (IFolder) fResource;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getProject()
+ */
@Override
public TmfProjectElement getProject() {
return (TmfProjectElement) getParent();
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectModelElement#refresh()
+ */
@Override
public void refresh() {
TmfProjectElement project = (TmfProjectElement) getParent();
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
+ /**
+ * Returns a list of trace model elements under the traces folder.
+ * @return list of trace model elements
+ */
public List<TmfTraceElement> getTraces() {
List<ITmfProjectModelElement> children = getChildren();
List<TmfTraceElement> traces = new ArrayList<TmfTraceElement>();
// IPropertySource2
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
+ */
@Override
public Object getEditableValue() {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
+ */
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return (sfDescriptors != null) ? Arrays.copyOf(sfDescriptors, sfDescriptors.length) : null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
+ */
@Override
public Object getPropertyValue(Object id) {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
+ */
@Override
public void resetPropertyValue(Object id) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
+ */
@Override
public void setPropertyValue(Object id, Object value) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertyResettable(java.lang.Object)
+ */
@Override
public boolean isPropertyResettable(Object id) {
return false;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertySet(java.lang.Object)
+ */
@Override
public boolean isPropertySet(Object id) {
return false;
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
+/**
+ * Utility class for accessing TMF trace type extensions from the platform's extensions registry.
+ *
+ * @version 1.0
+ * @author Patrick Tasse
+ *
+ */
public class TmfTraceType {
- // Extension point ID
+ /**
+ * Extension point ID
+ */
public static final String TMF_TRACE_TYPE_ID = "org.eclipse.linuxtools.tmf.ui.tracetype"; //$NON-NLS-1$
- // Extension point elements
+ /**
+ * Extension point element 'Category'
+ */
public static final String CATEGORY_ELEM = "category"; //$NON-NLS-1$
+ /**
+ * Extension point element 'Type'
+ */
public static final String TYPE_ELEM = "type"; //$NON-NLS-1$
+ /**
+ * Extension point element 'Default editor'
+ */
public static final String DEFAULT_EDITOR_ELEM = "defaultEditor"; //$NON-NLS-1$
+ /**
+ * Extension point element 'Events table type'
+ */
public static final String EVENTS_TABLE_TYPE_ELEM = "eventsTableType"; //$NON-NLS-1$
- // Extension point attributes
+ /**
+ * Extension point attribute 'ID'
+ */
public static final String ID_ATTR = "id"; //$NON-NLS-1$
+ /**
+ * Extension point attribute 'name'
+ */
public static final String NAME_ATTR = "name"; //$NON-NLS-1$
+ /**
+ * Extension point attribute 'category'
+ */
public static final String CATEGORY_ATTR = "category"; //$NON-NLS-1$
+ /**
+ * Extension point attribute 'trace_type'
+ */
public static final String TRACE_TYPE_ATTR = "trace_type"; //$NON-NLS-1$
+ /**
+ * Extension point attribute 'event_type'
+ */
public static final String EVENT_TYPE_ATTR = "event_type"; //$NON-NLS-1$
+ /**
+ * Extension point attribute 'icon'
+ */
public static final String ICON_ATTR = "icon"; //$NON-NLS-1$
+ /**
+ * Extension point attribute 'class'
+ */
public static final String CLASS_ATTR = "class"; //$NON-NLS-1$
+ /**
+ * Retrieves the category name from the platform extension registry based on the category ID
+ * @param categoryId The category ID
+ * @return the category name or empty string if not found
+ */
public static String getCategoryName(String categoryId) {
IConfigurationElement[] elements = Platform.getExtensionRegistry()
.getConfigurationElementsFor(TMF_TRACE_TYPE_ID);
return ""; //$NON-NLS-1$
}
+ /**
+ * Retrieves all configuration elements from the platform extension registry
+ * for the trace type extension.
+ *
+ * @return an array of trace type configuration elements
+ */
public static IConfigurationElement[] getTypeElements() {
IConfigurationElement[] elements = Platform.getExtensionRegistry()
.getConfigurationElementsFor(TMF_TRACE_TYPE_ID);
/*******************************************************************************
- * Copyright (c) 2010, 2011 Ericsson
+ * Copyright (c) 2010, 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.jface.viewers.Viewer;
/**
- * <b><u>TraceFolderContentProvider</u></b>
+ * Content provider implementation for trace folders for tree viewers that display
+ * the content of a trace folder.
* <p>
- * TODO: Implement me. Please.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TraceFolderContentProvider implements IStructuredContentProvider {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
@Override
public Object[] getElements(Object inputElement) {
if (inputElement instanceof TmfTraceFolder) {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
@Override
public void dispose() {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
/*******************************************************************************
- * Copyright (c) 2010, 2011 Ericsson
+ * Copyright (c) 2010, 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.swt.graphics.Image;
/**
- * <b><u>TraceFolderLabelProvider</u></b>
+ * Label provider implementation for trace folders for tree viewers that display
+ * the content of a trace folder.
* <p>
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TraceFolderLabelProvider extends LabelProvider implements ITableLabelProvider {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
@Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
@Override
public String getColumnText(Object element, int columnIndex) {
if (element instanceof TmfTraceElement) {
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.dialogs.SelectionStatusDialog;
/**
- * <b><u>CopyExperimentDialog</u></b>
+ * Implementation of the copy experiement dialog box.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class CopyExperimentDialog extends SelectionStatusDialog {
// Constructor
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ * @param shell The parent shell
+ * @param experiment The TMF experiment model element
+ */
public CopyExperimentDialog(Shell shell, TmfExperimentElement experiment) {
super(shell);
fExperiment = experiment;
// ------------------------------------------------------------------------
// Dialog
// ------------------------------------------------------------------------
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
// ------------------------------------------------------------------------
// SelectionStatusDialog
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#computeResult()
+ */
@Override
protected void computeResult() {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#create()
+ */
@Override
public void create() {
super.create();
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
+ */
@Override
protected void okPressed() {
IFolder folder = copyExperiment(fNewExperimentName.getText());
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.dialogs.SelectionStatusDialog;
/**
- * <b><u>CopyExperimentDialog</u></b>
+ * Implementation of the copy trace dialog box.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class CopyTraceDialog extends SelectionStatusDialog {
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor.
+ * @param shell The parent shell
+ * @param trace The trace model element.
+ */
public CopyTraceDialog(Shell shell, TmfTraceElement trace) {
super(shell);
fTrace = trace;
// ------------------------------------------------------------------------
// Dialog
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
// SelectionStatusDialog
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#computeResult()
+ */
@Override
protected void computeResult() {
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#create()
+ */
@Override
public void create() {
super.create();
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
+ */
@Override
protected void okPressed() {
IResource trace = copyTrace(fNewTraceName.getText());
/*******************************************************************************
- * Copyright (c) 2010, 2011 Ericsson
+ * Copyright (c) 2010, 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.ide.IDE;
/**
- * <b><u>ImportTraceWizard</u></b>
+ * The import trace wizard implementation.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class ImportTraceWizard extends Wizard implements IImportWizard {
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Default constructor
+ */
public ImportTraceWizard() {
IDialogSettings workbenchSettings = Activator.getDefault().getDialogSettings();
IDialogSettings section = workbenchSettings.getSection(IMPORT_WIZARD);
// Wizard
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
fWorkbench = workbench;
setNeedsProgressMonitor(true);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
@Override
public void addPages() {
super.addPages();
fTraceImportWizardPage = new ImportTraceWizardPage(fWorkbench, fSelection);
addPage(fTraceImportWizardPage);
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
@Override
public boolean performFinish() {
return fTraceImportWizardPage.finish();
/*******************************************************************************
- * Copyright (c) 2009, 2010, 2011 Ericsson
+ * Copyright (c) 2009, 2010, 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* For our purpose, a trace can either be a single file or a whole directory sub-tree, whichever is reached first from
* the root directory.
* <p>
- * TODO: Consider adding Filter/Select/Deselect buttons
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class ImportTraceWizardPage extends WizardResourceImportPage implements Listener {
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor.
+ * Creates the trace wizard page.
+ *
+ * @param name The name of the page.
+ * @param selection The current selection
+ */
protected ImportTraceWizardPage(String name, IStructuredSelection selection) {
super(name, selection);
}
+ /**
+ * Constructor
+ * @param workbench The workbench reference.
+ * @param selection The current selection
+ */
public ImportTraceWizardPage(IWorkbench workbench, IStructuredSelection selection) {
this(IMPORT_WIZARD_PAGE, selection);
setTitle(Messages.ImportTraceWizard_FileSystemTitle);
// ------------------------------------------------------------------------
// WizardResourceImportPage
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.WizardResourceImportPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
@Override
public void createControl(Composite parent) {
super.createControl(parent);
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.WizardResourceImportPage#createSourceGroup(org.eclipse.swt.widgets.Composite)
+ */
@Override
protected void createSourceGroup(Composite parent) {
createDirectorySelectionGroup(parent);
validateSourceGroup();
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.WizardResourceImportPage#createFileSelectionGroup(org.eclipse.swt.widgets.Composite)
+ */
@Override
protected void createFileSelectionGroup(Composite parent) {
});
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.WizardResourceImportPage#getFolderProvider()
+ */
@Override
protected ITreeContentProvider getFolderProvider() {
return null;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.WizardResourceImportPage#getFileProvider()
+ */
@Override
protected ITreeContentProvider getFileProvider() {
return new WorkbenchContentProvider() {
}
}
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.WizardResourceImportPage#getSelectedResources()
+ */
@Override
protected List<FileSystemElement> getSelectedResources() {
List<FileSystemElement> resources = new ArrayList<FileSystemElement>();
// Directory Selection Group (forked WizardFileSystemResourceImportPage1)
// ------------------------------------------------------------------------
+ /**
+ * The directory name field
+ */
protected Combo directoryNameField;
+ /**
+ * The directory browse button.
+ */
protected Button directoryBrowseButton;
private boolean entryChanged = false;
+ /**
+ * creates the directory selection group.
+ * @param parent the parent composite
+ */
protected void createDirectorySelectionGroup(Composite parent) {
Composite directoryContainerGroup = new Composite(parent, SWT.NONE);
// Browse for the source directory
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.WizardResourceImportPage#handleEvent(org.eclipse.swt.widgets.Event)
+ */
@Override
public void handleEvent(Event event) {
if (event.widget == directoryBrowseButton) {
super.handleEvent(event);
}
+ /**
+ * Handle the button pressed event
+ */
protected void handleSourceDirectoryBrowseButtonPressed() {
String currentSource = directoryNameField.getText();
DirectoryDialog dialog = new DirectoryDialog(directoryNameField.getShell(), SWT.SAVE | SWT.SHEET);
private Button overwriteExistingResourcesCheckbox;
private Button createLinksInWorkspaceButton;
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.WizardDataTransferPage#createOptionsGroupButtons(org.eclipse.swt.widgets.Group)
+ */
@Override
protected void createOptionsGroupButtons(Group optionsGroup) {
// Determine if the finish button can be enabled
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.WizardDataTransferPage#validateSourceGroup()
+ */
@Override
public boolean validateSourceGroup() {
// Import the trace(s)
// ------------------------------------------------------------------------
+ /**
+ * Finish the import.
+ * @return <code>true</code> if successful else false
+ */
public boolean finish() {
// Ensure source is valid
File sourceDir = new File(getSourceDirectoryName());
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.osgi.util.NLS;
+/**
+ * Message string for TMF model handling.
+ * @version 1.0
+ * @author Francois Chouinard
+ *
+ */
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.project.wizards.messages"; //$NON-NLS-1$
public static String NewProjectWizard_DialogHeader;
public static String NewProjectWizard_DialogMessage;
-
public static String ImportTraceWizard_DialogTitle;
public static String ImportTraceWizard_FileSystemTitle;
public static String ImportTraceWizard_ImportTrace;
/*******************************************************************************
- * Copyright (c) 2009, 2011 Ericsson
+ * Copyright (c) 2009, 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.dialogs.SelectionStatusDialog;
/**
- * <b><u>NewExperimentHandler</u></b>
+ * Implementation of new experiment dialog that creates the experiment element.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
+
*/
public class NewExperimentDialog extends SelectionStatusDialog {
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor
+ * @param shell The parent shell
+ * @param experimentFolder The parent experiment folder element
+ */
public NewExperimentDialog(Shell shell, TmfExperimentFolder experimentFolder) {
super(shell);
fExperimentFolder = experimentFolder.getResource();
// ------------------------------------------------------------------------
// Dialog
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
// ------------------------------------------------------------------------
// SelectionStatusDialog
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#computeResult()
+ */
@Override
protected void computeResult() {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#create()
+ */
@Override
public void create() {
super.create();
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
+ */
@Override
protected void okPressed() {
IFolder folder = createNewExperiment(fExperimentName.getText());
/*******************************************************************************
- * Copyright (c) 2009 Ericsson
+ * Copyright (c) 2009, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
/**
- * <b><u>NewProjectMainWizardPage</u></b>
+ * The wizard page for creation of a new TMF tracing project.
* <p>
- *
- * TODO: Implement me. Please.
+ * @version 1.0
+ * @author Francois Chouinard
+
*/
public class NewTmfProjectMainWizardPage extends WizardNewProjectCreationPage {
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
/**
- * <b><u>NewTmfProjectWizard</u></b>
+ * Wizard implementation for creating a TMF tracing project.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class NewTmfProjectWizard extends Wizard implements INewWizard, IExecutableExtension {
private final String fTtitle;
private final String fDescription;
+ /**
+ * Wizard main page
+ */
protected NewTmfProjectMainWizardPage fMainPage;
+ /**
+ * The Project name
+ */
protected String fProjectName;
+ /**
+ * The project location
+ */
protected URI fProjectLocation;
+ /**
+ * The configuration element.
+ */
protected IConfigurationElement fConfigElement;
+ /**
+ * The project reference
+ */
protected IProject fProject;
/**
- *
+ * Default constructor
*/
public NewTmfProjectWizard() {
this(Messages.NewProjectWizard_DialogHeader, Messages.NewProjectWizard_DialogMessage);
}
/**
- * @param title
- * @param desc
+ * Constructor
+ * @param title The tile string
+ * @param desc The description string
*/
public NewTmfProjectWizard(String title, String desc) {
super();
return true;
}
- /**
- * @param projectName
- * @param projectLocation
- * @param monitor
- * @return
- */
private IProject createProject(String projectName, URI projectLocation, IProgressMonitor monitor) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
// IExecutableExtension
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ */
@Override
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
fConfigElement = config;
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.dialogs.SelectionStatusDialog;
/**
- * <b><u>RenameExperimentDialog</u></b>
- * <p>
+ * Implementation of a dialog box to rename an experiment.
+ * <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class RenameExperimentDialog extends SelectionStatusDialog {
// Constructor
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ * @param shell The parent shell
+ * @param experiment The experiment element rename
+ */
public RenameExperimentDialog(Shell shell, TmfExperimentElement experiment) {
super(shell);
fExperiment = experiment;
// ------------------------------------------------------------------------
// Dialog
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
// ------------------------------------------------------------------------
// SelectionStatusDialog
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#computeResult()
+ */
@Override
protected void computeResult() {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#create()
+ */
@Override
public void create() {
super.create();
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
+ */
@Override
protected void okPressed() {
IFolder folder = renameExperiment(fNewExperimentName.getText());
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.dialogs.SelectionStatusDialog;
/**
- * <b><u>RenameTraceDialog</u></b>
- * <p>
+ * Implementation of a dialog box to rename a trace.
+ * <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class RenameTraceDialog extends SelectionStatusDialog {
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor
+ * @param shell The parent shell
+ * @param trace The trace element to rename
+ */
public RenameTraceDialog(Shell shell, TmfTraceElement trace) {
super(shell);
fTrace = trace;
// ------------------------------------------------------------------------
// Dialog
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
});
}
+ /**
+ * Returns the new trace name
+ * @return the new trace name
+ */
public String getNewTraceName() {
return fNewTraceName;
}
// ------------------------------------------------------------------------
// SelectionStatusDialog
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#computeResult()
+ */
@Override
protected void computeResult() {
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#create()
+ */
@Override
public void create() {
super.create();
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#okPressed()
+ */
@Override
protected void okPressed() {
IResource trace = renameTrace(fNewTraceNameText.getText());
/*******************************************************************************
- * Copyright (c) 2009, 2010, 2011 Ericsson
+ * Copyright (c) 2009, 2010, 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.IWorkbench;
/**
- * <b><u>SelectTracesWizard</u></b>
+ * Wizard implementation to select traces for an experiment.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class SelectTracesWizard extends Wizard implements IImportWizard {
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor
+ * @param project The project model element
+ * @param experiment The experiemnt model element
+ */
public SelectTracesWizard(TmfProjectElement project, TmfExperimentElement experiment) {
fProject = project;
fExperiment = experiment;
// Wizard
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
setWindowTitle(Messages.SelectTracesWizard_WindowTitle);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
@Override
public void addPages() {
super.addPages();
addPage(fSelectTraceWizardPage);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
@Override
public boolean performFinish() {
return fSelectTraceWizardPage.performFinish();
/*******************************************************************************
- * Copyright (c) 2009, 2010, 2011 Ericsson
+ * Copyright (c) 2009, 2010, 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.swt.widgets.TableColumn;
/**
- * <b><u>SelectTracesWizardPage</u></b>
+ * Implementation of a wizard page for selecting trace for an experiment.
* <p>
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class SelectTracesWizardPage extends WizardPage {
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor
+ * @param project The project model element.
+ * @param experiment The experiment model experiment.
+ */
protected SelectTracesWizardPage(TmfProjectElement project, TmfExperimentElement experiment) {
super(""); //$NON-NLS-1$
setTitle(Messages.SelectTracesWizardPage_WindowTitle);
// ------------------------------------------------------------------------
// Dialog
// ------------------------------------------------------------------------
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
}
}
+ /**
+ * Method to finalize the select operation.
+ * @return <code>true</code> if successful else <code>false</code>
+ */
public boolean performFinish() {
IFolder experiment = fExperiment.getResource();
* Contributors:
* Francois Chouinard - Initial API and implementation
* Bernd Hufmann - Changed to updated histogram data model
- * Francois Chouinard - Initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.histogram;
import org.eclipse.swt.widgets.Display;
/**
- * <b><u>FullTraceHistogram</u></b>
- * <p>
* A histogram that displays the full trace.
* <p>
* It also features a selected range window that can be dragged and zoomed.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class FullTraceHistogram extends Histogram implements MouseMoveListener {
// Construction
// ------------------------------------------------------------------------
+ /**
+ * Standard Constructor.
+ *
+ * @param view A reference to the parent histogram view
+ * @param parent A reference to the parent composite
+ */
public FullTraceHistogram(HistogramView view, Composite parent) {
super(view, parent);
fZoom = new HistogramZoom(this, fCanvas, getStartTime(), getTimeLimit());
// Operations
// ------------------------------------------------------------------------
+ /**
+ * Sets the time range of the full histogram.
+ *
+ * @param startTime A start time
+ * @param endTime A end time
+ */
public void setFullRange(long startTime, long endTime) {
fZoom.setFullRange(startTime, endTime);
}
+ /**
+ * Sets the selected time range.
+ *
+ * @param startTime A start time
+ * @param duration A window duration
+ */
public void setTimeRange(long startTime, long duration) {
fRangeStartTime = startTime;
fRangeDuration = duration;
import org.eclipse.swt.widgets.Text;
/**
- * <b><u>Histogram</u></b>
- * <p>
- * Re-usable histogram widget with the following features:
+ * Re-usable histogram widget.
+ *
+ * It has the following features:
* <ul>
* <li>Y-axis labels displaying min/max count values
* <li>X-axis labels displaying time range
* <li>end of the time range
* <li>number of events in that time range
* </ul>
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public abstract class Histogram implements ControlListener, PaintListener, KeyListener, MouseListener, MouseTrackListener, IHistogramModelListener {
private final Color fHistoBarColor = new Color(Display.getDefault(), 74, 112, 139);
// Timestamp scale (nanosecond)
+ /**
+ * The time scale of the histogram (nano seconds)
+ */
public static final byte TIME_SCALE = -9;
+ /**
+ * The histogram bar width (number of pixels).
+ */
public static final int HISTOGRAM_BAR_WIDTH = 1;
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Owner view
+ /**
+ * The parent TMF view.
+ */
protected TmfView fParentView;
// Histogram text fields
private Text fTimeRangeStartText;
private Text fTimeRangeEndText;
- // Histogram drawing area
+ /**
+ * Histogram drawing area
+ */
protected Canvas fCanvas;
-
- // Data model
+ /**
+ * The histogram data model.
+ */
protected final HistogramDataModel fDataModel;
+ /**
+ * The histogram data model scaled to current resolution and screen width.
+ */
protected HistogramScaledData fScaledData;
protected long fCurrentEventTime = 0;
// Construction
// ------------------------------------------------------------------------
+ /**
+ * Standard constructor.
+ *
+ * @param view A reference to the parent TMF view.
+ * @param parent A parent composite
+ */
public Histogram(final TmfView view, final Composite parent) {
fParentView = view;
fCanvas.addMouseTrackListener(this);
}
+ /**
+ * Dispose resources and deregisters listeners.
+ */
public void dispose() {
fHistoBarColor.dispose();
fDataModel.removeHistogramListener(this);
// Accessors
// ------------------------------------------------------------------------
+ /**
+ * Returns the start time (equal first bucket time).
+ * @return the start time.
+ */
public long getStartTime() {
return fDataModel.getFirstBucketTime();
}
+ /**
+ * Returns the end time.
+ * @return the end time.
+ */
public long getEndTime() {
return fDataModel.getEndTime();
}
+ /**
+ * Returns the time limit (end of last bucket)
+ * @return the time limit.
+ */
public long getTimeLimit() {
return fDataModel.getTimeLimit();
}
+ /**
+ * Returns a data model reference.
+ * @return data model.
+ */
public HistogramDataModel getDataModel() {
return fDataModel;
}
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
+ /**
+ * Updates the time range.
+ * @param startTime A start time
+ * @param endTime A end time.
+ */
public abstract void updateTimeRange(long startTime, long endTime);
/**
// ------------------------------------------------------------------------
// PaintListener
// ------------------------------------------------------------------------
-
+ /**
+ * Image key string for the canvas.
+ */
protected final String IMAGE_KEY = "double-buffer-image"; //$NON-NLS-1$
@Override
import org.eclipse.swt.widgets.Composite;
/**
- * <b><u>HistogramCurrentTimeControl</u></b>
- * <p>
* This control provides a group containing a text control.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class HistogramCurrentTimeControl extends HistogramTextControl {
// Construction
// ------------------------------------------------------------------------
+ /**
+ * Constructor with default group and text value.
+ *
+ * @param parentView A parent histogram view
+ * @param parent A parent composite to draw in
+ * @param textStyle A test style
+ * @param groupStyle A group style
+ */
public HistogramCurrentTimeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle) {
this(parentView, parent, textStyle, groupStyle, "", HistogramUtils.nanosecondsToString(0L)); //$NON-NLS-1$
}
+ /**
+ *
+ * Constructor
+ * @param parentView A parent histogram view
+ * @param parent A parent composite to draw in
+ * @param textStyle A test style
+ * @param groupStyle A group style
+ * @param groupValue A group value
+ * @param textValue A text value
+ */
public HistogramCurrentTimeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle, String groupValue, String textValue) {
super(parentView, parent, textStyle, groupStyle, groupValue, textValue);
}
import org.eclipse.core.runtime.ListenerList;
/**
- * <b><u>HistogramDataModel</u></b>
- * <p>
- * Histogram-independent data model with the following characteristics:
+ * Histogram-independent data model.
+ *
+ * It has the following characteristics:
* <ul>
* <li>The <i>basetime</i> is the timestamp of the first event
* <li>There is a fixed number (<i>n</i>) of buckets of uniform duration
* respect to to the number of pixels in the actual histogram, we should achieve
* a nice result when visualizing the histogram.
* <p>
- * TODO: Add filter support for more refined event counting (e.g. by trace,
- * event type, etc.)
- * <p>
- * TODO: Cut-off eccentric values? TODO: Support for going back in time?
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class HistogramDataModel implements IHistogramDataModel {
// Constants
// ------------------------------------------------------------------------
- // The default number of buckets
+ /**
+ * The default number of buckets
+ */
public static final int DEFAULT_NUMBER_OF_BUCKETS = 16 * 1000;
+ /**
+ * Number of events after which listeners will be notified.
+ */
public static final int REFRESH_FREQUENCY = DEFAULT_NUMBER_OF_BUCKETS;
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Default constructor with default number of buckets.
+ */
public HistogramDataModel() {
this(DEFAULT_NUMBER_OF_BUCKETS);
}
+ /**
+ * Constructor with non-default number of buckets.
+ * @param nbBuckets A number of buckets.
+ */
public HistogramDataModel(int nbBuckets) {
fNbBuckets = nbBuckets;
fBuckets = new long[nbBuckets];
clear();
}
+ /**
+ * Copy constructor.
+ * @param other A model to copy.
+ */
public HistogramDataModel(HistogramDataModel other) {
fNbBuckets = other.fNbBuckets;
fBuckets = Arrays.copyOf(other.fBuckets, fNbBuckets);
// Accessors
// ------------------------------------------------------------------------
+ /**
+ * Returns the number of events in the data model.
+ * @return number of events.
+ */
public long getNbEvents() {
return fNbEvents;
}
+ /**
+ * Returns the number of buckets in the model.
+ * @return number of buckets.
+ */
public int getNbBuckets() {
return fNbBuckets;
}
+ /**
+ * Returns the current bucket duration.
+ * @return bucket duration
+ */
public long getBucketDuration() {
return fBucketDuration;
}
+ /**
+ * Returns the time value of the first bucket in the model.
+ * @return time of first bucket.
+ */
public long getFirstBucketTime() {
return fFirstBucketTime;
}
+ /**
+ * Returns the time of the first event in the model.
+ * @return time of first event.
+ */
public long getStartTime() {
return fFirstEventTime;
}
+ /**
+ * Returns the time of the last event in the model.
+ * @return the time of last event.
+ */
public long getEndTime() {
return fLastEventTime;
}
+ /**
+ * Returns the time of the current event in the model.
+ * @return the time of the current event.
+ */
public long getCurrentEventTime() {
return fCurrentEventTime;
}
+ /**
+ * Returns the time limit with is: start time + nbBuckets * bucketDuration
+ * @return the time limit.
+ */
public long getTimeLimit() {
return fTimeLimit;
}
// Listener handling
// ------------------------------------------------------------------------
+ /**
+ * Add a listener to the model to be informed about model changes.
+ * @param listener A listener to add.
+ */
public void addHistogramListener(IHistogramModelListener listener) {
fModelListeners.add(listener);
}
+ /**
+ * Remove a given model listener.
+ * @param listener A listener to remove.
+ */
public void removeHistogramListener(IHistogramModelListener listener) {
fModelListeners.remove(listener);
}
+ // Notify listeners (always)
private void fireModelUpdateNotification() {
fireModelUpdateNotification(0);
}
+ // Notify listener on boundary
private void fireModelUpdateNotification(long count) {
if ((count % REFRESH_FREQUENCY) == 0) {
Object[] listeners = fModelListeners.getListeners();
// Operations
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.views.distribution.model.IBaseDistributionModel#complete()
+ */
@Override
public void complete() {
fireModelUpdateNotification();
/**
* Clear the histogram model.
+ * @see org.eclipse.linuxtools.tmf.ui.views.distribution.model.IBaseDistributionModel#clear()
*/
@Override
public void clear() {
}
/**
- * Sets the current event time
+ * Sets the current event time (no notification of listeners)
*
- * @param timestamp
+ * @param timestamp A time stamp to set.
*/
public void setCurrentEvent(long timestamp) {
fCurrentEventTime = timestamp;
}
/**
- * Sets the current event time
+ * Sets the current event time with notification of listeners
*
- * @param timestamp
+ * @param timestamp A time stamp to set.
*/
public void setCurrentEventNotifyListeners(long timestamp) {
fCurrentEventTime = timestamp;
/**
* Add event to the correct bucket, compacting the if needed.
*
- * @param timestamp the timestamp of the event to count
+ * @param eventCount The current event Count (for notification purposes)
+ * @param timestamp The timestamp of the event to count
+ *
*/
@Override
public void countEvent(long eventCount, long timestamp) {
/**
* Scale the model data to the width, height and bar width requested.
*
- * @param width
- * @param height
- * @param barWidth
- * @return the result array of size [width] and where the highest value
- * doesn't exceed [height]
+ * @param width A width of the histogram canvas
+ * @param height A height of the histogram canvas
+ * @param barWidth A width (in pixel) of a histogram bar
+ * @return the result array of size [width] and where the highest value doesn't exceed [height]
+ *
+ * @see org.eclipse.linuxtools.tmf.ui.views.histogram.IHistogramDataModel#scaleTo(int, int, int)
*/
@Override
public HistogramScaledData scaleTo(int width, int height, int barWidth) {
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
/**
- * <b><u>HistogramRequest</u></b>
+ * Class to request events for given time range from a trace to fill a HistogramDataModel and HistogramView.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
* <p>
*/
public class HistogramRequest extends TmfEventRequest<ITmfEvent> {
// Attributes
// ------------------------------------------------------------------------
+ /**
+ * The histogram data model to fill.
+ */
protected final HistogramDataModel fHistogram;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
+ /**
+ * Constructor
+ * @param histogram The histogram data model
+ * @param range The time range to request data
+ * @param rank The index of the first event to retrieve
+ * @param nbEvents The number of events requested
+ * @param blockSize the number of events per block
+ * @param priority the requested execution priority
+ *
+ */
public HistogramRequest(HistogramDataModel histogram, TmfTimeRange range, int rank, int nbEvents, int blockSize, ITmfDataRequest.ExecutionType execType) {
super(ITmfEvent.class, range, rank, nbEvents, (blockSize > 0) ? blockSize : ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, execType);
fHistogram = histogram;
// ------------------------------------------------------------------------
// TmfEventRequest
// ------------------------------------------------------------------------
-
+
+ /**
+ * Handle the event from the trace by updating the histogram data model.
+ *
+ * @param event a event from the trace
+ * @see org.eclipse.linuxtools.tmf.core.request.TmfDataRequest#handleData(org.eclipse.linuxtools.tmf.core.event.ITmfEvent)
+ */
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
}
}
+ /**
+ * Complete the request. It also notifies the histogram model about the completion.
+ *
+ * @see org.eclipse.linuxtools.tmf.core.request.TmfDataRequest#handleCompleted()
+ */
@Override
public void handleCompleted() {
fHistogram.complete();
super.handleCompleted();
}
-
- @Override
- public void handleCancel() {
- super.handleCancel();
- }
-
}
import java.util.Arrays;
/**
- * <b><u>HistogramScaledData</u></b>
- * <p>
* Convenience class/struct for scaled histogram data.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class HistogramScaledData {
// Constants
// ------------------------------------------------------------------------
+ /**
+ * Indicator value that bucket is out of range (not filled).
+ */
public static final int OUT_OF_RANGE_BUCKET = -1;
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
-
+ /**
+ * Width of histogram canvas (number of pixels).
+ */
public int fWidth;
+ /**
+ * Height of histogram canvas (number of pixels).
+ */
public int fHeight;
+ /**
+ * Width of one histogram bar (number of pixels).
+ */
public int fBarWidth;
+ /**
+ * Array of scaled values
+ */
public int[] fData;
+ /**
+ * The bucket duration of a scaled data bucket.
+ */
public long fBucketDuration;
+ /**
+ * The maximum number of events of all buckets.
+ */
public long fMaxValue;
+ /**
+ * The index of the current bucket.
+ */
public int fCurrentBucket;
+ /**
+ * The index of the last bucket.
+ */
public int fLastBucket;
+ /**
+ * The scaling factor used to fill the scaled data.
+ */
public double fScalingFactor;
+ /**
+ * Time of first bucket.
+ */
public long fFirstBucketTime;
+ /**
+ * The time of the first event.
+ */
public long fFirstEventTime;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
+ /**
+ * Constructor.
+ * @param width the canvas width
+ * @param height the canvas height
+ * @param barWidth the required bar width
+ */
public HistogramScaledData(int width, int height, int barWidth) {
fWidth = width;
fHeight = height;
fFirstBucketTime = 0;
}
+ /**
+ * Copy constructor
+ * @param other another scaled data.
+ */
public HistogramScaledData(HistogramScaledData other) {
fWidth = other.fWidth;
fHeight = other.fHeight;
// Setter and Getter
// ------------------------------------------------------------------------
+ /**
+ * Returns the time of the first bucket of the scaled data.
+ * @return the time of the first bucket.
+ */
public long getFirstBucketTime() {
return fFirstBucketTime;
}
+ /**
+ * Set the first event time.
+ * @param firstEventTime
+ */
public void setFirstBucketTime(long firstEventTime) {
fFirstBucketTime = firstEventTime;
}
+ /**
+ * Returns the time of the last bucket.
+ * @return last bucket time
+ */
public long getLastBucketTime() {
return getBucketStartTime(fLastBucket);
}
+ /**
+ * Returns the time of the bucket start time for given index.
+ * @param index A bucket index.
+ * @return the time of the bucket start time
+ */
public long getBucketStartTime(int index) {
return fFirstBucketTime + index * fBucketDuration;
}
+ /**
+ * Returns the time of the bucket end time for given index.
+ * @param index A bucket index.
+ * @return the time of the bucket end time
+ */
public long getBucketEndTime(int index) {
return getBucketStartTime(index) + fBucketDuration;
}
-
}
\ No newline at end of file
import org.eclipse.swt.widgets.Text;
/**
- * <b><u>HistogramTextControl</u></b>
- * <p>
* This control provides a group containing a text control.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public abstract class HistogramTextControl implements FocusListener, KeyListener {
// Attributes
// ------------------------------------------------------------------------
+ /**
+ * The parent histogram view.
+ */
protected final HistogramView fParentView;
private final Composite fParent;
// Controls
private final Group fGroup;
+ /**
+ * The text value field.
+ */
protected final Text fTextValue;
private long fValue;
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Constructor default values
+ *
+ * @param parentView The parent histogram view.
+ * @param parent The parent composite
+ * @param textStyle The text style bits.
+ * @param groupStyle The group style bits.
+ *
+ */
public HistogramTextControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle) {
this(parentView, parent, textStyle, groupStyle, "", HistogramUtils.nanosecondsToString(0L)); //$NON-NLS-1$
}
+ /**
+ * Constructor with given group and text values.
+ *
+ * @param parentView The parent histogram view.
+ * @param parent The parent composite
+ * @param textStyle The text style bits.
+ * @param groupStyle The group style bits.
+ * @param groupValue A group value
+ * @param textValue A text value
+ */
public HistogramTextControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle, String groupValue, String textValue) {
fParentView = parentView;
// Accessors
// ------------------------------------------------------------------------
- // State
+ /**
+ * Returns if widget isDisposed or not
+ * @return <code>true</code> if widget is disposed else <code>false</code>
+ */
public boolean isDisposed() {
return fGroup.isDisposed();
}
// Operations
// ------------------------------------------------------------------------
+ /**
+ * Updates the text value.
+ */
protected abstract void updateValue();
- // LayoutData
+ /**
+ * Set the Grid Layout Data for the group.
+ * @param layoutData A GridData to set.
+ */
public void setLayoutData(GridData layoutData) {
fGroup.setLayoutData(layoutData);
}
- // Time value
+ /**
+ * Sets the value converted to nano-seconds in the text field.
+ * @param timeString the time string (input)
+ */
public void setValue(String timeString) {
long timeValue = HistogramUtils.stringToNanoseconds(timeString);
setValue(timeValue);
}
+ /**
+ * The time value in nano-seconds to set in the text field.
+ * @param time the time to set
+ */
public void setValue(final long time) {
// If this is the UI thread, process now
Display display = Display.getCurrent();
});
}
}
-
+
+ /**
+ * Returns the time value.
+ * @return time value.
+ */
public long getValue() {
return fValue;
}
// FocusListener
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events.FocusEvent)
+ */
@Override
public void focusGained(FocusEvent event) {
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events.FocusEvent)
+ */
@Override
public void focusLost(FocusEvent event) {
updateValue();
// KeyListener
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
+ */
@Override
public void keyPressed(KeyEvent event) {
switch (event.keyCode) {
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
+ */
@Override
public void keyReleased(KeyEvent e) {
}
import org.eclipse.swt.widgets.Composite;
/**
- * <b><u>HistogramTimeRangeControl</u></b>
- * <p>
* This control provides a group containing a text control.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class HistogramTimeRangeControl extends HistogramTextControl {
// ------------------------------------------------------------------------
// Construction
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor default values
+ * @param parentView The parent histogram view.
+ * @param parent The parent composite
+ * @param textStyle The text style bits.
+ * @param groupStyle The group style bits.
+ */
public HistogramTimeRangeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle) {
this(parentView, parent, textStyle, groupStyle, "", HistogramUtils.nanosecondsToString(0L)); //$NON-NLS-1$
}
+ /**
+ * Constructor with given group and text values.
+ *
+ * @param parentView The parent histogram view.
+ * @param parent The parent composite
+ * @param textStyle The text style bits.
+ * @param groupStyle The group style bits.
+ * @param groupValue A group value
+ * @param textValue A text value
+ */
public HistogramTimeRangeControl(HistogramView parentView, Composite parent, int textStyle, int groupStyle, String groupValue, String textValue) {
super(parentView, parent, textStyle, groupStyle, groupValue, textValue);
}
// Operations
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.views.histogram.HistogramTextControl#updateValue()
+ */
@Override
protected void updateValue() {
String stringValue = fTextValue.getText();
import org.eclipse.swt.widgets.Composite;
/**
- * <b><u>HistogramUtils</u></b>
- * <p>
* Bunch of conversion utilities.
+ *
+ * @version 1.0
+ * @author Francois Chouinard
* <p>
*/
public abstract class HistogramUtils {
// Constants
// ------------------------------------------------------------------------
- // The view ID as defined in plugin.xml
+ /**
+ * The view ID as defined in plugin.xml
+ */
public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.histogram"; //$NON-NLS-1$
- // The initial window span (in nanoseconds)
+ /**
+ * The initial window span (in nanoseconds)
+ */
public static final long INITIAL_WINDOW_SPAN = (1L * 100 * 1000 * 1000); // .1sec
// Time scale
// Constructor
// ------------------------------------------------------------------------
+ /**
+ * Default constructor
+ */
public HistogramView() {
super(ID);
}
// Accessors
// ------------------------------------------------------------------------
+ /**
+ * Returns the time range of the current selected window (base on default time scale).
+ *
+ * @return the time range of current selected window.
+ */
public TmfTimeRange getTimeRange() {
return new TmfTimeRange(new TmfTimestamp(fWindowStartTime, TIME_SCALE), new TmfTimestamp(fWindowEndTime,
TIME_SCALE));
// Operations
// ------------------------------------------------------------------------
+ /**
+ * Broadcast TmfSignal about new current time value.
+ * @param newTime the new current time.
+ */
public void updateCurrentEventTime(long newTime) {
if (fCurrentExperiment != null) {
TmfTimeRange timeRange = new TmfTimeRange(new TmfTimestamp(newTime, TIME_SCALE), TmfTimestamp.BIG_CRUNCH);
}
}
+ /**
+ * Broadcast TmfSignal about new selected time range.
+ * @param startTime the new start time
+ * @param endTime the new end time
+ */
public void updateTimeRange(long startTime, long endTime) {
if (fCurrentExperiment != null) {
// Build the new time range; keep the current time
}
}
+ /**
+ * Broadcast TmfSignal about new selected time range.
+ * @param newDuration new duration (relative to current start time)
+ */
public synchronized void updateTimeRange(long newDuration) {
if (fCurrentExperiment != null) {
long delta = newDuration - fWindowSpan;
// Signal handlers
// ------------------------------------------------------------------------
+ /**
+ * Handles experiment selected signal. Loads histogram if new experiment time range is not
+ * equal <code>TmfTimeRange.NULL_RANGE</code>
+ * @param signal the experiment selected signal
+ */
@TmfSignalHandler
@SuppressWarnings("unchecked")
public void experimentSelected(TmfExperimentSelectedSignal<ITmfEvent> signal) {
fParent.redraw();
}
+ /**
+ * Handles experiment range updated signal. Extends histogram according to the new time range. If a
+ * HistogramRequest is already ongoing, it will be cancelled and a new request with the new range
+ * will be issued.
+ *
+ * @param signal the experiment range updated signal
+ */
@TmfSignalHandler
public void experimentRangeUpdated(TmfExperimentRangeUpdatedSignal signal) {
sendFullRangeRequest(fullRange);
}
+ /**
+ * Handles the experiment updated signal. Used to update time limits (start and end time)
+ * @param signal the experiment updated signal
+ */
@TmfSignalHandler
public void experimentUpdated(TmfExperimentUpdatedSignal signal) {
if (signal.getExperiment() != fCurrentExperiment) {
fTimeRangeHistogram.setFullRange(fExperimentStartTime, fExperimentEndTime);
}
+ /**
+ * Handles the current time updated signal. Sets the current time in the time range
+ * histogram as well as the full histogram.
+ *
+ * @param signal the signal to process
+ */
@TmfSignalHandler
public void currentTimeUpdated(TmfTimeSynchSignal signal) {
// Because this can't happen :-)
fCurrentEventTimeControl.setValue(fCurrentTimestamp);
}
+ /**
+ * Updates the current time range in the time range histogram and full range histogram.
+ * @param signal the signal to process
+ */
@TmfSignalHandler
public void timeRangeUpdated(TmfRangeSynchSignal signal) {
// Because this can't happen :-)
import org.eclipse.swt.widgets.Canvas;
/**
- * <b><u>HistogramZoom</u></b>
+ * Class to handle zooming within histogram windows..
+ *
+ * @version 1.0
+ * @author Francois Chouinard
* <p>
*/
public class HistogramZoom implements MouseWheelListener {
// Accessors
// ------------------------------------------------------------------------
+ /**
+ * Get start time of the zoom window.
+ * @return the start time.
+ */
public synchronized long getStartTime() {
return fRangeStartTime;
}
+ /**
+ * Get the end time of the zoom window.
+ * @return the end time
+ */
public synchronized long getEndTime() {
return fRangeStartTime + fRangeDuration;
}
+ /**
+ * Get the duration of the zoom window.
+ * @return the duration of the zoom window.
+ */
public synchronized long getDuration() {
return fRangeDuration;
}
// Operations
// ------------------------------------------------------------------------
+ /**
+ * Stops the zooming (multiple consecutive execution)
+ */
public synchronized void stop() {
if (fScrollCounter != null) {
fScrollCounter.interrupt();
}
}
+ /**
+ * The the full time range of the histogram
+ *
+ * @param startTime the start time the histogram
+ * @param endTime the end time of the histogram
+ */
public synchronized void setFullRange(long startTime, long endTime) {
fAbsoluteStartTime = startTime;
fAbsoluteEndTime = endTime;
}
+ /**
+ * Sets the new zoom window
+ * @param startTime the start time
+ * @param duration the duration
+ */
public synchronized void setNewRange(long startTime, long duration) {
if (startTime < fAbsoluteStartTime)
startTime = fAbsoluteStartTime;
// Constructors
// --------------------------------------------------------------------
+ /**
+ * Constructor of inner class to handle consecutive scrolls of mouse wheel.
+ * @param zoom the histogram zoom reference
+ */
public MouseScrollCounter(HistogramZoom zoom) {
fZoom = zoom;
fLastPoolTime = System.currentTimeMillis();
// --------------------------------------------------------------------
// Operation
// --------------------------------------------------------------------
-
+
+ /**
+ * Increments the number of scroll clicks.
+ * @param nbScrolls the number to add to the current value
+ */
public void incrementMouseScroll(int nbScrolls) {
fLastPoolTime = System.currentTimeMillis();
nbScrollClick += nbScrolls;
import org.eclipse.linuxtools.tmf.ui.views.distribution.model.IBaseDistributionModel;
/**
- * <b><u>IHistogramDataModel</u></b>
- * <p>
+ * Histogram data model interface.
+ *
+ * @version 1.0
+ * @author Bernd Hufmann
*/
-
public interface IHistogramDataModel extends IBaseDistributionModel {
/**
* Add event to the correct bucket, compacting the if needed.
*
- * @param eventCount the event to count
+ * @param eventCount the event to count
* @param timestamp the timestamp of the event to count
*/
public void countEvent(long eventCount, long timestamp);
-
/**
* Scale the model data to the width, height and bar width requested.
- *
- * @param width
- * @param height
- * @param barWidth
- * @return the result array of size [width] and where the highest value
- * doesn't exceed [height] considering the bar width [barWidth]
+ *
+ * @param width A width of the histogram canvas
+ * @param height A height of the histogram canvas
+ * @param barWidth A width (in pixel) of a histogram bar
+ * @return the result array of size [width] and where the highest value doesn't exceed [height]
+ * while considering the bar width [barWidth]
*/
public HistogramScaledData scaleTo(int width, int height, int barWidth);
package org.eclipse.linuxtools.tmf.ui.views.histogram;
/**
- * <b><u>IHistogramModelListener</u></b>
- * <p>
+ * Listener interface for receiving histogram data model notifications.
+ *
+ * @version 1.0
+ * @author Bernd Hufmann
*/
public interface IHistogramModelListener {
/**
- * Method to notify listeners about model updates
+ * Method to implement to receive notification about model updates.
*/
public void modelUpdated();
}
import org.eclipse.osgi.util.NLS;
/**
- * <b><u>Messages</u></b>
+ * Messages file for the histogram widgets.
* <p>
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.views.histogram.messages"; //$NON-NLS-1$
+ /**
+ * The label for the current event time
+ */
public static String HistogramView_currentEventLabel;
+ /**
+ * The label for the window span.
+ */
public static String HistogramView_windowSpanLabel;
// ------------------------------------------------------------------------
import org.eclipse.swt.widgets.Composite;
/**
- * <b><u>TimeRangeHistogram</u></b>
* <p>
* A basic histogram with the following additional features:
* <ul>
* <li>zoom in: mouse wheel up (or forward)
* <li>zoom out: mouse wheel down (or backward)
* </ul>
+ *
+ * @version 1.0
+ * @author Francois Chouinard
*/
public class TimeRangeHistogram extends Histogram {
// Attributes
// ------------------------------------------------------------------------
- HistogramZoom fZoom = null;
+ private HistogramZoom fZoom = null;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
-
+ /**
+ * Constructor
+ * @param view The parent histogram view
+ * @param parent The parent composite
+ */
public TimeRangeHistogram(HistogramView view, Composite parent) {
super(view, parent);
fZoom = new HistogramZoom(this, fCanvas, getStartTime(), getTimeLimit());
// Operations
// ------------------------------------------------------------------------
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.views.histogram.Histogram#updateTimeRange(long, long)
+ */
@Override
public void updateTimeRange(long startTime, long endTime) {
((HistogramView) fParentView).updateTimeRange(startTime, endTime);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.tmf.ui.views.histogram.Histogram#clear()
+ */
@Override
public synchronized void clear() {
if (fZoom != null)
super.clear();
}
+ /**
+ * Sets the time range of the histogram
+ * @param startTime The start time
+ * @param duration The duration of the time range
+ */
public synchronized void setTimeRange(long startTime, long duration) {
fZoom.setNewRange(startTime, duration);
}
+ /**
+ * Sets the full time range of the whole trace.
+ * @param startTime The start time
+ * @param endTime The end time
+ */
public void setFullRange(long startTime, long endTime) {
long currentFirstEvent = getStartTime();
fZoom.setFullRange((currentFirstEvent == 0) ? startTime : currentFirstEvent, endTime);
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
/**
* This class provides an extension for updating data model and to pass along more information beside events
+ *
+ * @version 1.0
+ * @author Mathieu Denis
*/
public interface ITmfExtraEventInfo {
+ /**
+ * Returns the trace name.
+ * @return the name of the trace.
+ */
public String getTraceName();
}
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.osgi.util.NLS;
+/**
+ * Messages file for statistics view strings.
+ *
+ * @version 1.0
+ * @author Mathieu Denis
+ *
+ */
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.views.statistics.messages"; //$NON-NLS-1$
+ /**
+ * Level column name
+ */
public static String TmfStatisticsView_LevelColumn;
+ /**
+ * Level column tool tip.
+ */
public static String TmfStatisticsView_LevelColumnTip;
+ /**
+ * Number of events column name.
+ */
public static String TmfStatisticsView_NbEventsColumn;
+ /**
+ * Number of events column tool tip.
+ */
public static String TmfStatisticsView_NbEventsTip;
+ /**
+ * String for unknown trace name.
+ */
public static String TmfStatisticsView_UnknownTraceName;
static {
// initialize resource bundle
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 20112 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Generalized version based on LTTng
+ * Mathieu Denis (mathieu.denis@polymtl.ca) - Generalized version based on LTTng
* Bernd Hufmann - Updated to use trace reference in TmfEvent and streaming
+ *
+ * @version 1.0
+ * @author Mathieu Denis
+ *
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics;
import org.eclipse.swt.widgets.Listener;
/**
- * <b><u>TmfStatisticsView</u></b>
- * <p>
* The generic Statistics View displays statistics for any kind of traces.
*
* It is implemented according to the MVC pattern. - The model is a TmfStatisticsTreeNode built by the State Manager. - The view is built with a
* TreeViewer. - The controller that keeps model and view synchronized is an observer of the model.
* </p>
+ *
+ *
*/
public class TmfStatisticsView extends TmfView {
/**
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Mathieu Denis (mathieu.denis@polymtl.ca) - Implementation and Initial API
+ * Mathieu Denis (mathieu.denis@polymtl.ca) - Implementation and Initial API
+ *
*******************************************************************************/
package org.eclipse.linuxtools.tmf.ui.views.statistics.model;
* It allow to implement a tree structure while avoiding the need to run through
* the tree each time you need to add a node at a given place.
* </p>
+ *
+ * @version 1.0
+ * @author Mathieu Denis
*/
public abstract class AbsTmfStatisticsTree {
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import java.util.List;
/**
- * <b><u>ITmfColumnDataProvider</u></b>
- * <p>
* Basic methods that must be implemented in a column data provider.
* </p>
+ * @version 1.0
+ * @author Mathieu Denis
*/
public interface ITmfColumnDataProvider {
/**
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.linuxtools.tmf.ui.views.statistics.model.TmfBaseColumnData.ITmfColumnPercentageProvider;
/**
- * Provide the basic interface to create a statistics column
+ * Provide the basic interface to create a statistics column for the statistics table tree.
+ *
+ * @version 1.0
+ * @author Mathieu Denis
*/
public interface ITmfStatisticsColumnData {
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.osgi.util.NLS;
+/**
+ * Message strings for the statistics framework.
+ *
+ * @version 1.0
+ * @author Mathieu Denis
+ *
+ */
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.linuxtools.tmf.ui.views.statistics.model.messages"; //$NON-NLS-1$
+ /**
+ * CPU statistic name.
+ */
public static String TmfStatisticsData_CPUs;
+ /**
+ * Event type statistic name.
+ */
public static String TmfStatisticsData_EventTypes;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
/**
* Contains all the information necessary to build a column of the table.
+ * @version 1.0
+ * @author Mathieu Denis
*/
public class TmfBaseColumnData implements ITmfStatisticsColumnData {
- // Name of the column.
+ /**
+ * Name of the column.
+ */
protected final String fHeader;
- // Width of the column.
+ /**
+ * Width of the column.
+ */
protected final int fWidth;
- // Alignment of the column.
+ /**
+ * Alignment of the column.
+ */
protected final int fAlignment;
- // Tooltip of the column.
+ /**
+ * Tooltip of the column.
+ */
protected final String fTooltip;
- // Adapts a StatisticsTreeNode into the content of it's corresponding
- // cell for that column.
+ /**
+ * Adapts a StatisticsTreeNode into the content of it's corresponding cell for that column.
+ */
protected final ColumnLabelProvider fLabelProvider;
- // Used to sort elements of this column. Can be null.
+ /**
+ * Used to sort elements of this column. Can be null.
+ */
protected final ViewerComparator fComparator;
- // Used to draw bar charts in this column. Can be null.
+ /**
+ * Used to draw bar charts in this column. Can be null.
+ */
protected final ITmfColumnPercentageProvider fPercentageProvider;
- // Used to draw bar charts in columns.
+ /**
+ * Used to draw bar charts in columns.
+ */
public interface ITmfColumnPercentageProvider {
public double getPercentage(TmfStatisticsTreeNode node);
}
/**
* Constructor with parameters
+ *
* @param h header of the column. The name will be shown at the top of the column.
* @param w width of the column.
* @param a alignment of the text
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2011 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.ui.PlatformUI;
/**
- * Create a basic list of columns with providers
+ * Create a basic list of columns with providers.
+ *
+ * @version 1.0
+ * @author Mathieu Denis
*/
public class TmfBaseColumnDataProvider implements ITmfColumnDataProvider {
* Contains the list of the columns
*/
protected List<TmfBaseColumnData> fColumnData = null;
-
/**
* Level column names
*/
* Number of events column names
*/
protected final static String EVENTS_COUNT_COLUMN = Messages.TmfStatisticsView_NbEventsColumn;
-
/**
* Level column tooltips
*/
* Number of events column tooltips
*/
protected final static String EVENTS_COUNT_COLUMN_TIP = Messages.TmfStatisticsView_NbEventsTip;
-
/**
* Level for which statistics should not be displayed.
*/
protected Set<String> fFolderLevels = new HashSet<String>(Arrays.asList(new String[] { "Event Types" })); //$NON-NLS-1$
-
/**
* Create basic columns to represent the statistics data
*/
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.linuxtools.tmf.ui.views.statistics.ITmfExtraEventInfo;
/**
- * <h4>Store information about base statistics data</h4>
+ * Store information about base statistics data.
* <p>This class provides a way to represent statistics data that is compatible to every kind of traces</p>
+ *
+ * @version 1.0
+ * @author Mathieu Denis
*/
public class TmfBaseStatisticsTree extends AbsTmfStatisticsTree {
* </p>
*/
protected static final String NODE = "z"; //$NON-NLS-1$
+ /**
+ * Root node key.
+ */
protected static final String ROOT_NODE_KEY = mergeString(ROOT.get(0), NODE);
+ /**
+ * Default constructor. Creates base statistics tree for counting total
+ * number of events and number of events per event type.
+ */
public TmfBaseStatisticsTree() {
super();
Map<String, Set<String>> keys = getKeys();
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
/**
* <h4>Primitive container for Statistics data</h4>
* <p>Contains information about statistics that can be retrieved with any kind of traces</p>
+ *
+ * @version 1.0
+ * @author Mathieu Denis
*/
public class TmfStatistics {
/**
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* <h4>A tree where nodes can be accessed efficiently using paths.</h4>
*
* <p>It works like file systems. Each node is identified by a key. A path is an array ({@link TmfFixedArray}) of String. The elements of the array represent the path from the root to this node.</p>
+ *
+ * @version 1.0
+ * @author Mathieu Denis
*/
public class TmfStatisticsTreeNode {
/**
import java.util.HashMap;
import java.util.Map;
+/**
+ * Factory class to create and store TMF statistic trees.
+ *
+ * Based on a given tree node ID a TMF statistic tree is stored internally.
+ * A root node is created for each tree. Using the tree node ID the statistics
+ * tree can be retrieved.
+ *
+ * @version 1.0
+ * @author Mathieu Denis
+ *
+ */
public class TmfStatisticsTreeRootFactory {
// -----------------------------------------------------------------------
/*******************************************************************************
- * Copyright (c) 2011 Ericsson
+ * Copyright (c) 2011, 2012 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
/**
* Adapter TreeViewers can use to interact with StatisticsTreeNode objects.
*
+ * @version 1.0
+ * @author Mathieu Denis
* @see org.eclipse.jface.viewers.ITreeContentProvider
*/
public class TmfTreeContentProvider implements ITreeContentProvider {