本文整理汇总了Java中hudson.util.ListBoxModel.add方法的典型用法代码示例。如果您正苦于以下问题:Java ListBoxModel.add方法的具体用法?Java ListBoxModel.add怎么用?Java ListBoxModel.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.util.ListBoxModel
的用法示例。
在下文中一共展示了ListBoxModel.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFillConnectionIdItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Fills in the Host Connection selection box with applicable connections.
*
* @param context
* filter for host connections
* @param connectionId
* an existing host connection identifier; can be null
* @param project
* the Jenkins project
*
* @return host connection selections
*/
public ListBoxModel doFillConnectionIdItems(@AncestorInPath Jenkins context, @QueryParameter String connectionId,
@AncestorInPath Item project)
{
CpwrGlobalConfiguration globalConfig = CpwrGlobalConfiguration.get();
HostConnection[] hostConnections = globalConfig.getHostConnections();
ListBoxModel model = new ListBoxModel();
model.add(new Option(StringUtils.EMPTY, StringUtils.EMPTY, false));
for (HostConnection connection : hostConnections)
{
boolean isSelected = false;
if (connectionId != null)
{
isSelected = connectionId.matches(connection.getConnectionId());
}
model.add(new Option(connection.getDescription() + " [" + connection.getHostPort() + ']', //$NON-NLS-1$
connection.getConnectionId(), isSelected));
}
return model;
}
示例2: doFillTypeItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillTypeItems() {
ListBoxModel r = new ListBoxModel();
r.add("<any>", "");
for (ToolDescriptor<?> desc : ToolInstallation.all()) {
String idOrSymbol = desc.getId();
Set<String> symbols = SymbolLookup.getSymbolValue(desc);
if (!symbols.isEmpty()) {
idOrSymbol = symbols.iterator().next();
}
r.add(desc.getDisplayName(), idOrSymbol);
}
return r;
}
示例3: doFillBuildDefinitionItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillBuildDefinitionItems(@QueryParameter String serverUrl, @QueryParameter String username,
@QueryParameter Secret password, @QueryParameter String project) throws URISyntaxException {
ListBoxModel items = new ListBoxModel();
if (validInputs(serverUrl, username, password, project)) {
try {
TfsClient client = getTfsClientFactory().getValidatedClient(serverUrl, username, password);
List<DefinitionReference> definitions = client.getBuildClient().getDefinitions(UUID.fromString(project));
for (DefinitionReference definition : definitions) {
items.add(definition.getName(), String.valueOf(definition.getId()));
}
} catch (VssServiceException vse) {
return items;
}
}
return items;
}
示例4: doFillRepoItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Function to populate the repositories drop down menu in the job configuration
* @return All the local repositories on the artifactory server
*/
public ListBoxModel doFillRepoItems()
{
ListBoxModel items = new ListBoxModel();
ArtifactoryAPI api = new ArtifactoryAPI(artifactoryServer);
JSONArray json = api.getRepositories();
for (int i = 0; i < json.size(); i++)
{
JSONObject jsonRepo = json.getJSONObject(i);
if(jsonRepo.getString("type").equals("LOCAL"))
{
items.add(jsonRepo.getString("key"), jsonRepo.getString("key"));
}
}
return items;
}
示例5: doFillRegionItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillRegionItems(@QueryParameter final String credentialsId,
@QueryParameter final String region)
throws IOException, ServletException {
final List<Region> regionList;
try {
final AmazonEC2 client = connect(credentialsId, null);
final DescribeRegionsResult regions=client.describeRegions();
regionList=regions.getRegions();
} catch(final Exception ex) {
//Ignore bad exceptions
return new ListBoxModel();
}
final ListBoxModel model = new ListBoxModel();
for(final Region reg : regionList) {
model.add(new ListBoxModel.Option(reg.getRegionName(), reg.getRegionName()));
}
return model;
}
示例6: doFillGroupIdItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillGroupIdItems(@QueryParameter final boolean useOwnServerCredentials, @QueryParameter final String serverUrl,
@QueryParameter final String username, @QueryParameter final String password, @QueryParameter final String timestamp, @QueryParameter final String credentialsId) {
// timestamp is not used in code, it is one of the arguments to invalidate Internet Explorer cache
ListBoxModel listBoxModel = new ListBoxModel();
try {
CxCredentials credentials = CxCredentials.resolveCredentials(!useOwnServerCredentials, serverUrl, username, getPasswordPlainText(password), credentialsId, this);
final CxWebService cxWebService = prepareLoggedInWebservice(credentials);
final List<Group> groups = cxWebService.getAssociatedGroups();
for (Group group : groups) {
listBoxModel.add(new ListBoxModel.Option(group.getGroupName(), group.getID()));
}
STATIC_LOGGER.info("Associated groups list: " + listBoxModel.size());
return listBoxModel;
} catch (Exception e) {
STATIC_LOGGER.error("Failed to populate team list: " + e.toString());
STATIC_LOGGER.info("Associated groups: empty");
String message = "Provide Checkmarx server credentials to see teams list";
listBoxModel.add(new ListBoxModel.Option(message, message));
return listBoxModel; // Return empty list of project names
}
}
示例7: doFillRegionItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillRegionItems(@QueryParameter boolean useInstanceProfileForCredentials,
@QueryParameter String accessId, @QueryParameter String secretKey,
@QueryParameter String region) throws IOException, ServletException {
ListBoxModel model = new ListBoxModel();
if (testMode) {
model.add(DEFAULT_EC2_HOST);
return model;
}
if (useInstanceProfileForCredentials || (!StringUtils.isEmpty(accessId) && !StringUtils.isEmpty(secretKey))) {
AWSCredentialsProvider credentialsProvider = createCredentialsProvider(useInstanceProfileForCredentials, accessId, secretKey);
AmazonEC2 client = connect(credentialsProvider, new URL("http://ec2.amazonaws.com"));
DescribeRegionsResult regions = client.describeRegions();
List<Region> regionList = regions.getRegions();
for (Region r : regionList) {
String name = r.getRegionName();
model.add(name, name);
}
}
return model;
}
示例8: doFillVersionKeyItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillVersionKeyItems(@QueryParameter String projectKey, @QueryParameter String serverAddress) {
ListBoxModel m = new ListBoxModel();
if (StringUtils.isBlank(projectKey)
|| projectKey.trim().equals(ADD_ZEPHYR_GLOBAL_CONFIG)
|| (this.jiraInstances.size() == 0)) {
m.add(ADD_ZEPHYR_GLOBAL_CONFIG);
return m;
}
long parseLong = Long.parseLong(projectKey);
RestClient restClient = getRestclient(serverAddress);
Map<Long, String> versions = Version.getVersionsByProjectID(parseLong, restClient);
Set<Entry<Long, String>> versionEntrySet = versions.entrySet();
for (Iterator<Entry<Long, String>> iterator = versionEntrySet.iterator(); iterator.hasNext();) {
Entry<Long, String> entry = iterator.next();
m.add(entry.getValue(), entry.getKey()+"");
}
restClient.destroy();
return m;
}
示例9: doFillCycleKeyItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillCycleKeyItems(@QueryParameter String versionKey, @QueryParameter String serverAddress, @QueryParameter String projectKey) {
ListBoxModel m = new ListBoxModel();
if (StringUtils.isBlank(versionKey)
|| versionKey.trim().equals(ADD_ZEPHYR_GLOBAL_CONFIG)
|| (this.jiraInstances.size() == 0)) {
m.add(ADD_ZEPHYR_GLOBAL_CONFIG);
return m;
}
long parseLong = Long.parseLong(versionKey);
RestClient restClient = getRestclient(serverAddress);
Map<Long, String> cycles = Cycle.getAllCyclesByVersionId(parseLong, restClient, projectKey);
Set<Entry<Long, String>> cycleEntrySet = cycles.entrySet();
for (Iterator<Entry<Long, String>> iterator = cycleEntrySet.iterator(); iterator.hasNext();) {
Entry<Long, String> entry = iterator.next();
m.add(entry.getValue(), entry.getKey()+"");
}
m.add("New Cycle", NEW_CYCLE_KEY);
restClient.destroy();
return m;
}
示例10: doFillLeroyNodeItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public ListBoxModel doFillLeroyNodeItems() {
ListBoxModel items = new ListBoxModel();
try {
List<Computer> leroyNodes = LeroyUtils.getLeroyNodes();
for (Computer comp : leroyNodes) {
// handle master node separately
if (comp instanceof Hudson.MasterComputer) {
items.add(Constants.MASTER_NODE, Constants.MASTER_NODE);
} else {
items.add(comp.getName(), comp.getName());
}
}
} catch (Exception e) {
// omit; //TODO handle
}
return items;
}
示例11: doFillFilePathItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
@SuppressWarnings("unused") // used by stapler
public ListBoxModel doFillFilePathItems()
throws IOException, InterruptedException {
Run run = findRun();
ListBoxModel m = new ListBoxModel();
if (run != null) {
FileSet fileSet = new FileSet();
fileSet.setProject(new Project());
fileSet.setDir(run.getArtifactsDir());
fileSet.setIncludes("**/*.war");
for (String path : fileSet.getDirectoryScanner().getIncludedFiles()) {
m.add(path);
}
}
return m;
}
示例12: getSpecificationOptions
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
public static ListBoxModel getSpecificationOptions(Map<String, TestSpecification> ts) {
ListBoxModel items = new ListBoxModel();
for (Map.Entry<String, TestSpecification> t : ts.entrySet()) {
TestSpecification testSpecification = t.getValue();
if (!isSetOfTestSpecifications(testSpecification)) {
items.add(
format("%s > %s (%s, %s) - %s",
testSpecification.getProject().getTitle(),
testSpecification.getTitle(),
testSpecification.getTestToolName(),
testSpecification.getTestToolDefaultSearchPattern(),
testSpecification.getQualificationDescription()
),
t.getKey()
);
}
}
JellyUtil.sortListBoxModel(items);
return items;
}
示例13: doFillProjectVisibilityIdItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
@Restricted(NoExternalUse.class)
public ListBoxModel doFillProjectVisibilityIdItems() {
ListBoxModel items = new ListBoxModel();
for (String id : GitLabProjectVisibility.ids()) {
items.add(id, id);
}
return items;
}
示例14: doFillServerItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Populates the drop-down for {@link ASFGitSCMNavigator#getServer()}
*
* @return the drop-down entries.
*/
public ListBoxModel doFillServerItems() {
ListBoxModel result = new ListBoxModel();
result.add(Messages.ASFGitSCMNavigator_gitWip(), GIT_WIP);
result.add(Messages.ASFGitSCMNavigator_gitBox(), GIT_BOX);
return result;
}
示例15: doFillStrategyIdItems
import hudson.util.ListBoxModel; //导入方法依赖的package包/类
/**
* Populates the strategy options.
*
* @return the stategy options.
*/
@NonNull
@Restricted(NoExternalUse.class)
@SuppressWarnings("unused") // stapler
public ListBoxModel doFillStrategyIdItems() {
ListBoxModel result = new ListBoxModel();
result.add(Messages.BranchDiscoveryTrait_excludePRs(), "1");
result.add(Messages.BranchDiscoveryTrait_onlyPRs(), "2");
result.add(Messages.BranchDiscoveryTrait_allBranches(), "3");
return result;
}