aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2013-09-06 10:54:07 (EDT)
committerMarc-Andre Laperle2013-11-14 14:11:27 (EST)
commit935fd10732bbbff18a86ccd7ea43d85ccc02b9da (patch)
tree61476060033687b12ffebd3a339bd967b05b8a76
parentcb90b0bc7399f74e453db431aa2a9258b5d27f14 (diff)
downloadorg.eclipse.linuxtools-935fd10732bbbff18a86ccd7ea43d85ccc02b9da.zip
org.eclipse.linuxtools-935fd10732bbbff18a86ccd7ea43d85ccc02b9da.tar.gz
org.eclipse.linuxtools-935fd10732bbbff18a86ccd7ea43d85ccc02b9da.tar.bz2
tmf: Delete experiment supp files when adding/removing tracerefs/changes/81/18281/2
Bug: 421372 Change-Id: I9dde1c7988df47348e5c96ecda43df45dc062c4a Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/18281 Tested-by: Hudson CI Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com> IP-Clean: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com> 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/DeleteTraceHandler.java35
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DropAdapterAssistant.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java1
4 files changed, 24 insertions, 16 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteTraceHandler.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteTraceHandler.java
index 5173ce4..c5f206d 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteTraceHandler.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteTraceHandler.java
@@ -126,24 +126,29 @@ public class DeleteTraceHandler extends AbstractHandler {
trace.closeEditors();
IPath path = resource.getLocation();
- if (path != null && (trace.getParent() instanceof TmfTraceFolder)) {
- TmfExperimentFolder experimentFolder = trace.getProject().getExperimentsFolder();
-
- // Propagate the removal to traces
- for (ITmfProjectModelElement experiment : experimentFolder.getChildren()) {
- List<ITmfProjectModelElement> toRemove = new LinkedList<ITmfProjectModelElement>();
- for (ITmfProjectModelElement child : experiment.getChildren()) {
- if (child.getName().equals(trace.getName())) {
- toRemove.add(child);
+ if (path != null) {
+ if (trace.getParent() instanceof TmfTraceFolder) {
+ // Propagate the removal to experiments
+ TmfExperimentFolder experimentFolder = trace.getProject().getExperimentsFolder();
+ for (ITmfProjectModelElement experiment : experimentFolder.getChildren()) {
+ List<ITmfProjectModelElement> toRemove = new LinkedList<ITmfProjectModelElement>();
+ for (ITmfProjectModelElement child : experiment.getChildren()) {
+ if (child.getName().equals(trace.getName())) {
+ toRemove.add(child);
+ }
+ }
+ for (ITmfProjectModelElement child : toRemove) {
+ ((TmfExperimentElement) experiment).removeTrace((TmfTraceElement) child);
}
}
- for (ITmfProjectModelElement child : toRemove) {
- ((TmfExperimentElement) experiment).removeTrace((TmfTraceElement) child);
- }
- }
- // Delete supplementary files
- trace.deleteSupplementaryFolder();
+ // Delete supplementary files
+ trace.deleteSupplementaryFolder();
+
+ } else if (trace.getParent() instanceof TmfExperimentElement) {
+ TmfExperimentElement experimentElement = (TmfExperimentElement) trace.getParent();
+ experimentElement.removeTrace(trace);
+ }
}
// Finally, delete the trace
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DropAdapterAssistant.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DropAdapterAssistant.java
index 533d91e..bf2fde9 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DropAdapterAssistant.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DropAdapterAssistant.java
@@ -261,6 +261,7 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
}
if (traceResource != null && traceResource.exists()) {
createLink(targetExperiment.getResource(), traceResource, traceResource.getName());
+ targetExperiment.deleteSupplementaryResources();
targetExperiment.closeEditors();
return traceResource;
}
@@ -376,6 +377,7 @@ public class DropAdapterAssistant extends CommonDropAdapterAssistant {
}
if (resource != null && resource.exists()) {
createLink(targetExperiment.getResource(), resource, resource.getName());
+ targetExperiment.deleteSupplementaryResources();
targetExperiment.closeEditors();
return true;
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java
index add5be9..8580868 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfExperimentElement.java
@@ -186,7 +186,7 @@ public class TmfExperimentElement extends TmfWithFolderElement implements IPrope
/* Finally, remove the trace from experiment*/
removeChild(trace);
trace.getResource().delete(true, null);
-
+ deleteSupplementaryResources();
}
private static void setProperties(IResource resource, String bundleName,
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java
index 85653b0..a321f4d 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/SelectTracesWizardPage.java
@@ -162,6 +162,7 @@ public class SelectTracesWizardPage extends WizardPage {
}
fProject.refresh();
if (changed) {
+ fExperiment.deleteSupplementaryResources();
fExperiment.closeEditors();
}