Deleted source file remains in navigator and model [message #1087857] |
Fri, 16 August 2013 03:32  |
Eclipse User |
|
|
|
When I delete a file from a source folder in the ScriptNavigator it doesn't always delete from the view. This is an inconsistent problem, sometimes it works and sometimes it doesn't.
Further, the source file that was deleted is still sent as source during project builds.
The file is deleted from the file system.
If after deleting from the source folder (Select File right-click Delete), when it does not delete, I can refresh the project. The deleted file appears to move from the source folder into the project root. I can select this file now, the delete option does not appear.
If I delete the file when in the Resource Navigator the file does delete, and disappears from the resource navigator view. When I switch back to the Script Navigator view the problem still exists.
It seems this inconsistent problem is not removing the deleted file from the model.
I don't see this problem occurring in Tcl, Python, or Javascript DLTK ides.
Update: If the file is opened in the editor, all the deletion processes work as expected. If the file is not opened, it is simply deleted in the explorer, this is when it happens.
[Updated on: Fri, 16 August 2013 04:24] by Moderator
|
|
|
|
Re: Deleted source file remains in navigator and model [message #1088717 is a reply to message #1088183] |
Sat, 17 August 2013 10:34   |
Eclipse User |
|
|
|
I'm sure this is a horrible kludge, but I could not find out why DLTK was not removing the SourceModule from the parent info in the delta processor and model updater.
This only happens in our custom language, it does not happen in python, tcl, ruby, or javascript.
It does not matter if the project has source in project root or source in separate folder(s).
Delete a file in the Script Explorer that is open in the editor. All is well.
Delete a file in the Script Explorer that is *not* open in the editor - the SourceModule is not removed from the parent folder's info. It is not removed from the explorer, it is not removed from the model.
It is still passed to the builder as if it still existed.
I refresh the project in the explorer, and somehow the file moves into the project root (has parent <default>). If I select Go Into in the explorer (after refresh) then come back out, it disappears from the explorer and from the model.
I wrote this kludge (renamed to protect the innocent)
public class MyModelContentProvider implements IModelContentProvider {
@Override
public void provideModelChanges(
Object parentElement,
@SuppressWarnings("rawtypes") List children,
ITreeContentProvider iTreeContentProvider)
{
for (int i = 0; i < children.size(); i++)
{
Object child = children.get(i);
if (child instanceof IModelElement)
{
IModelElement modelElement = (IModelElement)child;
boolean exists = modelElement.exists();
if (!exists)
{
if (child instanceof ISourceModule)
{
ISourceModule sourceModule = (ISourceModule)child;
try
{
Openable parent =
(Openable)sourceModule.getParent();
if (parent != null)
{
ModelElementInfo info =
(ModelElementInfo)parent.getElementInfo();
if (info != null)
info.removeChild(sourceModule);
}
}
catch (ModelException e)
{
e.printStackTrace();
}
}
children.remove(child);
}
}
}
}
}
This 'fixed' my problem.
[Updated on: Sat, 17 August 2013 10:36] by Moderator
|
|
|
Re: Deleted source file remains in navigator and model [message #1092725 is a reply to message #1088717] |
Fri, 23 August 2013 02:11  |
Eclipse User |
|
|
|
Hi Kevin,
I would say, that if it can't be reproduced with other languages - then
it makes sense to verify your model/resource listeners and content
providers if they always work correctly, etc. Perhaps something is
called when it should not, or an exception is thrown, etc.
Regards,
Alex
|
|
|
Powered by
FUDForum. Page generated in 0.45632 seconds