1 11 package org.eclipse.ui.actions; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.core.runtime.jobs.ISchedulingRule; 18 import org.eclipse.jface.operation.IRunnableWithProgress; 19 20 27 public class WorkspaceModifyDelegatingOperation extends 28 WorkspaceModifyOperation { 29 30 33 private IRunnableWithProgress content; 34 35 44 public WorkspaceModifyDelegatingOperation(IRunnableWithProgress content, 45 ISchedulingRule rule) { 46 super(rule); 47 this.content = content; 48 } 49 50 57 public WorkspaceModifyDelegatingOperation(IRunnableWithProgress content) { 58 super(); 59 this.content = content; 60 } 61 62 65 protected void execute(IProgressMonitor monitor) throws CoreException, 66 InterruptedException { 67 try { 68 content.run(monitor); 69 } catch (InvocationTargetException e) { 70 if (e.getTargetException() instanceof CoreException) { 71 throw (CoreException) e.getTargetException(); 72 } 73 if (e.getTargetException() instanceof RuntimeException ) { 74 throw (RuntimeException ) e.getTargetException(); 75 } 76 if (e.getTargetException() instanceof Error ) { 77 throw (Error ) e.getTargetException(); 78 } 79 e.getTargetException().printStackTrace(); 80 } 81 } 82 } 83 | Popular Tags |