Psi and visitors Follow
Hi,
I'm beginning to play with the Psi and I would like to know what
informations
the following methods return:
- com.intellij.psi.PsiElement.isPhysical();
- com.intellij.psi.PsiElement.isValid();
- com.intellij.psi.PsiElement.isWritable();
Thanks you in advance,
Loic
Please sign in to leave a comment.
Loic wrote:
Generally returns true if PsiElement has a document associated with it,
false otherwise.
You obtain non-physical PsiElements when you create them from
PsiElementFactory, for example.
PsiElements can get invalidated - that is, they no longer belong to
any source code tree. This may happen, for example, after file is reparsed.
Checks whether rthsi PsiElement can be modified by add/delete/replace
methods.
Hope this helps,
Friendly,
Dmitry
--
Dmitry Lomov
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"
Yes, it really helps, thanks! :o)
Now, I'm trying to "match" some Java code to propose replacements
(Intentions).
The problem is that I'm using - I think - the old way - the one I was using
in an other
application:
If I want to match the following expression statement "a = a + 1", then I'm
using the following code,
(see attachment). The problem is that the "instanceof way" don't seem to be
the right way
(for a number of reasons not explained here).
So, could anyone explain me the good way to match such statement?
Thanks you in advance,
Loïc
"Dmitry Lomov (JetBrains)" <Dmitry.Lomov@jetbrains.com> a écrit dans le
message de news:ca6jkh$9mh$1@is.intellij.net...
>
>
>
>
>
reparsed.
>
>
>
>
>
Attachment(s):
OptimizationInspection.java