public void onDocumentClosed(Document document, Editor editor) {
X_Log.info("closed",document);
}
});
final GetWorkspaceMetaDataResponseImpl localRequest = GetWorkspaceMetaDataResponseImpl.make();
final ApiCallback<GetWorkspaceMetaDataResponse> callback = new ApiCallback<GetWorkspaceMetaDataResponse>() {
boolean once = true;
@Override
public void onMessageReceived(GetWorkspaceMetaDataResponse message) {
if (!workspacePlace.isActive() && localRequest.getWorkspaceName() == null) {
return;
}
if (once) {
once = false;
// Start the keep-alive timer at 5 second intervals.
keepAliveTimer = new KeepAliveTimer(appContext, 5000);
keepAliveTimer.start();
codePanelBundle.enterWorkspace(true, workspacePlace, message);
}
}
@Override
public void onFail(FailureReason reason) {
if (FailureReason.UNAUTHORIZED == reason) {
/* User is not authorized to access this workspace. At this point, the components of the
* WorkspacePlace already sent multiple requests to the frontend that are bound to fail with the
* same reason. However, we don't want to gate loading the workspace to handle the rare case that
* a user accesses a branch that they do not have permission to access. Better to make the
* workspace load fast and log errors if the user is not authorized. */
UnauthorizedUser unauthorizedUser = UnauthorizedUser.create(res);
shell.setPerspective(unauthorizedUser.getView().getElement());
}
}
};
CollideSettings settings = CollideSettings.get();
String file = settings.getOpenFile();
if (!X_String.isEmptyTrimmed(file)) {
localRequest.setWorkspaceName("Collide");
JsoArray<String> files = JsoArray.create();
files.add(file);
localRequest.setLastOpenFiles(files);
callback.onMessageReceived(localRequest);
}
// If nothing hardcoded in page, ask the server for data
appContext.getFrontendApi().GET_WORKSPACE_META_DATA.send(GetWorkspaceMetaDataImpl.make(), callback);
view.getAwesomeBoxComponentHost().show();