Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2014-05-05 19:51:00 +0000
committerMarc-Andre Laperle2014-05-06 14:06:23 +0000
commitea6393643819873e9031480053de6fb92b07a80b (patch)
tree560acb0c44b705fa47342c6b4631aad0075b56aa
parent64c11c78d447ee5c38247cebbb566d544584f1ca (diff)
downloadorg.eclipse.linuxtools-ea6393643819873e9031480053de6fb92b07a80b.tar.gz
org.eclipse.linuxtools-ea6393643819873e9031480053de6fb92b07a80b.tar.xz
org.eclipse.linuxtools-ea6393643819873e9031480053de6fb92b07a80b.zip
tmf: Some fixes to folder handling in synchronization
Change-Id: I4d366b53e4cd2b3bfdc8504fba5cebe1b5f254f1 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/25993 Tested-by: Hudson CI Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net> Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java18
1 files changed, 6 insertions, 12 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java
index 4a133225f7..a62d5aefe9 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/SynchronizeTracesHandler.java
@@ -18,6 +18,7 @@ import java.util.Iterator;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
@@ -28,7 +29,6 @@ import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
import org.eclipse.linuxtools.tmf.core.synchronization.SynchronizationAlgorithm;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
-import org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfExperimentElement;
import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
import org.eclipse.linuxtools.tmf.ui.project.model.TraceUtils;
@@ -166,7 +166,7 @@ public class SynchronizeTracesHandler extends AbstractHandler {
*/
ITmfTrace expTrace = null;
for (ITmfTrace t : experiment.getTraces()) {
- if (t.getName().equals(traceel.getName())) {
+ if (t.getResource().equals(traceel.getResource())) {
expTrace = t;
break;
}
@@ -175,12 +175,7 @@ public class SynchronizeTracesHandler extends AbstractHandler {
if ((expTrace != null) && syncAlgo.isTraceSynced(expTrace.getHostId())) {
/* Find the original trace */
- TmfTraceElement origtrace = null;
- for (ITmfProjectModelElement el : traceel.getProject().getTracesFolder().getTraces()) {
- if (el.getName().equals(traceel.getName())) {
- origtrace = (TmfTraceElement) el;
- }
- }
+ TmfTraceElement origtrace = traceel.getElementUnderTraceFolder();
if (origtrace != null) {
/*
@@ -188,14 +183,13 @@ public class SynchronizeTracesHandler extends AbstractHandler {
* new name does not exist
*/
String newname = traceel.getName();
+ IContainer parentFolder = origtrace.getResource().getParent();
boolean traceexists;
do {
traceexists = false;
newname += "_"; //$NON-NLS-1$
- for (ITmfProjectModelElement el : traceel.getProject().getTracesFolder().getTraces()) {
- if (el.getName().equals(newname)) {
- traceexists = true;
- }
+ if (parentFolder.findMember(newname) != null) {
+ traceexists = true;
}
} while (traceexists);

Back to the top