file = DummyHolder

That's what is returned from the valid PsiStatement I named nextStatement

nextStatement.getContainingFile();

printing it to the screen says its name is "DummyHolder". Not any project I created....

at any rate, the Project reference is needed for any number of things including getting access to a Document reference...

So in other words, the file returned from my PsiStatement identifies itsel (through its "toString() method ) as "DummyHolder" and this DummyHolder file is useless as a parameter to further method calls such as:

Document document = PsiDocumentManager.getInstance(project ).getDocument(dummyHolderReference);

where the Document this will return is "null".

:(

Message was edited by:
softwarevisualization

2 comments

Hello softwarevisualization,

That's what is returned from the valid PsiStatement I named
nextStatement

nextStatement.getContainingFile();

printing it to the screen says its name is "DummyHolder". Not any
project I created....


Calling PsiElement.add(newElement) returns a copy of the newElement element
which has actually been added. That copy will return correct values from
getContainingFile() and all other methods.

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


0

Please sign in to leave a comment.