當前位置: 首頁>>代碼示例>>Java>>正文


Java ListBoxModel.add方法代碼示例

本文整理匯總了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;
}
 
開發者ID:Compuware-Corp,項目名稱:CPWR-CodeCoverage,代碼行數:36,代碼來源:CodeCoverageBuilder.java

示例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;
}
 
開發者ID:10000TB,項目名稱:Jenkins-Plugin-Examples,代碼行數:17,代碼來源:ToolStep.java

示例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;
}
 
開發者ID:Microsoft,項目名稱:vsts-jenkins-build-integration-sample,代碼行數:20,代碼來源:TfsBuildNotifier.java

示例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;
}
 
開發者ID:pason-systems,項目名稱:jenkins-artifactory-polling-plugin,代碼行數:22,代碼來源:ArtifactoryRepository.java

示例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;
}
 
開發者ID:awslabs,項目名稱:ec2-spot-jenkins-plugin,代碼行數:21,代碼來源:EC2FleetCloud.java

示例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
    }

}
 
開發者ID:jenkinsci,項目名稱:checkmarx-plugin,代碼行數:25,代碼來源:CxScanBuilder.java

示例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;
}
 
開發者ID:hudson3-plugins,項目名稱:ec2-plugin,代碼行數:22,代碼來源:AmazonEC2Cloud.java

示例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;

  }
 
開發者ID:zephyrdeveloper,項目名稱:zfj-jenkins,代碼行數:27,代碼來源:ZfjDescriptor.java

示例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;
  }
 
開發者ID:zephyrdeveloper,項目名稱:zfj-jenkins,代碼行數:27,代碼來源:ZfjDescriptor.java

示例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;
}
 
開發者ID:epicforce,項目名稱:leroy_jenkins,代碼行數:18,代碼來源:LeroyConfigurationBuilder.java

示例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;
}
 
開發者ID:jenkinsci,項目名稱:deployer-framework-plugin,代碼行數:21,代碼來源:StaticSelectionDeploySource.java

示例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;
}
 
開發者ID:jenkinsci,項目名稱:xltestview-plugin,代碼行數:21,代碼來源:TestSpecificationDescribable.java

示例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;
}
 
開發者ID:Argelbargel,項目名稱:gitlab-branch-source-plugin,代碼行數:9,代碼來源:GitLabSCMNavigator.java

示例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;
}
 
開發者ID:stephenc,項目名稱:asf-gitpubsub-jenkins-plugin,代碼行數:12,代碼來源:ASFGitSCMNavigator.java

示例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;
}
 
開發者ID:jenkinsci,項目名稱:gitea-plugin,代碼行數:16,代碼來源:BranchDiscoveryTrait.java


注:本文中的hudson.util.ListBoxModel.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。