@Override
 public void onClose(@Nonnull final AsyncCallback<Void> callback) {
   if (isDirty()) {
     dialogFactory
         .createConfirmDialog(
             constant.askWindowCloseTitle(),
             constant.askWindowSaveChangesMessage(getEditorInput().getName()),
             new ConfirmCallback() {
               @Override
               public void accepted() {
                 doSave();
                 handleClose();
                 callback.onSuccess(null);
               }
             },
             new CancelCallback() {
               @Override
               public void cancelled() {
                 handleClose();
                 callback.onSuccess(null);
               }
             })
         .show();
   } else {
     handleClose();
     callback.onSuccess(null);
   }
 }
 /** {@inheritDoc} */
 @Override
 public void onDeleteClicked(@Nonnull final KeyItem key) {
   dialogFactory
       .createConfirmDialog(
           constant.deleteSshKeyTitle(),
           constant.deleteSshKeyQuestion(key.getHost()).asString(),
           getConfirmCallbackForDelete(key),
           getCancelCallback())
       .show();
 }
Beispiel #3
0
 private void renameBranch() {
   final String selectedBranchName = getSelectedBranchName();
   dialogFactory
       .createInputDialog(
           constant.branchTitleRename(),
           constant.branchTypeRename(),
           selectedBranchName,
           0,
           selectedBranchName.length(),
           getNewBranchNameCallback(),
           null)
       .show();
 }
 /** Log in github */
 private void oAuthLoginStart() {
   dialogFactory
       .createConfirmDialog(
           constant.githubSshKeyTitle(),
           constant.githubSshKeyLabel(),
           new ConfirmCallback() {
             @Override
             public void accepted() {
               showPopUp();
             }
           },
           null)
       .show();
 }
Beispiel #5
0
 /** {@inheritDoc} */
 @Override
 public void onRenameClicked() {
   if (selectedBranch.isRemote()) {
     dialogFactory
         .createConfirmDialog(
             constant.branchConfirmRenameTitle(),
             constant.branchConfirmRenameMessage(),
             getConfirmRenameBranchCallback(),
             null)
         .show();
   } else {
     renameBranch();
   }
 }
 /** {@inheritDoc} */
 @Override
 public void onCloseClicked() {
   boolean haveUnsavedData = false;
   for (PreferencePagePresenter preference : preferences) {
     if (preference.isDirty()) {
       haveUnsavedData = true;
     }
   }
   if (haveUnsavedData) {
     dialogFactory
         .createConfirmDialog(
             "", locale.messagesPromptSaveChanges(), getConfirmCallback(), getCancelCallback())
         .show();
   } else {
     view.close();
   }
   view.enableSaveButton(false);
 }
Beispiel #7
0
  /** {@inheritDoc} */
  @Override
  public void onCreateClicked() {
    dialogFactory
        .createInputDialog(
            constant.branchCreateNew(),
            constant.branchTypeNew(),
            new InputCallback() {
              @Override
              public void accepted(String value) {
                if (!value.isEmpty()) {
                  service.branchCreate(
                      workspaceId,
                      project.getRootProject(),
                      value,
                      null,
                      new AsyncRequestCallback<Branch>(
                          dtoUnmarshallerFactory.newUnmarshaller(Branch.class)) {
                        @Override
                        protected void onSuccess(Branch result) {
                          getBranches();
                        }

                        @Override
                        protected void onFailure(Throwable exception) {
                          final String errorMessage =
                              (exception.getMessage() != null)
                                  ? exception.getMessage()
                                  : constant.branchCreateFailed();
                          final GitOutputConsole console =
                              gitOutputConsoleFactory.create(BRANCH_CREATE_COMMAND_NAME);
                          console.printError(errorMessage);
                          consolesPanelPresenter.addCommandOutput(
                              appContext.getDevMachineId(), console);
                          notificationManager.notify(
                              constant.branchCreateFailed(), FAIL, true, project.getRootProject());
                        }
                      });
                }
              }
            },
            null)
        .show();
  }
  @Override
  protected void onSuccessAuthentication() {
    reset();

    if (appContext.getCurrentProject() != null) {
      // Check is Git repository:
      ProjectConfigDto projectConfig = appContext.getCurrentProject().getRootProject();
      List<String> listVcsProvider = projectConfig.getAttributes().get("vcs.provider.name");
      if (listVcsProvider != null && listVcsProvider.contains("git")) {
        getGitRemoteRepositories(projectConfig);
      } else {
        dialogFactory
            .createMessageDialog(
                locale.notGitRepositoryWarningTitle(),
                locale.notGitRepositoryWarning(projectConfig.getName()),
                null)
            .show();
      }
    }
  }
  @Test
  public void shouldShowConfirmDialogWhenCommandHasNotFinished() throws Exception {
    ConfirmDialog confirmDialog = mock(ConfirmDialog.class);
    ProcessTreeNode commandNode = mock(ProcessTreeNode.class);

    when(outputConsole.isFinished()).thenReturn(false);
    presenter.consoles.put(PROCESS_ID, outputConsole);

    when(commandNode.getId()).thenReturn(PROCESS_ID);
    when(dialogFactory.createConfirmDialog(anyString(), anyString(), anyObject(), anyObject()))
        .thenReturn(confirmDialog);

    presenter.onCloseCommandOutputClick(commandNode);

    verify(commandNode).getId();
    verify(view, never()).hideProcessOutput(anyString());
    verify(view, never()).removeProcessNode(anyObject());
    verify(dialogFactory).createConfirmDialog(anyString(), anyString(), anyObject(), anyObject());
    verify(confirmDialog).show();
  }
  /** {@inheritDoc} */
  @Override
  public void onCloseClicked() {
    boolean haveUnsavedData = false;

    for (SettingsPagePresenter presenter : settings) {
      if (presenter.isDirty()) {
        haveUnsavedData = true;
      }
    }

    if (!haveUnsavedData) {
      view.close();

      return;
    }

    dialogFactory
        .createConfirmDialog(
            "", locale.messagesPromptSaveChanges(), getConfirmCallback(), getCancelCallback())
        .show();
  }