abuot VirtualFile.getWriter();

the Code:

VirtualFile virtualFile;
..
Write writer = virtualFile.getWriter(null);

but, I got a exception, is:

2003-12-08 10:56:59,875 ERROR -

plication.impl.ApplicationImpl - IntelliJ IDEA (Aurora) Build #977

2003-12-08 10:56:59,875 ERROR -

plication.impl.ApplicationImpl - JDK: 1.4.2_02

2003-12-08 10:56:59,875 ERROR -

plication.impl.ApplicationImpl - VM: Java HotSpot(TM) Client VM

2003-12-08 10:56:59,875 ERROR -

plication.impl.ApplicationImpl - Vendor: Sun Microsystems Inc.

2003-12-08 10:56:59,875 ERROR -

plication.impl.ApplicationImpl - OS: Windows XP

2003-12-08 10:56:59,875 ERROR -

plication.impl.ApplicationImpl - Last Action:

2003-12-08 10:56:59,875 ERROR -

plication.impl.ApplicationImpl - Assertion failed: Write access is allowed

inside write-action only (see

com.intellij.openapi.application.Application.runWriteAction())


that's mean getWrite() or getOutputSteam() methods is by intellij inside
call only,
I want to write a file, how to write? Don't tell me use java.io.FileWrite or
java.io.FileOutputStream

thank's!

jdk:1.4.2
intellij is build #977








2 comments

Yang,

According to information I've gotten from IntelliJ folks and by experimentation:

(1) only the Swing dispatch thread can update (write to) documents -- this may not be a problem for you; but check

to be sure.

(2) The thread must obtain the application write-action lock using the following call:

At least, it has worked for me.

-Dave

0

Thank u very much, It's all right~


"Dave Kriewall" <no_mail@jetbrains.com> дÈëÓʼþ
news:8265540.1070869508571.JavaMail.javamailuser@localhost...

Yang,



0

Please sign in to leave a comment.