Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 107420

Summary: can't find model while the associated file is being moved
Product: [WebTools] WTP Source Editing Reporter: Hirotaka Matsumoto <jljlmatu>
Component: wst.sseAssignee: David Williams <david_williams>
Status: CLOSED DUPLICATE QA Contact:
Severity: critical    
Priority: P1 CC: sisikawa
Version: 0.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Hirotaka Matsumoto CLA 2005-08-19 06:00:57 EDT
This could be same as what is reported in this bugzilla
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=107316), but I'd like to file this
bug anyway.


We can't get the expected model's id while the associated file is begin moved.

Given that we have the following pseudo code :

  IStructuredModel orgModel; // This represents for the existing file
                             // let's say
"C:/workspace/dynamicWeb/WebContent/a.html"
  String orgModelId = orgModel.getId();
                             // so this model's id is
"/dynamicWeb/WebContent/a.html"

And when /dynamicWeb/WebContent/a.html is moved to /dynamicWeb/WebContent/b.html,
because our editor is a resource change listener, we got the notification from the
workbench that "/dynamicWeb/WebContent/a.html" is moved to
"/dynamicWeb/WebContent/b.html"
so what we are doing is :

  IFile oldFile = ...; // This represents for the old file
                       // in this case "/dynamicWeb/WebContent/a.html"

  String id = IModelManager#calculateId(oldFile);

But in this timing, it is now "C:/workspace/dynamicWeb/WebContent/a.html".
Because our editor knows we have a model which id is /dynamicWeb/WebContent/a.html"
we missed this resource change event so that we can't process ResourceChange
Listener events. This is very critical.


.
Comment 1 David Williams CLA 2005-08-19 13:05:22 EDT
I'll help investigate this one, but not sure if we can fix on our end. 

I think we (you) need to move more to the Eclipse-base-established-way 
that if a resource is moved, that you basically "abandon" what you have, 
and let the "new stuff" perculate up from the bottom. I belive, for example, 
that in this case 'setInput' is called again on an editor (I'd have to check to
know which method, exactly). 

Does this sound feasible? Or am I missing the point?

Comment 2 Hirotaka Matsumoto CLA 2005-08-22 03:20:21 EDT
To abandon the old stuff, we need to know which model is the one
we need to get rid of. In the above scenaio, the workbench tells us
that  "/dynamicWeb/WebContent/a.html is moved to 
/dynamicWeb/WebContent/b.html" so that we need to abondon the model
of "/dynamicWeb/WebContent/a.html". Because our editor supports
the multiple document editing ( i.e. frame/jsp include ), we need to
pick up the model in the models our editor keeps for the editing. To
do this, we get the id by calling IModelManager#calculateId(IFile)
and we will look for the target model. However, the id in the model
and the id which is returned from this api is different ( I think
this is a root problem ), we can't find out the  model which we
need to release.

I would guess fixing this bug 
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=107316) solves this
problem as well.

.

Comment 3 David Williams CLA 2005-08-31 23:14:33 EDT
Agreed, probably a dup of 107316, but will leave open and up priority until
confirmed. 

Comment 4 David Williams CLA 2005-09-06 03:15:31 EDT
I believe fixing 106324 has fixed this problem as well. As always, if I've
missed something, don't heesitate to re-open. 

*** This bug has been marked as a duplicate of 106324 ***
Comment 5 Hirotaka Matsumoto CLA 2005-09-22 07:13:28 EDT
no, fixing bug106324 seems not to fix this. I still believe this
is the same as 107316.

.
Comment 6 David Williams CLA 2005-09-22 12:58:38 EDT
Agreed. Closing as 'dup' which doesn't mean this is invalid description/use
case, I'd just liked to track one place. 

*** This bug has been marked as a duplicate of 107316 ***
Comment 7 Hirotaka Matsumoto CLA 2005-11-16 06:47:33 EST
.