panel.setButtonAlign(HorizontalAlignment.CENTER);
final String msgStart = Messages.get("label.googleDocs.edit.start", "Start editing");
final String msgStop = Messages.get("label.googleDocs.edit.stop", "Stop editing");
final ToggleButton btnEdit = new ToggleButton(msgStart, StandardIconsProvider.STANDARD_ICONS.googleDocsLarge());
btnEdit.setScale(ButtonScale.LARGE);
btnEdit.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
if (btnEdit.isPressed()) {
com.google.gwt.user.client.Window.open(JahiaGWTParameters.getContextPath() + "/cms/gedit/"
+ JahiaGWTParameters.getWorkspace() + node.getPath(), "_blank", "");
btnEdit.setText(msgStop);
} else {
panel.mask(Messages.get("label.synchronizing", "Synchronizing..."), "x-mask-loading");
JahiaContentManagementService.App.getInstance().synchronizeWithGoogleDocs(node.getUUID(),
new BaseAsyncCallback<Void>() {
@Override