hpanel.add(createManagedResourceStoreButton);
// See if we're already running from a ManagedResourceStore
try {
LocalServer server = Factory.getInstance().createLocalServer();
// This check to see if the host page can be served locally
if (server.canServeLocally(Window.Location.getPath())) {
createManagedResourceStoreButton.setText("Refresh Manifest");
// Give the user an opportunity to delete the MRS
hpanel.add(removeManagedResourceStoreButton);
}
} catch (GearsException e) {
// Gears probably isn't available (e.g. hosted mode)
}
createManagedResourceStoreButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
statusLabel.setText("Starting update");
createManagedResourceStore();
}
});
removeManagedResourceStoreButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
try {
LocalServer server = Factory.getInstance().createLocalServer();
ManagedResourceStore store = Offline.getManagedResourceStore();
server.removeManagedStore(store.getName());
statusLabel.setText("Removed ManagedResourceStore. Press Refresh to see Online version.");
createManagedResourceStoreButton.setEnabled(false);
removeManagedResourceStoreButton.setEnabled(false);
} catch (GearsException e) {
statusLabel.setText(e.getMessage());