1 11 package org.eclipse.debug.internal.core.commands; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.debug.core.IRequest; 16 import org.eclipse.debug.core.commands.IEnabledStateRequest; 17 18 23 public abstract class ForEachCommand extends DebugCommand { 24 25 28 protected void doExecute(Object [] targets, IProgressMonitor monitor, IRequest request) throws CoreException { 29 for (int i = 0; i < targets.length; i++) { 30 execute(targets[i]); 31 monitor.worked(1); 32 } 33 } 34 35 protected abstract void execute(Object target) throws CoreException; 36 37 40 protected boolean isExecutable(Object [] targets, IProgressMonitor monitor, IEnabledStateRequest request) throws CoreException { 41 for (int i = 0; i < targets.length; i++) { 42 if (!isExecutable(targets[i])) { 43 return false; 44 } 45 monitor.worked(1); 46 } 47 return true; 48 } 49 50 protected abstract boolean isExecutable(Object target); 51 52 } 53 | Popular Tags |