}
@Override
protected Toolbar createMainToolbar()
{
Toolbar toolbar = new Toolbar();
// install packages
toolbar.addLeftWidget(commands_.installPackage().createToolbarButton());
toolbar.addLeftSeparator();
// update packages
toolbar.addLeftWidget(commands_.updatePackages().createToolbarButton());
prePackratSeparator_ = toolbar.addLeftSeparator();
// packrat (all packrat UI starts out hidden and then appears
// in response to changes in the packages state)
// create packrat bootstrap button
packratBootstrapButton_ = commands_.packratBootstrap().createToolbarButton(false);
toolbar.addLeftWidget(packratBootstrapButton_);
packratBootstrapButton_.setVisible(false);
// create packrat menu + button
ToolbarPopupMenu packratMenu = new ToolbarPopupMenu();
packratMenu.addItem(commands_.packratHelp().createMenuItem(false));
packratMenu.addSeparator();
packratMenu.addItem(commands_.packratClean().createMenuItem(false));
packratMenu.addItem(commands_.packratBundle().createMenuItem(false));
packratMenu.addSeparator();
packratMenu.addItem(commands_.packratOptions().createMenuItem(false));
packratMenuButton_ = new ToolbarButton(
"Packrat", commands_.packratBootstrap().getImageResource(),
packratMenu
);
toolbar.addLeftWidget(packratMenuButton_);
packratMenuButton_.setVisible(false);
packratSeparator_ = toolbar.addLeftSeparator();
packratSeparator_.setVisible(false);
toolbar.addLeftWidget(commands_.refreshPackages().createToolbarButton());
searchWidget_ = new SearchWidget(new SuggestOracle() {
@Override
public void requestSuggestions(Request request, Callback callback)
{
// no suggestions
callback.onSuggestionsReady(
request,
new Response(new ArrayList<Suggestion>()));
}
});
searchWidget_.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event)
{
observer_.onPackageFilterChanged(event.getValue().trim());
}
});
toolbar.addRightWidget(searchWidget_);
return toolbar;
}