tmf: Update copyright headers in tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / project / handlers / DeleteTraceSupplementaryFilesHandler.java
index 3eb5b9a6cae7da8c240221bd944ee70908bceaab..f064bb20a62d8ea8566838da95481db51aec145d 100644 (file)
@@ -1,11 +1,11 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2010, 2011 Ericsson
- * 
+ * Copyright (c) 2009, 2013 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
  *******************************************************************************/
@@ -21,7 +21,7 @@ import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.jface.window.Window;
-import org.eclipse.linuxtools.internal.tmf.ui.TmfUiPlugin;
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
 import org.eclipse.linuxtools.internal.tmf.ui.project.dialogs.SelectSupplementaryResourcesDialog;
 import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
 import org.eclipse.ui.IWorkbenchPage;
@@ -45,12 +45,16 @@ public class DeleteTraceSupplementaryFilesHandler extends AbstractHandler {
 
         // Check if we are closing down
         IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-        if (window == null)
+        if (window == null) {
             return null;
+        }
 
         // Get the selection
         IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
         IWorkbenchPart part = page.getActivePart();
+        if (part == null) {
+            return false;
+        }
         ISelectionProvider selectionProvider = part.getSite().getSelectionProvider();
         if (selectionProvider == null) {
             return false;
@@ -70,7 +74,7 @@ public class DeleteTraceSupplementaryFilesHandler extends AbstractHandler {
 
                 // Delete the selected resources
                 IResource[] resources = trace.getSupplementaryResources();
-                
+
                 SelectSupplementaryResourcesDialog dialog = new SelectSupplementaryResourcesDialog(window.getShell(), resources);
                 if (dialog.open() != Window.OK) {
                     return null;
@@ -83,11 +87,9 @@ public class DeleteTraceSupplementaryFilesHandler extends AbstractHandler {
 
                 if (resource != null) {
                     try {
-                        if (resource != null) {
-                            resource.refreshLocal(IResource.DEPTH_INFINITE, null);
-                        }
+                        resource.refreshLocal(IResource.DEPTH_INFINITE, null);
                     } catch (CoreException e) {
-                        TmfUiPlugin.getDefault().logError("Error refreshing resource " + resource, e); //$NON-NLS-1$
+                        Activator.getDefault().logError("Error refreshing resource " + resource, e); //$NON-NLS-1$
                     }
                 }
             }
This page took 0.025073 seconds and 5 git commands to generate.