コード例 #1
0
  @Override
  public Object executeWithException(ExecutionEvent event, IStructuredSelection selection)
      throws OseeCoreException {
    Branch selectedBranch =
        Handlers.getBranchesFromStructuredSelection(selection).iterator().next();

    EntryDialog ed =
        new EntryDialog(
            "Set Associated Artifact",
            "Set Associated Artifact for Branch\n\n\""
                + selectedBranch.getName()
                + "\""
                + (selectedBranch.getAssociatedArtifactId() != null
                    ? "\n\nCurrently: " + selectedBranch.getAssociatedArtifactId()
                    : "")
                + "\n\nEnter new Artifact Id to associate:");
    ed.setEntry(String.valueOf(selectedBranch.getAssociatedArtifactId()));
    if (ed.open() == 0) {
      String artId = ed.getEntry();
      Artifact associatedArtifact =
          ArtifactQuery.getArtifactFromId(Integer.parseInt(artId), BranchManager.getCommonBranch());
      if (MessageDialog.openConfirm(
          Displays.getActiveShell(),
          "Set Associated Artifact",
          "Set Associated Artifact for Branch\n\n\""
              + selectedBranch.getName()
              + "\"\nto\nArtifact: "
              + associatedArtifact)) {
        selectedBranch.setAssociatedArtifactId(Integer.parseInt(artId));
        BranchManager.persist(selectedBranch);
      }
    }

    return null;
  }
コード例 #2
0
 public static Set<Artifact> getEmailGroupsAndUserGroups(User user) throws OseeCoreException {
   Set<Artifact> artifacts = new HashSet<Artifact>();
   for (Artifact art :
       ArtifactQuery.getArtifactListFromType(
           CoreArtifactTypes.UserGroup, BranchManager.getCommonBranch())) {
     // Only add group if have read permissions
     if (!art.getName().equals("Root Artifact")
         && AccessControlManager.hasPermission(art, PermissionEnum.READ)) {
       artifacts.add(art);
     }
   }
   return artifacts;
 }