本文整理汇总了Java中hudson.model.AutoCompletionCandidates.add方法的典型用法代码示例。如果您正苦于以下问题:Java AutoCompletionCandidates.add方法的具体用法?Java AutoCompletionCandidates.add怎么用?Java AutoCompletionCandidates.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.AutoCompletionCandidates
的用法示例。
在下文中一共展示了AutoCompletionCandidates.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAutoCompletionList
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
private static AutoCompletionCandidates createAutoCompletionList(Iterable<File> files) {
if (Iterables.size(files) == 0) {
return NO_SUGGESTIONS;
}
AutoCompletionCandidates candidates = new AutoCompletionCandidates();
for (File file : files) {
try {
String absolutePath = file.getAbsolutePath();
candidates.add(absolutePath);
} catch (SecurityException ex) {
// no permissions to list a directory
}
}
return candidates;
}
示例2: doAutoCompletePin
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
public AutoCompletionCandidates doAutoCompletePin(
@QueryParameter String value) {
AutoCompletionCandidates c = new AutoCompletionCandidates();
try {
IOptionsServer iserver = ConnectionFactory.getConnection();
if (iserver != null && value.length() > 0) {
List<ILabelSummary> list;
GetLabelsOptions opts = new GetLabelsOptions();
opts.setMaxResults(10);
opts.setNameFilter(value + "*");
list = iserver.getLabels(null, opts);
for (ILabelSummary l : list) {
c.add(l.getName());
}
}
} catch (Exception e) {
}
return c;
}
示例3: autoCompleteName
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
static public AutoCompletionCandidates autoCompleteName(
@QueryParameter String value) {
AutoCompletionCandidates c = new AutoCompletionCandidates();
try {
IOptionsServer iserver = ConnectionFactory.getConnection();
if (iserver != null && value.length() > 0) {
String user = iserver.getUserName();
List<IClientSummary> list;
list = iserver.getClients(user, value + "*", 10);
for (IClientSummary l : list) {
c.add(l.getName());
}
}
} catch (Exception e) {
}
return c;
}
示例4: doAutoCompleteStreamName
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
static public AutoCompletionCandidates doAutoCompleteStreamName(
@QueryParameter String value) {
AutoCompletionCandidates c = new AutoCompletionCandidates();
try {
IOptionsServer iserver = ConnectionFactory.getConnection();
if (iserver != null && value.length() > 1) {
List<String> streamPaths = new ArrayList<String>();
streamPaths.add(value + "...");
GetStreamsOptions opts = new GetStreamsOptions();
opts.setMaxResults(10);
List<IStreamSummary> list = iserver.getStreams(streamPaths,
opts);
for (IStreamSummary l : list) {
c.add(l.getStream());
}
}
} catch (Exception e) {
}
return c;
}
示例5: doAutoCompleteTemplateName
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
/**
* Provides auto-completion for workspace names. Stapler finds this method
* via the naming convention.
*
* @param value The text that the user entered.
* @return suggestion
*/
static public AutoCompletionCandidates doAutoCompleteTemplateName(
@QueryParameter String value) {
AutoCompletionCandidates c = new AutoCompletionCandidates();
try {
IOptionsServer iserver = ConnectionFactory.getConnection();
if (iserver != null && value.length() > 0) {
List<IClientSummary> list;
GetClientsOptions opts = new GetClientsOptions();
opts.setMaxResults(10);
opts.setNameFilter(value + "*");
list = iserver.getClients(opts);
for (IClientSummary l : list) {
c.add(l.getName());
}
}
} catch (Exception e) {
}
return c;
}
示例6: doAutoCompleteUser
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
public AutoCompletionCandidates doAutoCompleteUser(
@QueryParameter String value) {
AutoCompletionCandidates c = new AutoCompletionCandidates();
try {
IOptionsServer iserver = ConnectionFactory.getConnection();
if (iserver != null && value.length() > 0) {
List<String> users = new ArrayList<String>();
users.add(value + "*");
List<IUserSummary> list;
list = iserver.getUsers(users, 10);
for (IUserSummary l : list) {
c.add(l.getLoginName());
}
}
} catch (Exception e) {
}
return c;
}
示例7: doAutoCompleteComposition
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
public AutoCompletionCandidates doAutoCompleteComposition(@QueryParameter String cloudTestServerID) throws IOException, InterruptedException {
CloudTestServer s = CloudTestServer.getByID(cloudTestServerID);
ArgumentListBuilder args = new ArgumentListBuilder();
args.add(install(s))
.add("list", "type=composition")
.add("url=" + s.getUrl())
.add("username=" + s.getUsername());
if (s.getPassword() != null)
args.addMasked("password=" + s.getPassword());
ByteArrayOutputStream out = new ByteArrayOutputStream();
int exit = new LocalLauncher(TaskListener.NULL).launch().cmds(args).stdout(out).join();
if (exit==0) {
BufferedReader r = new BufferedReader(new StringReader(out.toString()));
AutoCompletionCandidates a = new AutoCompletionCandidates();
String line;
while ((line=r.readLine())!=null) {
if (line.endsWith("object(s) found.")) continue;
a.add(line);
}
return a;
}
return new AutoCompletionCandidates(); // no candidate
}
示例8: doAutoCompleteState
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
/**
* This method provides auto-completion items for the 'state' field.
* Stapler finds this method via the naming convention.
*
* @param value
* The text that the user entered.
*/
public AutoCompletionCandidates doAutoCompleteState(@QueryParameter String value) {
AutoCompletionCandidates c = new AutoCompletionCandidates();
for (String state : STATES)
if (state.toLowerCase().startsWith(value.toLowerCase()))
c.add(state);
return c;
}
示例9: doAutoCompleteProjects
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
/**
* Autocompletion method
*
* Copied from hudson.tasks.BuildTrigger.doAutoCompleteChildProjects(String value)
*
* @param value
* @return
*/
public AutoCompletionCandidates doAutoCompleteProjects(@QueryParameter String value, @AncestorInPath ItemGroup context) {
AutoCompletionCandidates candidates = new AutoCompletionCandidates();
List<Job> jobs = Jenkins.getInstance().getAllItems(Job.class);
for (Job job: jobs) {
String relativeName = job.getRelativeNameFrom(context);
if (relativeName.startsWith(value)) {
if (job.hasPermission(Item.READ)) {
candidates.add(relativeName);
}
}
}
return candidates;
}
示例10: doAutoCompleteLabels
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
public AutoCompletionCandidates doAutoCompleteLabels(Job<?, ?> job, String query) {
AutoCompletionCandidates result = new AutoCompletionCandidates();
// show all suggestions for short strings
if (query.length() < 2) {
result.add(getProjectLabelsAsArray(job));
} else {
for (String branch : getProjectLabelsAsArray(job)) {
if (branch.toLowerCase().contains(query.toLowerCase())) {
result.add(branch);
}
}
}
return result;
}
示例11: doAutoCompleteBranchesSpec
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
public AutoCompletionCandidates doAutoCompleteBranchesSpec(Job<?, ?> job, String query) {
AutoCompletionCandidates result = new AutoCompletionCandidates();
// show all suggestions for short strings
if (query.length() < 2) {
result.add(getProjectBranchesAsArray(job));
} else {
for (String branch : getProjectBranchesAsArray(job)) {
if (branch.toLowerCase().contains(query.toLowerCase())) {
result.add(branch);
}
}
}
return result;
}
示例12: getCandidates
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
private AutoCompletionCandidates getCandidates() {
AutoCompletionCandidates c = new AutoCompletionCandidates();
for (Node node : nodes) {
c.add(node.getDepotPath());
}
return c;
}
示例13: doAutoCompleteStageName
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
public AutoCompletionCandidates doAutoCompleteStageName(@QueryParameter String value) {
if (value != null) {
AutoCompletionCandidates candidates = new AutoCompletionCandidates();
Set<String> stages = getStageNames();
for (String stage : stages) {
if (stage.toLowerCase().startsWith(value.toLowerCase())) {
candidates.add(stage);
}
}
return candidates;
} else {
return new AutoCompletionCandidates();
}
}
示例14: doAutoCompleteChrootName
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
public AutoCompletionCandidates doAutoCompleteChrootName(@QueryParameter String value) {
AutoCompletionCandidates c = new AutoCompletionCandidates();
for (ChrootToolset set : ChrootToolset.list()) {
if(set.getName().startsWith(value))
c.add(set.getName());
}
return c;
}
示例15: doAutoCompleteLabelExpression
import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
/**
* Autocomplete for LabelExpression.
*
* @param value
* @return
*/
public AutoCompletionCandidates doAutoCompleteLabelExpression(
@QueryParameter String value
)
{
AutoCompletionCandidates c = new AutoCompletionCandidates();
if(StringUtils.isEmpty(value))
{
return c;
}
// candidate labels
Set<Label> labels = Jenkins.getInstance().getLabels();
// current inputting value
StringTokenizer t = new StringTokenizer(value);
String currentValue = null;
while(t.hasMoreTokens())
{
currentValue = t.nextToken();
}
if(StringUtils.isEmpty(currentValue))
{
return c;
}
List<String> cands = new ArrayList<String>();
for(Label l : labels)
{
if(l.getName().startsWith(currentValue))
{
cands.add(l.getName());
}
}
Collections.sort(cands);
for(String s: cands)
{
c.add(s);
}
return c;
}