FileTreeModelNetworkController fileNetworkController = FileTreeModelNetworkController.create(fileTreeModel, fileTreeController, workspacePlace);
final Header header = Header.create(workspaceShellView.getHeaderView(), workspaceShellView, workspacePlace,
appContext, searchIndex, fileTreeModel);
final WorkspaceShell shell = WorkspaceShell.create(workspaceShellView, header);
// Add a HotKey listener for to auto-focus the AwesomeBox.
/* The GlobalHotKey stuff utilizes the wave signal event stuff which filters alt+enter as an unimportant
* event. This prevents us from using the GlobalHotKey manager here. Note: This is capturing since the
* editor likes to nom-nom keys, in the dart re-write lets think about this sort of stuff ahead of time. */
final EventRemover eventRemover = Elements.getBody().addEventListener(Event.KEYDOWN, new EventListener() {
@Override
public void handleEvent(Event evt) {
KeyboardEvent event = (KeyboardEvent)evt;
if (event.isAltKey() && event.getKeyCode() == KeyCode.ENTER) {
appContext.getAwesomeBoxComponentHostModel().revertToDefaultComponent();
header.getAwesomeBoxComponentHost().show();
}
}
}, true);
// Track this for removal in cleanup
keyListenerRemoverManager.track(new Remover() {
@Override
public void remove() {
eventRemover.remove();
}
});
codePanelBundle = new StandaloneCodeBundle(appContext, shell, fileTreeController, fileTreeModel, searchIndex,
documentManager, participantModel, docOpRecipient, workspacePlace){
@Override
protected ClientPluginService initPlugins(MultiPanel<?, ?> masterPanel) {
return plugins;
}
};
codePanelBundle.attach(true);
codePanelBundle.setMasterPanel(view);
// Attach to the DOM.
view.append(shell);
view.append(header);
workspacePlace.fireEvent(new NavigationAreaExpansionEvent(false));
documentManager.getLifecycleListenerRegistrar().add(new LifecycleListener() {
@Override
public void onDocumentUnlinkingFromFile(Document document) {
X_Log.info("unlinked from file",document);
}
@Override
public void onDocumentOpened(Document document, Editor editor) {
X_Log.info("opened",document);
}
@Override
public void onDocumentLinkedToFile(Document document,
FileContents fileContents) {
}
@Override
public void onDocumentGarbageCollected(Document document) {
X_Log.info("gc'd",document);
}
@Override
public void onDocumentCreated(Document document) {
}
@Override
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();