本文整理汇总了Java中hudson.model.AutoCompletionCandidates类的典型用法代码示例。如果您正苦于以下问题:Java AutoCompletionCandidates类的具体用法?Java AutoCompletionCandidates怎么用?Java AutoCompletionCandidates使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AutoCompletionCandidates类属于hudson.model包,在下文中一共展示了AutoCompletionCandidates类的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: testAutoComplete
import hudson.model.AutoCompletionCandidates; //导入依赖的package包/类
@Test
public void testAutoComplete() {
new ConnectionHelper(auth); // Initialise default connection
NavigateHelper nav = new NavigateHelper(5);
AutoCompletionCandidates results = nav.getCandidates("//");
assertNotNull(results);
assertEquals(2, results.getValues().size());
results = nav.getCandidates("//de");
assertNotNull(results);
assertEquals("//depot/", results.getValues().get(0));
results = nav.getCandidates("//depot/");
assertNotNull(results);
assertEquals("//depot/Data/", results.getValues().get(0));
results = nav.getCandidates("//depot/Data/");
assertNotNull(results);
assertEquals("//depot/Data/file-0.dat", results.getValues().get(0));
}
示例8: testDoAutoCompleteStageName
import hudson.model.AutoCompletionCandidates; //导入依赖的package包/类
@Test
public void testDoAutoCompleteStageName() throws Exception {
final PipelineProperty.DescriptorImpl descriptor = new PipelineProperty.DescriptorImpl();
FreeStyleProject build = jenkins.createFreeStyleProject("build");
FreeStyleProject build2 = jenkins.createFreeStyleProject("build2");
jenkins.createFreeStyleProject("build3");
build2.addProperty(new PipelineProperty());
build.addProperty(new PipelineProperty("Build", "Build", ""));
AutoCompletionCandidates c1 = descriptor.doAutoCompleteStageName("B");
assertEquals(c1.getValues().size(), 1);
AutoCompletionCandidates c2 = descriptor.doAutoCompleteStageName("A");
assertEquals(c2.getValues().size(), 0);
AutoCompletionCandidates c3 = descriptor.doAutoCompleteStageName(null);
assertEquals(c3.getValues().size(), 0);
}
示例9: 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
}
示例10: 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;
}
示例11: doAutoCompleteUpstreamProjectName
import hudson.model.AutoCompletionCandidates; //导入依赖的package包/类
/**
* Fill the project name automatically.
*
* @param value Seed value.
* @param project Ancestor project.
* @return the autocompletion candidates.
*/
public AutoCompletionCandidates doAutoCompleteUpstreamProjectName(
@QueryParameter String value,
@AncestorInPath Job<?,?> project
) {
// Specified Item to allow to autocomplete folders (maybe confusing...).
return project == null
? new AutoCompletionCandidates()
: AutoCompletionCandidates.ofJobNames(Item.class, value, project, project.getParent());
}
示例12: 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;
}
示例13: 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;
}
示例14: 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;
}
示例15: getCandidates
import hudson.model.AutoCompletionCandidates; //导入依赖的package包/类
private AutoCompletionCandidates getCandidates() {
AutoCompletionCandidates c = new AutoCompletionCandidates();
for (Node node : nodes) {
c.add(node.getDepotPath());
}
return c;
}