1 11 package org.eclipse.ant.internal.ui.launchConfigurations; 12 13 14 import java.util.HashMap ; 15 import java.util.Map ; 16 17 import org.eclipse.core.runtime.IProgressMonitor; 18 import org.eclipse.core.runtime.PlatformObject; 19 import org.eclipse.debug.core.DebugEvent; 20 import org.eclipse.debug.core.DebugPlugin; 21 import org.eclipse.debug.core.ILaunch; 22 import org.eclipse.debug.core.model.IProcess; 23 import org.eclipse.debug.core.model.IStreamsProxy; 24 import org.eclipse.debug.ui.console.IConsole; 25 26 public class AntProcess extends PlatformObject implements IProcess, IProgressMonitor { 27 28 private AntStreamsProxy fProxy; 29 private String fLabel = null; 30 private ILaunch fLaunch = null; 31 private Map fAttributes = null; 32 private boolean fTerminated = false; 33 private boolean fCancelled = false; 34 private IConsole fConsole = null; 35 36 public AntProcess(String label, ILaunch launch, Map attributes) { 37 fLabel = label; 38 fLaunch = launch; 39 if (attributes == null) { 40 fAttributes = new HashMap (); 41 } else { 42 fAttributes = attributes; 43 } 44 String captureOutput= launch.getAttribute(DebugPlugin.ATTR_CAPTURE_OUTPUT); 45 if(!("false".equals(captureOutput))) { fProxy= new AntStreamsProxy(); 47 } 48 launch.addProcess(this); 49 } 50 51 54 public String getLabel() { 55 return fLabel; 56 } 57 58 61 public ILaunch getLaunch() { 62 return fLaunch; 63 } 64 65 68 public IStreamsProxy getStreamsProxy() { 69 return fProxy; 70 } 71 72 75 public void setAttribute(String key, String value) { 76 fAttributes.put(key, value); 77 } 78 79 82 public String getAttribute(String key) { 83 return (String )fAttributes.get(key); 84 } 85 86 89 public int getExitValue() { 90 return 0; 91 } 92 93 96 public boolean canTerminate() { 97 return !isCanceled() && !isTerminated(); 98 } 99 100 103 public boolean isTerminated() { 104 return fTerminated; 105 } 106 107 protected void terminated() { 108 if (!fTerminated) { 109 fTerminated = true; 110 if (DebugPlugin.getDefault() != null) { 111 DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {new DebugEvent(this, DebugEvent.TERMINATE)}); 112 } 113 } 114 } 115 116 119 public void terminate() { 120 setCanceled(true); 121 } 122 123 129 public IConsole getConsole() { 130 return fConsole; 131 } 132 133 138 public void setConsole(IConsole console) { 139 fConsole = console; 140 } 141 142 144 147 public void beginTask(String name, int totalWork) { 148 } 149 150 153 public void done() { 154 } 155 156 159 public void internalWorked(double work) { 160 } 161 162 165 public boolean isCanceled() { 166 return fCancelled; 167 } 168 169 172 public void setCanceled(boolean value) { 173 fCancelled = value; 174 } 175 176 179 public void setTaskName(String name) { 180 } 181 182 185 public void subTask(String name) { 186 } 187 188 191 public void worked(int work) { 192 } 193 } 194 | Popular Tags |