Package org.eclipse.egit.ui.internal.dialogs

Examples of org.eclipse.egit.ui.internal.dialogs.CreateTagDialog


    List<RepositoryCommit> commits = getCommits(event);
    if (commits.size() == 1) {
      RepositoryCommit commit = commits.get(0);

      Repository repository = commit.getRepository();
      CreateTagDialog dialog = new CreateTagDialog(
          HandlerUtil.getActiveShellChecked(event), commit
              .getRevCommit().getId(), repository);

      if (dialog.open() != Window.OK)
        return null;

      final TagBuilder tag = new TagBuilder();
      PersonIdent personIdent = new PersonIdent(repository);
      String tagName = dialog.getTagName();

      tag.setTag(tagName);
      tag.setTagger(personIdent);
      tag.setMessage(dialog.getTagMessage());
      tag.setObjectId(commit.getRevCommit());

      try {
        new TagOperation(repository, tag,
            dialog.shouldOverWriteTag())
            .execute(new NullProgressMonitor());
      } catch (CoreException e) {
        throw new ExecutionException(e.getMessage(), e);
      }

      if (dialog.shouldStartPushWizard())
        PushTagsWizard.openWizardDialog(repository, tagName);
    }
    return null;
  }
View Full Code Here


      Activator
          .handleError(UIText.TagAction_cannotGetBranchName, e, true);
      return null;
    }

    CreateTagDialog dialog = new CreateTagDialog(getShell(event),
        currentBranchName, repo);

    if (dialog.open() != IDialogConstants.OK_ID)
      return null;

    final TagBuilder tag = new TagBuilder();
    PersonIdent personIdent = new PersonIdent(repo);
    final String tagName = dialog.getTagName();

    tag.setTag(tagName);
    tag.setTagger(personIdent);
    tag.setMessage(dialog.getTagMessage());

    RevObject tagTarget;
    try {
      tagTarget = getTagTarget(repo, dialog.getTagCommit());
    } catch (IOException e1) {
      Activator.handleError(UIText.TagAction_unableToResolveHeadObjectId,
          e1, true);
      return null;
    }
    tag.setObjectId(tagTarget);

    String tagJobName = NLS.bind(UIText.TagAction_creating, tagName);
    final boolean shouldMoveTag = dialog.shouldOverWriteTag();

    Job tagJob = new Job(tagJobName) {
      protected IStatus run(IProgressMonitor monitor) {
        try {
          new TagOperation(repo, tag, shouldMoveTag).execute(monitor);
        } catch (CoreException e) {
          return Activator.createErrorStatus(
              UIText.TagAction_taggingFailed, e);
        } finally {
          GitLightweightDecorator.refresh();
        }

        return Status.OK_STATUS;
      }

      @Override
      public boolean belongsTo(Object family) {
        if (JobFamilies.TAG.equals(family))
          return true;
        return super.belongsTo(family);
      }
    };

    if (dialog.shouldStartPushWizard()) {
      tagJob.addJobChangeListener(new JobChangeAdapter() {
        @Override
        public void done(IJobChangeEvent jobChangeEvent) {
          if (jobChangeEvent.getResult().isOK())
            PushTagsWizard.openWizardDialog(repo, tagName);
View Full Code Here

public class CreateTagOnCommitHandler extends AbstractHistoryCommandHandler {
  public Object execute(ExecutionEvent event) throws ExecutionException {
    ObjectId commitId = getSelectedCommitId(event);
    final Repository repo = getRepository(event);

    CreateTagDialog dialog = new CreateTagDialog(
        HandlerUtil.getActiveShellChecked(event), commitId, repo);

    if (dialog.open() != Window.OK)
      return null;

    final TagBuilder tag = new TagBuilder();
    PersonIdent personIdent = new PersonIdent(repo);
    String tagName = dialog.getTagName();

    tag.setTag(tagName);
    tag.setTagger(personIdent);
    tag.setMessage(dialog.getTagMessage());
    tag.setObjectId(commitId, Constants.OBJ_COMMIT);

    try {
      new TagOperation(repo, tag, dialog.shouldOverWriteTag())
          .execute(new NullProgressMonitor());
    } catch (CoreException e) {
      throw new ExecutionException(e.getMessage(), e);
    }

    if (dialog.shouldStartPushWizard())
      PushTagsWizard.openWizardDialog(repo, tagName);

    return null;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.ui.internal.dialogs.CreateTagDialog

Copyright © 2018 www.massapicom. 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.