Lines 166-174
Link Here
|
166 |
runAtomic(null, r); |
166 |
runAtomic(null, r); |
167 |
} |
167 |
} |
168 |
|
168 |
|
|
|
169 |
private void checkWritable(Element el) throws IOException { |
170 |
environment.takeLock(); |
171 |
} |
172 |
|
169 |
private void runAtomic(Element el, final Runnable r) throws SourceException { |
173 |
private void runAtomic(Element el, final Runnable r) throws SourceException { |
170 |
final Exception[] exc = new Exception[1]; |
174 |
final Exception[] exc = new Exception[1]; |
171 |
try { |
175 |
try { |
|
|
176 |
checkWritable(el); |
172 |
if (isAtomicAsUser()) { |
177 |
if (isAtomicAsUser()) { |
173 |
NbDocument.runAtomicAsUser(getDocument(), r); |
178 |
NbDocument.runAtomicAsUser(getDocument(), r); |
174 |
} else { |
179 |
} else { |
Lines 209-215
Link Here
|
209 |
ex, null); |
214 |
ex, null); |
210 |
} else if (ex instanceof IOException) { |
215 |
} else if (ex instanceof IOException) { |
211 |
x = new SourceException.IO((IOException)ex); |
216 |
x = new SourceException.IO((IOException)ex); |
212 |
man.annotate(x, ex); |
217 |
man.annotate(x, ErrorManager.USER, null, ex.getLocalizedMessage(), ex, null); |
213 |
} else if (ex instanceof SourceException) { |
218 |
} else if (ex instanceof SourceException) { |
214 |
x = (SourceException)ex; |
219 |
x = (SourceException)ex; |
215 |
} else { |
220 |
} else { |
Lines 220-227
Link Here
|
220 |
throw x; |
225 |
throw x; |
221 |
} |
226 |
} |
222 |
|
227 |
|
223 |
public void runAtomic(Element el, final ExceptionRunnable r) throws SourceException { |
228 |
public void runAtomic(final Element el, final ExceptionRunnable r) throws SourceException { |
224 |
final Exception[] exc = new Exception[1]; |
229 |
final Exception[] exc = new Exception[1]; |
|
|
230 |
try { |
231 |
checkWritable(el); |
232 |
} catch (IOException ex) { |
233 |
rethrowException(el, ex); |
234 |
} |
225 |
Runnable r2 = new Runnable() { |
235 |
Runnable r2 = new Runnable() { |
226 |
public void run() { |
236 |
public void run() { |
227 |
//environment.notifyBeginEdit(); |
237 |
//environment.notifyBeginEdit(); |