Lines 62-67
Link Here
|
62 |
import java.util.Locale; |
62 |
import java.util.Locale; |
63 |
import java.util.Map; |
63 |
import java.util.Map; |
64 |
import java.util.Set; |
64 |
import java.util.Set; |
|
|
65 |
import java.util.concurrent.atomic.AtomicBoolean; |
65 |
import java.util.logging.Level; |
66 |
import java.util.logging.Level; |
66 |
import java.util.logging.Logger; |
67 |
import java.util.logging.Logger; |
67 |
import java.util.regex.Matcher; |
68 |
import java.util.regex.Matcher; |
Lines 83-88
Link Here
|
83 |
import org.apache.tools.ant.module.spi.AntSession; |
84 |
import org.apache.tools.ant.module.spi.AntSession; |
84 |
import org.apache.tools.ant.module.spi.TaskStructure; |
85 |
import org.apache.tools.ant.module.spi.TaskStructure; |
85 |
import org.netbeans.api.progress.ProgressHandle; |
86 |
import org.netbeans.api.progress.ProgressHandle; |
|
|
87 |
import org.netbeans.modules.project.indexingbridge.IndexingBridge; |
86 |
import org.openide.awt.StatusDisplayer; |
88 |
import org.openide.awt.StatusDisplayer; |
87 |
import org.openide.util.Lookup; |
89 |
import org.openide.util.Lookup; |
88 |
import org.openide.util.NbBundle; |
90 |
import org.openide.util.NbBundle; |
Lines 119-127
Link Here
|
119 |
private final Runnable interestingOutputCallback; |
121 |
private final Runnable interestingOutputCallback; |
120 |
private final ProgressHandle handle; |
122 |
private final ProgressHandle handle; |
121 |
private boolean insideRunTask = false; // #95201 |
123 |
private boolean insideRunTask = false; // #95201 |
|
|
124 |
private final AtomicBoolean protectedMode = new AtomicBoolean(); // #211005 |
122 |
private final RequestProcessor.Task sleepTask = new RequestProcessor(NbBuildLogger.class.getName(), 1, false, false).create(new Runnable() { |
125 |
private final RequestProcessor.Task sleepTask = new RequestProcessor(NbBuildLogger.class.getName(), 1, false, false).create(new Runnable() { |
123 |
public @Override void run() { |
126 |
public @Override void run() { |
124 |
handle.suspend(insideRunTask ? NbBundle.getMessage(NbBuildLogger.class, "MSG_sleep_running") : ""); |
127 |
handle.suspend(insideRunTask ? NbBundle.getMessage(NbBuildLogger.class, "MSG_sleep_running") : ""); |
|
|
128 |
exitProtectedMode(); |
125 |
} |
129 |
} |
126 |
}); |
130 |
}); |
127 |
private static final int SLEEP_DELAY = 5000; |
131 |
private static final int SLEEP_DELAY = 5000; |
Lines 189-194
Link Here
|
189 |
this.interestingOutputCallback = interestingOutputCallback; |
193 |
this.interestingOutputCallback = interestingOutputCallback; |
190 |
this.handle = handle; |
194 |
this.handle = handle; |
191 |
LOG.log(Level.FINE, "---- Initializing build of {0} \"{1}\" at verbosity {2} ----", new Object[] {origScript, displayName, verbosity}); |
195 |
LOG.log(Level.FINE, "---- Initializing build of {0} \"{1}\" at verbosity {2} ----", new Object[] {origScript, displayName, verbosity}); |
|
|
196 |
enterProtectedMode(); |
197 |
} |
198 |
|
199 |
private void enterProtectedMode() { |
200 |
if (protectedMode.compareAndSet(false, true)) { |
201 |
IndexingBridge.getDefault().enterProtectedMode(); |
202 |
} |
203 |
} |
204 |
private void exitProtectedMode() { |
205 |
if (protectedMode.compareAndSet(true, false)) { |
206 |
IndexingBridge.getDefault().exitProtectedMode(); |
207 |
} |
192 |
} |
208 |
} |
193 |
|
209 |
|
194 |
/** Try to stop running at the next safe point. */ |
210 |
/** Try to stop running at the next safe point. */ |
Lines 204-209
Link Here
|
204 |
} |
220 |
} |
205 |
if (running) { |
221 |
if (running) { |
206 |
handle.switchToIndeterminate(); |
222 |
handle.switchToIndeterminate(); |
|
|
223 |
enterProtectedMode(); |
207 |
sleepTask.schedule(SLEEP_DELAY); |
224 |
sleepTask.schedule(SLEEP_DELAY); |
208 |
} |
225 |
} |
209 |
} |
226 |
} |
Lines 219-224
Link Here
|
219 |
err.close(); |
236 |
err.close(); |
220 |
handle.finish(); |
237 |
handle.finish(); |
221 |
sleepTask.cancel(); |
238 |
sleepTask.cancel(); |
|
|
239 |
exitProtectedMode(); |
222 |
} |
240 |
} |
223 |
|
241 |
|
224 |
private void verifyRunning() { |
242 |
private void verifyRunning() { |