Exemplo n.º 1
0
  @Override
  protected void okPressed() {
    if (!isCommitWithoutFilesAllowed()) {
      MessageDialog.openWarning(
          getShell(),
          UIText.CommitDialog_ErrorNoItemsSelected,
          UIText.CommitDialog_ErrorNoItemsSelectedToBeCommitted);
      return;
    }

    if (!commitMessageComponent.checkCommitInfo()) return;

    Object[] checkedElements = filesViewer.getCheckedElements();
    selectedFiles.clear();
    for (Object obj : checkedElements) selectedFiles.add(((CommitItem) obj).path);

    amending = commitMessageComponent.isAmending();
    commitMessage = commitMessageComponent.getCommitMessage();
    author = commitMessageComponent.getAuthor();
    committer = commitMessageComponent.getCommitter();
    createChangeId = changeIdItem.getSelection();

    IDialogSettings settings = org.eclipse.egit.ui.Activator.getDefault().getDialogSettings();
    settings.put(SHOW_UNTRACKED_PREF, showUntracked);
    CommitMessageHistory.saveCommitHistory(getCommitMessage());
    super.okPressed();
  }
Exemplo n.º 2
0
  private void updateMessage() {
    if (commitButton == null)
      // Not yet fully initialized.
      return;

    String message = null;
    int type = IMessageProvider.NONE;

    String commitMsg = commitMessageComponent.getCommitMessage();
    if (commitMsg == null || commitMsg.trim().length() == 0) {
      message = UIText.CommitDialog_Message;
      type = IMessageProvider.INFORMATION;
    } else if (!isCommitWithoutFilesAllowed()) {
      message = UIText.CommitDialog_MessageNoFilesSelected;
      type = IMessageProvider.INFORMATION;
    } else {
      CommitStatus status = commitMessageComponent.getStatus();
      message = status.getMessage();
      type = status.getMessageType();
    }

    setMessage(message, type);
    boolean commitEnabled = type == IMessageProvider.WARNING || type == IMessageProvider.NONE;
    commitButton.setEnabled(commitEnabled);
    commitAndPushButton.setEnabled(commitEnabled);
  }
Exemplo n.º 3
0
 private void openStagingViewLinkClicked() {
   IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
   IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
   try {
     StagingView view = (StagingView) workbenchPage.showView(StagingView.VIEW_ID);
     view.reload(repository);
     String message = commitMessageComponent.getCommitMessage();
     if (message != null && message.length() > 0) view.setCommitMessage(message);
     setReturnCode(CANCEL);
     close();
   } catch (PartInitException e) {
     Activator.handleError(UIText.CommitDialog_OpenStagingViewError, e, true);
   }
 }