Example #1
0
    @Override
    public void execute() {
      Tracking.trackEvent(
          Tracking.PROJECT_EVENT, Tracking.PROJECT_ACTION_DOWNLOAD_ALL_PROJECTS_SOURCE_YA);

      // Is there a way to disable the Download All button until this completes?
      Window.alert(MESSAGES.downloadAllAlert());

      Downloader.getInstance()
          .download(ServerLayout.DOWNLOAD_SERVLET_BASE + ServerLayout.DOWNLOAD_ALL_PROJECTS_SOURCE);
    }
    private void exportProject(Project project) {
      Tracking.trackEvent(
          Tracking.PROJECT_EVENT,
          Tracking.PROJECT_ACTION_DOWNLOAD_PROJECT_SOURCE_YA,
          project.getProjectName());

      Downloader.getInstance()
          .download(
              ServerLayout.DOWNLOAD_SERVLET_BASE
                  + ServerLayout.DOWNLOAD_PROJECT_SOURCE
                  + "/"
                  + project.getProjectId());
    }
    private void deleteProject(Project project) {
      Tracking.trackEvent(
          Tracking.PROJECT_EVENT,
          Tracking.PROJECT_ACTION_DELETE_PROJECT_YA,
          project.getProjectName());

      final long projectId = project.getProjectId();

      Ode ode = Ode.getInstance();
      boolean isCurrentProject = (projectId == ode.getCurrentYoungAndroidProjectId());
      ode.getEditorManager().closeProjectEditor(projectId);
      if (isCurrentProject) {
        // If we're deleting the project that is currently open in the Designer we
        // need to clear the ViewerBox first.
        ViewerBox.getViewerBox().clear();
      }
      // Make sure that we delete projects even if they are not open.
      doDeleteProject(projectId);
    }