Handling results from ReferenceSearch

Hi,
is there a better way to categorize the results rather than use intanceof on the context of the PsiReference ?

3 comments

Hello Aviram,

is there a better way to categorize the results rather than use
intanceof on the context of the PsiReference ?


Sorry, what exactly do you mean by "categorizing the results"?

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

i'm building a plugin which will reflect the relations between classes/methods/fields graphically

now let say i use ReferencesSearch on a class
i get a collection of PsiReferences

for each reference i can get its context to know what type of reference that is
for example
instance creation (PsiNewExpression or something like that)
inheritance (PsiReferenceList)
etc...

if i want different behavior for each relation i need to know what i'm dealing with

0

Hello Aviram,

i'm building a plugin which will reflect the relations between
classes/methods/fields graphically

now let say i use ReferencesSearch on a class
i get a collection of PsiReferences
for each reference i can get its context to know what type of
reference that is
for example
instance creation (PsiNewExpression or something like that)
inheritance (PsiReferenceList)
etc...
if i want different behavior for each relation i need to know what i'm
dealing with


Yes, using instanceof is the correct way to do that.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.