示例#1
0
 @Override
 public void execute() {
   List<Project> selectedProjects =
       ProjectListBox.getProjectListBox().getProjectList().getSelectedProjects();
   if (selectedProjects.size() == 1) {
     downloadSource(selectedProjects.get(0));
   } else {
     // The user needs to select only one project.
     ErrorReporter.reportInfo(MESSAGES.wrongNumberProjectsSelected());
   }
 }
 @Override
 public void execute() {
   List<Project> selectedProjects =
       ProjectListBox.getProjectListBox().getProjectList().getSelectedProjects();
   if (selectedProjects.size() > 0) {
     // Show one confirmation window for selected projects.
     if (deleteConfirmation(selectedProjects)) {
       for (Project project : selectedProjects) {
         deleteProject(project);
       }
     }
   } else {
     // The user can select a project to resolve the
     // error.
     ErrorReporter.reportInfo(MESSAGES.noProjectSelectedForDelete());
   }
 }
  @Override
  public void execute(final ProjectNode node) {
    final MessagesOutput messagesOutput = MessagesOutput.getMessagesOutput();
    messagesOutput.addMessages(MESSAGES.downloadingToPhoneMessage());

    final RpcStatusPopup rpcStatusPopup = Ode.getInstance().getRpcStatusPopup();

    AsyncCallback<Void> callback =
        new AsyncCallback<Void>() {
          @Override
          public void onFailure(Throwable caught) {
            rpcStatusPopup.onFailure(FAKE_RPC_NAME, caught);
            ErrorReporter.reportError(MESSAGES.downloadToPhoneFailedMessage());
            executionFailedOrCanceled();
          }

          @Override
          public void onSuccess(Void result) {
            rpcStatusPopup.onSuccess(FAKE_RPC_NAME, result);
            Window.alert(MESSAGES.downloadToPhoneSucceededMessage());
            executeNextCommand(node);
          }
        };

    String packageName;
    if (node instanceof YoungAndroidProjectNode) {
      YoungAndroidProjectNode yaNode = (YoungAndroidProjectNode) node;
      packageName = yaNode.getPackageNode().getPackageName();
    } else {
      ErrorReporter.reportError(MESSAGES.downloadToPhoneFailedMessage());
      executionFailedOrCanceled();
      return;
    }

    rpcStatusPopup.onStart(FAKE_RPC_NAME);
    String apkFilePath =
        BUILD_FOLDER
            + "/"
            + YoungAndroidProjectNode.YOUNG_ANDROID_TARGET_ANDROID
            + "/"
            + node.getName()
            + ".apk";
    CodeblocksManager.getCodeblocksManager()
        .installApplication(apkFilePath, node.getName(), packageName, callback);
  }