aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2013-09-04 16:29:47 (EDT)
committerBernd Hufmann2013-09-05 15:09:16 (EDT)
commitb129bb7105a71dbbae4d4eb7f62b4ba5e2ea1993 (patch)
treebac71b15f6d19fa1c2cc8dbc0a668b6c5e143344
parente09d6be52f1e89dcda5dcb609c0d1a2366a51b1b (diff)
downloadorg.eclipse.linuxtools-b129bb7105a71dbbae4d4eb7f62b4ba5e2ea1993.zip
org.eclipse.linuxtools-b129bb7105a71dbbae4d4eb7f62b4ba5e2ea1993.tar.gz
org.eclipse.linuxtools-b129bb7105a71dbbae4d4eb7f62b4ba5e2ea1993.tar.bz2
Bug 416574 - Fix NPE when deleting supplementary files in experimentrefs/changes/39/16139/4
Change-Id: I7ba4577b8cdfe64af000589ff0e354ea3aa8f05b Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/16139 Tested-by: Hudson CI Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> IP-Clean: Patrick Tasse <patrick.tasse@gmail.com> Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com> IP-Clean: Bernd Hufmann <bernd.hufmann@ericsson.com> Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java
index dfd3b3d..1c985ca 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/internal/tmf/ui/project/handlers/DeleteExperimentSupplementaryFilesHandler.java
@@ -7,8 +7,9 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Bernd Hufmann - Initial API and implementation
- * Patrick Tasse - Close editors to release resources
+ * Bernd Hufmann - Initial API and implementation
+ * Patrick Tasse - Close editors to release resources
+ * Marc-Andre Laperle - Fix NPE (Bug 416574)
*******************************************************************************/
package org.eclipse.linuxtools.internal.tmf.ui.project.handlers;
@@ -80,7 +81,10 @@ public class DeleteExperimentSupplementaryFilesHandler extends AbstractHandler {
TmfExperimentElement experiment = (TmfExperimentElement) element;
IResource[] resources = experiment.getSupplementaryResources();
- resourcesList.addAll(Arrays.asList(resources));
+ // List to know which resources belong to the experiment
+ List<IResource> experimentResources = Arrays.asList(resources);
+
+ resourcesList.addAll(experimentResources);
// Map to know which trace to close for each resource
HashMap<IResource, TmfTraceElement> traceMap = new HashMap<IResource, TmfTraceElement>();
@@ -109,7 +113,12 @@ public class DeleteExperimentSupplementaryFilesHandler extends AbstractHandler {
// Delete the selected resources
for (IResource resource : resourcesToDelete) {
- traceMap.get(resource).closeEditors();
+ if (experimentResources.contains(resource)) {
+ experiment.closeEditors();
+ } else {
+ traceMap.get(resource).closeEditors();
+ }
+
try {
resource.delete(true, new NullProgressMonitor());
} catch (CoreException e) {