public final class Util extends Object
Modifier and Type | Method and Description |
---|---|
static void |
closeQuery(Query query)
Closes the given Query in case it is opened in a TopComponent the editor area.
|
static void |
createIssue(Repository repository,
String summary,
String description)
Creates a new
Issue instance prefilled with
the given summary and description and opens the Issue editor TopComponent. |
static void |
createNewIssue(Repository repository)
Creates a new Issue and opens it in the Issue editor TopComponent.
|
static void |
createNewQuery(Repository repository)
Creates a new Query and opens it in the Query editor TopComponent.
|
static void |
createNewQuery(Repository repository,
boolean suggestedRepositoryOnly)
Creates a new Query and opens it in the Query editor TopComponent.
|
static Repository |
createRepository()
Opens a modal create repository dialog and eventually returns a repository.
Blocks until the dialog isn't closed. |
static boolean |
edit(Repository repository)
Opens a dialog for editing a repository.
|
static String |
getIssueId(String issueHyperlinkText)
Transforms the given text to an issue identifier.
|
static int[] |
getIssueSpans(String text)
Finds boundaries of one or more references to issues in the given text.
|
static List<Issue> |
getRecentIssues()
Determines all issues which where recently opened (in this nb session)
ordered by their recency.
|
static Repository |
getTeamRepository(String url,
String projectName)
Returns a Repository corresponding to the given team url and a name.
|
static void |
openIssue(FileObject context,
String issueId)
Opens an issue with the given id in the Issue editor TopComponent.
|
static void |
openIssue(Repository repository,
String issueId)
Opens an issue in the Issue editor TopComponent.
|
static void |
selectQuery(Query query)
Opens the Tasks Dashboard and selects and expands the given Query in it.
|
public static void openIssue(Repository repository, String issueId)
repository
- the repository where where the given issueId originates fromissueId
- the issue idpublic static void openIssue(FileObject context, String issueId)
context
- a file which might be associated with a bugtracking repository.
In case there is no such association yet, than
a modal Repository picker dialog will be presented.issueId
- issue idpublic static void selectQuery(Query query)
query
- the Query to be selected in the Tasks Dasboardpublic static void closeQuery(Query query)
query
- public static void createNewQuery(Repository repository)
Once the Top Component was opened it is still possible for the user to eventually select a different repository.
repository
- the repository for which the Query is to be created.public static void createNewQuery(Repository repository, boolean suggestedRepositoryOnly)
Depending on suggestedRepositoryOnly
it either is or isn't
possible for the user to eventually select a different repository in the
opened Top Component.
repository
- the repository for which the Query is to be created.suggestedRepositoryOnly
- if true
then it isn't
possible for the user to change the repository for which a new query is to be created..public static void createNewIssue(Repository repository)
repository
- the repository for which the Issue is to be created.public static void createIssue(Repository repository, String summary, String description)
Issue
instance prefilled with
the given summary and description and opens the Issue editor TopComponent.repository
- the repository for which the Issue is to be created.summary
- the summary textdescription
- the description textpublic static Repository createRepository()
public static Repository getTeamRepository(String url, String projectName)
Please note that this method might block for a longer time. Do not execute in AWT.
url
- a url coming from a Team Server - e.g. kenai or java.net.
Might be representing either a team vcs repository, an issue or a team server host.projectName
- the name of a particular Team Server projectpublic static boolean edit(Repository repository)
repository
- the repository to be editedpublic static int[] getIssueSpans(String text)
null
and will contain an even number
of numbers. An empty array is a valid return value. The first number in
the array is an index of the beginning of a reference string,
the second number is an index of the first character after the reference
string. Next numbers express boundaries of other found references, if
any.
The reference substrings (given by indexes returned by this method)
may contain any text as long as the method Util.getIssueId(java.lang.String)
is able to
extract issue identifiers from them. E.g. it is correct that method
getIssueSpans()
, when given text "fixed the first bug",
returns array [6, 19]
(boundaries of substring
"the first bug"
) if method Util.getIssueId(java.lang.String)
can
deduce that substring "the first bug"
refers to bug
#1. In other words, only (boundaries of) substrings that method
Util.getIssueId(java.lang.String)
is able to transform the actual issue identifier,
should be returned by this method.
text
- text to be searched for referencesnull
array of boundaries of hyperlink references
in the given textpublic static String getIssueId(String issueHyperlinkText)
Note that this method is allowed be called in EDT.
issueHyperlinkText
- text that refers to a bug/issue