Examples of GetWorkspaceMetaDataResponseImpl


Examples of com.google.collide.dto.client.DtoClientImpls.GetWorkspaceMetaDataResponseImpl

      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();
View Full Code Here

Examples of com.google.collide.dto.server.DtoServerImpls.GetWorkspaceMetaDataResponseImpl

    vertx.eventBus()
        .registerHandler(addressBase + ".getMetaData", new Handler<Message<JsonObject>>() {
            @Override
          public void handle(final Message<JsonObject> requestEvent) {
            final GetWorkspaceMetaDataResponseImpl metaData =
                GetWorkspaceMetaDataResponseImpl.make()
                    .setRunTarget(runTarget).setWorkspaceName(webRoot);

            if (lastOpenedFileId != null) {
              // Resolve file to a path.
              vertx.eventBus().send("tree.getCurrentPaths", new JsonObject().putArray(
                  "resourceIds", new JsonArray().addString(lastOpenedFileId)),
                  new Handler<Message<JsonObject>>() {
                      @Override
                    public void handle(Message<JsonObject> event) {
                      List<String> openFiles = new ArrayList<String>();
                      openFiles.add((String) event.body.getArray("paths").toArray()[0]);
                      metaData.setLastOpenFiles(openFiles);
                      requestEvent.reply(Dto.wrap(metaData));
                    }
                  });
            }
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.