Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Hufmann2014-05-07 11:39:10 -0400
committerBernd Hufmann2014-05-09 11:18:33 -0400
commitec4c19b6b8386cd81806aaa9e9f914907109d578 (patch)
treee6d5ec1f051b95164755056fc405d2a34532fc1e
parentb74c4fbc591119302281435163defc25e264c2b7 (diff)
downloadorg.eclipse.linuxtools-ec4c19b6b8386cd81806aaa9e9f914907109d578.tar.gz
org.eclipse.linuxtools-ec4c19b6b8386cd81806aaa9e9f914907109d578.tar.xz
org.eclipse.linuxtools-ec4c19b6b8386cd81806aaa9e9f914907109d578.zip
lttng-control: Auto-detect LTTng trace type during import
Change-Id: I2bb301151b689d2417f2fc7e62c8f3104e8727a1 Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com> Reviewed-on: https://git.eclipse.org/r/26163 Tested-by: Hudson CI Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java9
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java29
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java14
3 files changed, 7 insertions, 45 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java
index 9c38b14600..70a9f3cc60 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportDialog.java
@@ -76,9 +76,6 @@ public class ImportDialog extends Dialog implements IImportDialog {
/** Name of metadata file of trace */
public static final String METADATA_FILE_NAME = "metadata"; //$NON-NLS-1$
- /** Default name of kernel traces */
- public static final String DEFAULT_KERNEL_TRACE_NAME = "kernel"; //$NON-NLS-1$
-
// ------------------------------------------------------------------------
// Attributes
// ------------------------------------------------------------------------
@@ -251,10 +248,6 @@ public class ImportDialog extends Dialog implements IImportDialog {
if (!file.isDirectory() && file.getName().equals(METADATA_FILE_NAME)) {
IRemoteFile trace = file.getParentRemoteFile();
IRemoteFile parent = trace.getParentRemoteFile();
- boolean isKernel = false;
- if (trace.getName().equals(DEFAULT_KERNEL_TRACE_NAME)) {
- isKernel = true;
- }
String path = fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getSnapshotPath() : fSession.getSessionPath();
path = getUnifiedPath(path);
@@ -265,7 +258,7 @@ public class ImportDialog extends Dialog implements IImportDialog {
IFolder destinationFolder = traceFolder.getFolder(new Path(relativeTracePath.toOSString()));
- ImportFileInfo info = new ImportFileInfo(trace, trace.getName(), destinationFolder, overwriteAll, isKernel);
+ ImportFileInfo info = new ImportFileInfo(trace, trace.getName(), destinationFolder, overwriteAll);
IFolder folder = destinationFolder.getFolder(trace.getName());
// Verify if trace directory already exists (and not overwrite)
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java
index e27314b785..73db884387 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/dialogs/ImportFileInfo.java
@@ -39,10 +39,6 @@ public class ImportFileInfo {
*/
private boolean fIsOverwrite;
/**
- * Flag that specifies if it is a kernel trace or not
- */
- private boolean fIsKernel;
- /**
* Destination folder to import the trace to (full workspace path)
*/
private IFolder fDestinationFolder;
@@ -61,16 +57,12 @@ public class ImportFileInfo {
* The destination folder (full workspace path)
* @param isOverwrite
* global overwrite flag
- * @param isKernel
- * <code>true</code> if it is a kernel trace else
- * <code>false</code>
*/
- public ImportFileInfo(IRemoteFile file, String traceName, IFolder destinationFolder, boolean isOverwrite, boolean isKernel) {
+ public ImportFileInfo(IRemoteFile file, String traceName, IFolder destinationFolder, boolean isOverwrite) {
fRemoteFile = file;
fLocalTraceName = traceName;
fDestinationFolder = destinationFolder;
fIsOverwrite = isOverwrite;
- fIsKernel = isKernel;
}
// ------------------------------------------------------------------------
@@ -124,25 +116,6 @@ public class ImportFileInfo {
}
/**
- * Returns whether it is a kernel trace or not
- *
- * @return <code>true</code> if it is a kernel trace else <code>false</code>
- */
- public boolean isKernel() {
- return fIsKernel;
- }
-
- /**
- * Sets whether it is a kernel trace or not
- *
- * @param isKernel
- * <code>true</code> for kernel trace else <code>false</code>
- */
- public void setKernel(boolean isKernel) {
- fIsKernel = isKernel;
- }
-
- /**
* Returns the destination folder to import the trace to (full workspace path).
*
* @return destination folder
diff --git a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java
index 96e159fab1..970baa7fa6 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.control.ui/src/org/eclipse/linuxtools/internal/lttng2/control/ui/views/handlers/ImportHandler.java
@@ -46,7 +46,7 @@ import org.eclipse.linuxtools.internal.lttng2.control.ui.views.dialogs.TraceCont
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.messages.Messages;
import org.eclipse.linuxtools.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent;
import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
-import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceType;
+import org.eclipse.linuxtools.tmf.core.project.model.TmfTraceImportException;
import org.eclipse.linuxtools.tmf.core.project.model.TraceTypeHelper;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectElement;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfProjectRegistry;
@@ -75,10 +75,6 @@ public class ImportHandler extends BaseControlViewHandler {
// ------------------------------------------------------------------------
// Constants
// ------------------------------------------------------------------------
- /** Trace Type ID for LTTng Kernel traces */
- private static final String LTTNG_KERNEL_TRACE_TYPE = "org.eclipse.linuxtools.lttng2.kernel.tracetype"; //$NON-NLS-1$
- /** Trace Type ID for Generic CTF traces */
- private static final String GENERIC_CTF_TRACE_TYPE = "org.eclipse.linuxtools.tmf.ui.type.ctf"; //$NON-NLS-1$
/** Name of default project to import traces to */
public static final String DEFAULT_REMOTE_PROJECT_NAME = "Remote"; //$NON-NLS-1$
@@ -159,10 +155,10 @@ public class ImportHandler extends BaseControlViewHandler {
if (file != null) {
TraceTypeHelper helper = null;
- if (remoteFile.isKernel()) {
- helper = TmfTraceType.getInstance().getTraceType(LTTNG_KERNEL_TRACE_TYPE);
- } else {
- helper = TmfTraceType.getInstance().getTraceType(GENERIC_CTF_TRACE_TYPE);
+ try {
+ helper = TmfTraceTypeUIUtils.selectTraceType(file.getLocationURI().getPath(), null, null);
+ } catch (TmfTraceImportException e) {
+ // the trace did not match any trace type
}
if (helper != null) {

Back to the top