当前位置: 首页>>代码示例>>Java>>正文


Java AutoCompletionCandidates.add方法代码示例

本文整理汇总了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;
}
 
开发者ID:spoonapps,项目名称:jenkins,代码行数:17,代码来源:AutoCompletion.java

示例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;
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:21,代码来源:P4SyncDescriptor.java

示例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;
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:20,代码来源:WorkspaceDescriptor.java

示例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;
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:23,代码来源:WorkspaceDescriptor.java

示例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;
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:29,代码来源:WorkspaceDescriptor.java

示例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;
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:21,代码来源:FilterUserImpl.java

示例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
}
 
开发者ID:jenkinsci,项目名称:cloudtest-plugin,代码行数:27,代码来源:TestCompositionRunner.java

示例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;
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:15,代码来源:AutoCompleteTextBox.java

示例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;
}
 
开发者ID:damienbiggs,项目名称:parameter-pool-plugin,代码行数:22,代码来源:ParameterPoolBuilder.java

示例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;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:15,代码来源:ProjectLabelsProvider.java

示例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;
}
 
开发者ID:jenkinsci,项目名称:gitlab-plugin,代码行数:15,代码来源:ProjectBranchesProvider.java

示例12: getCandidates

import hudson.model.AutoCompletionCandidates; //导入方法依赖的package包/类
private AutoCompletionCandidates getCandidates() {
	AutoCompletionCandidates c = new AutoCompletionCandidates();
	for (Node node : nodes) {
		c.add(node.getDepotPath());
	}
	return c;
}
 
开发者ID:p4paul,项目名称:p4-jenkins,代码行数:8,代码来源:NavigateHelper.java

示例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();
    }
}
 
开发者ID:Diabol,项目名称:delivery-pipeline-plugin,代码行数:16,代码来源:PipelineProperty.java

示例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;
}
 
开发者ID:rmohr,项目名称:chroot-plugin,代码行数:9,代码来源:ChrootBuilder.java

示例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;
}
 
开发者ID:ikedam,项目名称:scoring-load-balancer,代码行数:52,代码来源:BuildPreference.java


注:本文中的hudson.model.AutoCompletionCandidates.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。