[
https://issues.jboss.org/browse/JBIDE-21791?page=com.atlassian.jira.plugi...
]
Claus Ibsen edited comment on JBIDE-21791 at 3/1/16 10:35 AM:
--------------------------------------------------------------
I dont know the internals of forge here, but what I am looking for is the get the
"newest" content of a resource, where by "newest" i mean
a) the current text in the source code editor if the resource is being edited, and have
not yet been saved
b) the text from the resource from disk which is the "newest".
What forge gives me today is giving me only access to (b) I assume. Although I get the
resource as a JavaResouce abstraction, then the getContents() method would likely load
from disk, as in (b) which in light of these latest tickets I strongly suspect is the old
saved content on disk, and not the newest from memory.
This works fine in CLI etc where you "do not have a editor and work on files in
memory" but in the CLI you only work on files on disk, and save to disk after
changes.
I was a bit surprised as there is plenty of forge addons that work on java code to add JPA
entities / equals/hashCode and whatnot. So woudln't these addons not have same
problem? Or are nobody using them and haven't noticed this problem. Or are this a
newbie error developing custom forge addons.
And as I understand the forge addons is that they force re-load the resources after the
command is executed, as a way to "signal" to Eclipse/IDEA that the files may be
changed externally so update them in your windows. At least I have seen some code doing
that in IDEA forge plugin. Not sure if its identical in Eclipse.
But I wonder if there is not a way for getting the content using some IDEA or Eclipse
API/hook so you can work on the memory content and IDEA/Eclipse is aware that you are
editing it, and when you are done calling "save" or what the api could be, they
can save those changes memory only in the window, as if the end user had typed/changed
those himself. In that case a "force-save" is not needed. And it also works
better with undo commands and so on. And would be nice if all those changes could be
combined into a single "action" for undo. Like for example running a command in
IDEA, you can undo it entirely and get as before. Would be nice to be the same with
forge.
Maybe [~gastaldi] have some thoughts?
was (Author: davsclaus):
I dont know the internals of forge here, but what I am looking for is the get the
"newest" content of a resource, where by "newest" i mean
a) the current text in the source code editor if the resource is being edited, and have
not yet been saved
b) the text from the resource from disk which is the "newest".
What forge gives me today is giving me only access to (b) I assume. Although I get the
resource as a JavaResouce abstraction, then the getContents() method would likely load
from disk, as in (b) which in light of these latest tickets I strongly suspect is the old
saved content on disk, and not the newest from memory.
This works fine in CLI etc where you do not have a editor and work on files in memory.
I was a bit surprised as there is plenty of forge addons that work on java code to add JPA
entities / equals/hashCode and whatnot. So woudln't these addons not have same
problem? Or are nobody using them and haven't noticed this problem. Or are this a
newbie error developing custom forge addons.
And as I understand the forge addons is that they force re-load the resources after the
command is executed, as a way to "signal" to Eclipse/IDEA that the files may be
changed externally so update them in your windows. At least I have seen some code doing
that in IDEA forge plugin. Not sure if its identical in Eclipse.
But I wonder if there is not a way for getting the content using some IDEA or Eclipse
API/hook so you can work on the memory content and IDEA/Eclipse is aware that you are
editing it, and when you are done calling "save" or what the api could be, they
can save those changes memory only in the window, as if the end user had typed/changed
those himself. In that case a "force-save" is not needed. And it also works
better with undo commands and so on. And would be nice if all those changes could be
combined into a single "action" for undo. Like for example running a command in
IDEA, you can undo it entirely and get as before. Would be nice to be the same with
forge.
Maybe [~gastaldi] have some thoughts?
Forge addon - Changing the current file may cause a "file has
changed in file vs memory" issue in Eclipse
---------------------------------------------------------------------------------------------------------
Key: JBIDE-21791
URL:
https://issues.jboss.org/browse/JBIDE-21791
Project: Tools (JBoss Tools)
Issue Type: Bug
Components: forge
Affects Versions: 4.3.1.Beta2
Reporter: Claus Ibsen
Fix For: 4.3.1.CR1
Attachments: eclipse-add.png
Similar problem as FORGE-2605 but this time its in Eclipse.
See the attached screenshot, where I have edited the file camel-context.xml, and then run
my forge command, which would insert a Camel endpoint at the cursor position. But eclipse
has detected a file conflict as in that dialog.
I wonder if the fix should be like in IDEA to save the file before the command is run.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)