tmf: Drop generics from ITmfTrace and TmfExperiment
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / project / handlers / DeleteTraceHandler.java
index c3895aea2ab0b80e25fc34ee8c7af94454f954bc..5749865eb0863eb07ec206c5f5eed51c531775e4 100644 (file)
@@ -1,18 +1,17 @@
 /*******************************************************************************
  * Copyright (c) 2009, 2010, 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
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  * Contributors:
  *   Francois Chouinard - Initial API and implementation
  *******************************************************************************/
 
 package org.eclipse.linuxtools.internal.tmf.ui.project.handlers;
 
-import java.io.IOException;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -27,6 +26,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
 import org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfExperimentFolder;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
@@ -56,15 +56,17 @@ public class DeleteTraceHandler extends AbstractHandler {
 
         // Check if we are closing down
         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null)
+        if (window == null) {
             return false;
+        }
 
         // Get the selection
         IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
         IWorkbenchPart part = page.getActivePart();
         ISelectionProvider selectionProvider = part.getSite().getSelectionProvider();
-        if (selectionProvider == null)
+        if (selectionProvider == null) {
             return false;
+        }
         ISelection selection = selectionProvider.getSelection();
 
         // Make sure selection contains only traces
@@ -94,16 +96,18 @@ public class DeleteTraceHandler extends AbstractHandler {
 
         // Check if we are closing down
         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null)
+        if (window == null) {
             return null;
+        }
 
         // Confirm the operation
         Shell shell = window.getShell();
         MessageBox confirmOperation = new MessageBox(shell, SWT.ICON_QUESTION | SWT.CANCEL | SWT.OK);
         confirmOperation.setText(Messages.DeleteDialog_Title);
         confirmOperation.setMessage(Messages.DeleteTraceHandler_Message);
-        if (confirmOperation.open() != SWT.OK)
+        if (confirmOperation.open() != SWT.OK) {
             return null;
+        }
 
         @SuppressWarnings("unchecked")
         Iterator<Object> iterator = fSelection.iterator();
@@ -115,7 +119,7 @@ public class DeleteTraceHandler extends AbstractHandler {
                 try {
                     IPath path = resource.getLocation();
                     if (path != null && (trace.getParent() instanceof TmfTraceFolder)) {
-                        String location = path.toFile().getCanonicalPath();
+                        String location = path.toString();
                         TmfExperimentFolder experimentFolder = trace.getProject().getExperimentsFolder();
 
                         // Propagate the removal to traces
@@ -137,15 +141,13 @@ public class DeleteTraceHandler extends AbstractHandler {
                     resource.delete(true, new NullProgressMonitor());
 
                     // Delete supplementary files
-                    trace.deleteSupplementaryFiles();
+                    trace.deleteSupplementaryFolder();
 
                     // Refresh the project
                     trace.getProject().refresh();
 
-                } catch (IOException e1) {
-                    e1.printStackTrace();
                 } catch (CoreException e) {
-                    e.printStackTrace();
+                    Activator.getDefault().logError("Error deleting trace: " + trace.getName(), e); //$NON-NLS-1$
                 }
             }
         }
This page took 0.03245 seconds and 5 git commands to generate.