Deleted source file remains in navigator and model [message #1087857] |
Fri, 16 August 2013 07:32 |
Kevin Hagel Messages: 26 Registered: December 2012 |
Junior Member |
|
|
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 08:24] Report message to a moderator
|
|
|
|
Re: Deleted source file remains in navigator and model [message #1088717 is a reply to message #1088183] |
Sat, 17 August 2013 14:34 |
Kevin Hagel Messages: 26 Registered: December 2012 |
Junior Member |
|
|
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 14:36] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03411 seconds