This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 127969 - ModuleInstall.uninstalled() method never gets called
Summary: ModuleInstall.uninstalled() method never gets called
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Plugin Manager (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-21 02:05 UTC by Ch Nguyen
Modified: 2008-10-16 16:49 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
example code (5.19 KB, text/plain)
2008-02-21 02:07 UTC, Ch Nguyen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ch Nguyen 2008-02-21 02:05:09 UTC
I tried to use the uninstalled() of my class which extends from ModuleInstall.  But it doesn't seem to get called when
my module is being uninstalled by the Plugins Manager.  I'm attaching the code for reference.
Comment 1 Ch Nguyen 2008-02-21 02:07:18 UTC
Created attachment 56956 [details]
example code
Comment 2 Jesse Glick 2008-02-21 16:49:11 UTC
That's true. uninstalled() will be called if the module is uninstalled (or disabled) _while the IDE is running_. The 6.0
Plugin Manager never does this, since it was found to be often unreliable; it just shuts down the IDE, deletes the
module, and restarts.

The module system is behaving correctly, but perhaps the PM could explicitly call the uninstalled() method before
shutting down when module deletion (or disablement) is scheduled.

Anyway I am tempted to mark this WONTFIX since in general modules should not use uninstalled() to begin with. They may
use restored() to run code during startup, and close()/closing() during shutdown, but there is no guarantee they will be
notified in advance that they will be uninstalled, since this can always happen when the IDE is not running. I will
therefore deprecate uninstalled(), just as installed() and updated() were already: #5d1141abb4f0

In your case, your use of NbPreferences to track installation state is unreliable and wrong. All you can do is check in
restored() if the files are already there, and if not, install them. Of course far better would be to remove the
ModuleInstall entirely and rework the registration system so that it is purely declarative, using either the XML layer
or Lookup as appropriate; this would avoid running code on startup when your module is not being used, and relieve you
of the need for any special logic.
Comment 3 Jiri Rechtacek 2008-10-16 16:49:15 UTC
Not in our plan to fix it.