Rechtacek's

My notices, hints or tips
 Who Am I?
Which way?
Thursday Apr 10, 2008

Stop by at JavaOne's BOF: Consumer IDE

Are you attending JavaOne 2008? Geertjan Wielenga and I will be giving BOF
Toward a Consumer IDE: Get What You Want When You Want It. Come and see it on Wednesday May 7th 2008, it's starting 6:30 PM. You are highly welcome there.

Our Birds-on-a-Feather (BOF) Consumer IDE introduces a new approach. Provide a high-personalized distribution for users and allow users to customize the application on-the-fly and get exactly what they want to have. We show several demos of this functionality and then make a tutorial how to design application using that concept: a draft of API and code snippets are inclusive :-) Stop by...

Sunday Mar 30, 2008

Quick Check For Updates

As you know, a feature for updating or install new stuff into NetBeans IDE was completely resigned for NetBeans 6.0. Accordingly the Update Center Wizard menu item was replaced by Tools|Plugins menu item. However we got a feedback that some users can hardly find out how to check for IDE updates. On basis of this valuable feedback we add new one menu item Help|Check For Updates in NetBeans 6.1 what is coming soon. Thanks, NetBeans community.

So, there are three different way how to see available IDE updates in NetBeans 6.1:

  1. Invoke Plugin dialog and check Updates tab
  2. IDE periodically checks (once a week) for new updates. If there are some updates, a icon will be show in the status line.
  3. In the end, the new one menu item Check For Updates
  4. If an user invokes this one item, it opens the wizard which connects all subscribed Update Centers and search for new updates.

    If any updates found then the wizard follow user through update installation.

    If no updates are available it just says that IDE is up to date.

     

    I believe that UI improvement would be useful and helpful as well.

Monday Mar 17, 2008

Missing Modules Resolver (part II)

For those who are interested in implementation of Missing Modules Resolver I can show some implementation details.

The Missing Modules Resolver is built on the top of Autoupdate API and uses several Autoupdate services for find out broken modules, download&install missing modules to match its dependencies and enable them again in the end. Rest of implementation is just UI.

Okay, let's see the utilized services and look at code snippets.

Find out broken modules

Entry point into Autoupdate API is the
UpdateManager.getDefault ()
what providers set of units which can be browsed in UI and perform operations on them (i.e. install, update or unistall etc.) Each UpdateUnit represents a NetBeans module either as installed in IDE or available on Update Center. If a module is already installed but also has available higher version in any Update Center, the module has update one.
Now, we need find out modules what are already installed but aren't enabled in IDE.
Collection<UpdateUnit> units = UpdateManager.getDefault().getUpdateUnits(UpdateManager.TYPE.MODULE);
for (UpdateUnit unit : allUnits) {
if (unit.getInstalled() != null && ! unit.getInstalled().isEnabled()) {
res.add (unit.getInstalled());
}
}
Great, we have installed but disabled modules but how to diagnose the module is broken and cannot be enabled? Ask them why cannot be enable, i.e. get its broken dependencies. If there are some broken we have a candidate for resolving.
OperationContainer<operationsupport> forEnable = OperationContainer.createForEnable (); // take support for enabling modules
OperationContainer.OperationInfo<operationsupport> info = forEnable.add([installed-but-disabled-module]);
Set<string> broken = info.getBrokenDependencies(); // ask for broken dependencies
if (! broken.isEmpty()) { // if are some => we have the candidate
candidate.put(el, broken);
}

So, now we have all candidate for resolving its problems.

Look for missing modules

Now let's look for missing modules. Each candidate knows own broken dependencies. These dependencies are the clue for us to search out set of missing module which can fix these dependencies. There is a sample how to get it:

Collection<UpdateElement> missingModules = ...
OperationContainer.OperationInfo<operationsupport> info = forEnable.add([installed-but-disabled-module]);
Set<UpdateElement> reqs = new HashSet<UpdateElement>(info.getRequiredElements()); // add required modules
missing.addAll(reqs);
}

Great, we found out a collection of missing modules what are required by other modules in IDE. We should install them.

Download&Install

Take the operation container for install operation, put all missing modules into this container what can perform all action for install them: download, validate, install and restart IDE if needed.

OperationContainer<InstallSupport> forInstall = OperationContainer.createForInstall(); // take the install container
forInstall.add(missing-modules); // put all missing modules
InstallSupport installSupport = installContainer.getSupport(); // take the install support what is executive for actions above
ProgressHandle progress = ... // ProgressHandle
Validator v = installSupport.doDownload(progress); // perform download
Installer i = installSupport.doValidate(v, progress); // perform validation
Restarter r = installSupport.doInstall(i, progress); // perform install
if (r != null) { // need restart?
installSupport.doRestart(r, progress);
}

Enabled broken modules again

It's easy, just let's take a operation container for enabling modules, put all broken module and invoke enable action. All module should be able to turn on again.
OperationContainer<OperationSupport> forEnable = OperationContainer.createForEnable (); // take support for enabling modules
forEnable.add(candiates); // put all candidates
OperationSupport enableSupport = enableContainer.getSupport(); // take the enable support
ProgressHandle progress = ... // ProgressHandle enableSupport.doOperation(progress);

That's all :-)

Who would like to see all sources or contribute some improvements or fix bugs, go into contrib repository at http://hg.netbeans.org/main/contrib/. The NetBeans project takes name moduleresolver.
Bugs or RFE report into IssueZilla against component contrib and owner jrechtacek-AT-netbeans.org. Thanks for your feedback.

Friday Mar 14, 2008

Do you know the plugin Missing Modules Resolver?

Haven't you ever seen that NetBeans IDE cannot start all modules? And did the dialog Disable or Exit IDE come? It shouldn't but rarely happened sometime.

Disable or Exit dialog 

You have to decide to either disable the affected module/s or exit launching of IDE. There was no way how solve it. Only reinstall IDE or investigate the problem deeply. [1]

Now the plugin Missing Module Resolver could help you to resolve the problem. The resolver does find of all IDE modules which are installed but cannot be loaded by NetBeans Module System because have broken module-to-module dependency, probably some modules are missing. If the missing module is available on any Update Center then the Resolver will download and install them. In the end the Missing Module Resolver switch on the affected modules again.

How the resolver works?

  • Checks all modules installed in IDE if has some problem.
  • If any module cannot be loaded then pop-up a dialog with found problem.
  • You can invoke resolving the problem. The Missing Module Resolver query all Update Center if there is the missing module. If succeed then offer download and install it.
  • After install the affected module will be switch on again. And that's it :-)

How to get this module?

  • Download the NBM to your desktop
  • Invoke Tools|Plugins dialog
  • Install the NBM file in Download tab

or

  • the Missing Module Resolver could be presently on Beta Update Center in NB6.0 and NB6.1 and will be among Available plugins in Plugins dialog.

Try that plugin and enjoy it.

[1] Why a module cannot be switch on aka enabled? Most of module depends on other modules and cannot be loaded without them. If you are used to switching more user dirs or customize your IDE installation externally, it can lead to problems like that. Of course, it might be caused by Plugin Manager in case of bug ;-)



Archives
Locations of visitors to this page
Links
Referrers