本文整理汇总了Java中com.microsoft.tfs.core.TFSTeamProjectCollection类的典型用法代码示例。如果您正苦于以下问题:Java TFSTeamProjectCollection类的具体用法?Java TFSTeamProjectCollection怎么用?Java TFSTeamProjectCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TFSTeamProjectCollection类属于com.microsoft.tfs.core包,在下文中一共展示了TFSTeamProjectCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCurrentTeam
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
/**
* Gets the current TFS 2012 team.
*
* @param connection
* the connection (must not be <code>null</code>)
* @param allTeams
* the current set of all teams in the collection (the returned value
* is taken from this array) (must not be <code>null</code>)
* @return the current team or <code>null</code> if there is no current team
*/
public TeamConfiguration getCurrentTeam(
final TFSTeamProjectCollection connection,
final TeamConfiguration[] allTeams) {
Check.notNull(connection, "connection"); //$NON-NLS-1$
Check.notNull(allTeams, "allTeams"); //$NON-NLS-1$
final String key = getCacheKey(connection);
final Memento root = getMemento(key);
final Memento currentTeam = root.getChild(MEMENTO_CURRENT_TEAM_KEY);
if (currentTeam != null) {
// Ensure the saved project is still available
final GUID savedTeamGUID = new GUID(currentTeam.getString(MEMENTO_CURRENT_TEAM_GUID_KEY));
for (final TeamConfiguration team : allTeams) {
if (savedTeamGUID.equals(team.getTeamID())) {
return team;
}
}
}
return null;
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:34,代码来源:TeamContextCache.java
示例2: initialize
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
void initialize(final TFSTeamProjectCollection tfs) {
// Determine the version of the team foundation server that we are
// communicating with.
final RegistrationClient registrationClient = tfs.getRegistrationClient();
ServiceInterface buildService =
registrationClient.getServiceInterface(ToolNames.TEAM_BUILD, ServiceInterfaceNames.BUILD_4);
if (buildService != null) {
serverVersion = BuildServerVersion.V4;
} else {
buildService = registrationClient.getServiceInterface(ToolNames.TEAM_BUILD, ServiceInterfaceNames.BUILD_3);
if (buildService != null) {
serverVersion = BuildServerVersion.V3;
} else {
serverVersion = BuildServerVersion.V2;
}
}
if (serverVersion.isLessThanV3() && (!isCompatibilityEnabled() || serverVersion.isLessThanV2())) {
throw new NotSupportedException(Messages.getString("BuildServer2012.ServerNotSupported")); //$NON-NLS-1$
}
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:23,代码来源:BuildServer.java
示例3: main
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
public static void main(final String[] args) {
final TFSTeamProjectCollection tpc = SnippetSettings.connectToTFS();
final Project project = tpc.getWorkItemClient().getProjects().get(SnippetSettings.PROJECT_NAME);
final WorkItemClient workItemClient = project.getWorkItemClient();
// Create a new work item, save it, and get its ID.
final WorkItemType type = project.getWorkItemTypes().get("Bug"); //$NON-NLS-1$
final WorkItem newWorkItem = workItemClient.newWorkItem(type);
newWorkItem.setTitle("Created by sample"); //$NON-NLS-1$
newWorkItem.save();
final int newWorkItemId = newWorkItem.getID();
System.out.println("Created work item " + newWorkItemId + " and title '" + newWorkItem.getTitle() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// Open a new instance of the work item we just saved and change it.
final WorkItem workItem = workItemClient.getWorkItemByID(newWorkItemId);
workItem.setTitle("Edited by sample"); //$NON-NLS-1$
workItem.save();
System.out.println("Edited work item " + workItem.getID() + " and title '" + workItem.getTitle() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:21,代码来源:EditWorkItemByID.java
示例4: getExternalURL
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
public static String getExternalURL(final WorkItem workItem, final TFSTeamProjectCollection connection) {
try {
final TSWAHyperlinkBuilder builder = new TSWAHyperlinkBuilder(workItem.getClient().getConnection());
final URI uri = builder.getWorkItemEditorURL(workItem.getID());
if (uri != null) {
return uri.toString();
}
} catch (final Exception e) {
// Ignore exception raised by doing it the new way - fall back
// to
// old mechanism
}
final LinkingClient linkingClient = (LinkingClient) connection.getClient(LinkingClient.class);
return linkingClient.getArtifactURLExternal(workItem.getURI());
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:17,代码来源:LinkingFacade.java
示例5: getInitialTeamProjectList
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
public List<ProjectInfo> getInitialTeamProjectList() {
final ProjectInfo[] selectedProjects;
try {
final TFSTeamProjectCollection connection =
(TFSTeamProjectCollection) getPageData(TFSTeamProjectCollection.class);
final CommonStructureClient client =
(CommonStructureClient) connection.getClient(CommonStructureClient.class);
selectedProjects = client.listAllProjects();
} catch (final Exception e) {
logger.error("Error getting initial team projects", e); //$NON-NLS-1$
return new ArrayList<ProjectInfo>();
}
final List<ProjectInfo> filteredProjects = new ArrayList<ProjectInfo>();
for (final ProjectInfo project : selectedProjects) {
if (project.getSourceControlCapabilityFlags().contains(options.getCapabilityFlags())) {
filteredProjects.add(project);
}
}
return filteredProjects;
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:24,代码来源:ImportWizard.java
示例6: TSWAHyperlinkBuilder
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
/**
* Creates a {@link TSWAHyperlinkBuilder} for the given
* {@link TFSTeamProjectCollection}.
*
* @param collection
* the collection to build links to resources in (must not be
* <code>null</code>)
* @param displayInEmbeddedBrowser
* true if url will be rendered as hosted content within TEE. When
* true, the URL contains a query parameter which instructs web
* access to render a page differently with knowledge that it's being
* hosted in another app).
*/
public TSWAHyperlinkBuilder(final TFSTeamProjectCollection collection, final boolean displayInEmbeddedBrowser) {
Check.notNull(collection, "collection"); //$NON-NLS-1$
final TFSConfigurationServer configurationServer = collection.getConfigurationServer();
registrationClient = collection.getRegistrationClient();
collectionId = collection.getInstanceID();
if (configurationServer == null) {
// For Orcas or below, configuration server is null.
isCompatibleMode = true;
locationService = null;
} else {
isCompatibleMode = false;
locationService = configurationServer.getLocationService();
}
this.collection = collection;
this.collectionLocationService = collection.getCollectionLocationService();
this.displayInEmbeddedBrowser = displayInEmbeddedBrowser;
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:32,代码来源:TSWAHyperlinkBuilder.java
示例7: SecurityService
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
public SecurityService(final TFSConnection connection) {
this.connection = connection;
if (connection instanceof TFSTeamProjectCollection) {
// Determine if we are talking to a new or old server.
final RegistrationClient registrationService =
(RegistrationClient) connection.getClient(RegistrationClient.class);
final RegistrationEntry frameworkEntry = registrationService.getRegistrationEntry(ToolNames.FRAMEWORK);
if (frameworkEntry != null) {
// This is Rosario or later.
m_securityProxy = (_SecurityWebServiceSoap) connection.getWebService(_SecurityWebServiceSoap.class);
} else {
throw new SecurityServiceException(
Messages.getString("SecurityService.ServiceNotSupportedPreFramework")); //$NON-NLS-1$
}
} else {
throw new SecurityServiceException(Messages.getString("SecurityService.ServiceNotSupportedPreFramework")); //$NON-NLS-1$
}
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:21,代码来源:SecurityService.java
示例8: getWorkItemByID
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
protected WorkItem getWorkItemByID(final int id)
throws MalformedURLException,
ArgumentException,
LicenseException,
CLCException {
final TFSTeamProjectCollection tfs = createConnection(true);
final WorkItemClient client = (WorkItemClient) tfs.getClient(WorkItemClient.class);
final WorkItem workItem = client.getWorkItemByID(id);
if (workItem == null) {
final String messageFormat = Messages.getString("BaseWITCommand.WorkItemDoesNotExistOrNoPermissionFormat"); //$NON-NLS-1$
final String message = MessageFormat.format(messageFormat, Integer.toString(id));
throw new CLCException(message);
}
return workItem;
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:19,代码来源:BaseWITCommand.java
示例9: getConnection
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
private TFSTeamProjectCollection getConnection(URI serverURI, final Credentials credentials) {
List<TFSTeamProjectCollection> connectionList;
serverURI = URIUtils.ensurePathHasTrailingSlash(serverURI);
serverURI = URIUtils.toLowerCase(serverURI);
if (connections.containsKey(serverURI)) {
connectionList = connections.get(serverURI);
} else {
connectionList = new ArrayList<TFSTeamProjectCollection>();
connections.put(serverURI, connectionList);
}
for (final TFSTeamProjectCollection connection : connectionList) {
if (credentials.equals(connection.getCredentials())) {
return connection;
}
}
collection = new TFSTeamProjectCollection(serverURI, credentials, new CLCConnectionAdvisor(this));
connectionList.add(collection);
return collection;
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:26,代码来源:Command.java
示例10: getLabel
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
public static String getLabel(final TFSTeamProjectCollection connection) {
Check.notNull(connection, "connection"); //$NON-NLS-1$
/* 2010 (offline or local workspaces) */
if (!ConnectionHelper.isConnected(connection)) {
if (!connection.getBaseURI().getPath().equals("/")) //$NON-NLS-1$
{
return connection.getBaseURI().getHost();
}
return connection.getBaseURI().getHost() + "\\" + connection.getBaseURI().getPath(); //$NON-NLS-1$
}
/* 2010: display hostname and collection name */
else if (connection.getCatalogNode() != null && connection.getCatalogNode().getResource() != null) {
return connection.getBaseURI().getHost()
+ "\\" //$NON-NLS-1$
+ connection.getCatalogNode().getResource().getDisplayName();
} else {
return connection.getBaseURI().getHost();
}
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:22,代码来源:TFSTeamProjectCollectionFormatter.java
示例11: isSupported
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
/**
* Test current java runtime environment and the current TFS connection are
* capable of supporting a Web Access hosted editor. The SWT BrowserFunction
* class must be available (since 3.5) and the TFS connection must be one of
* the final versions of TFS 2012.
*
*
* @param collection
* The current TFS collection. Must not be null.
* @return
*/
public static boolean isSupported(final TFSTeamProjectCollection collection) {
Check.notNull(collection, "collection"); //$NON-NLS-1$
if (hasBrowserFunctionSupport == null) {
try {
Class.forName("org.eclipse.swt.browser.BrowserFunction"); //$NON-NLS-1$
hasBrowserFunctionSupport = true;
} catch (final Exception e) {
hasBrowserFunctionSupport = false;
}
}
if (hasBrowserFunctionSupport == false) {
return false;
}
final WebServiceLevel level = collection.getVersionControlClient().getServiceLevel();
return level.getValue() >= WebServiceLevel.TFS_2012_2.getValue();
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:31,代码来源:WebAccessBaseEditor.java
示例12: getReportManagerURL
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
public static String getReportManagerURL(final TFSTeamProjectCollection connection) {
Check.notNull(connection, "connection"); //$NON-NLS-1$
if (isReportingConfigured(connection)) {
/* 2010: query the catalog service */
final ProjectCollectionEntity projectCollection = connection.getTeamProjectCollectionEntity(false);
if (projectCollection != null) {
/* 2010: use catalog service */
final ReportingConfigurationEntity reportingConfiguration =
projectCollection.getReportingConfiguration();
if (reportingConfiguration != null) {
return reportingConfiguration.getReportingServer().getReportManagerURL();
}
}
}
return null;
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:21,代码来源:ReportUtils.java
示例13: initConnectionPages
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
protected final void initConnectionPages(final TFSRepository repository) {
if (repository != null) {
final Workspace workspace = repository.getWorkspace();
final TFSTeamProjectCollection connection = workspace.getClient().getConnection();
setPageData(URI.class, connection.getConfigurationServer().getBaseURI());
setPageData(TFSConnection.class, connection);
setPageData(TFSTeamProjectCollection.class, connection);
setPageData(TFSRepository.class, repository);
setPageData(Workspace.class, workspace);
ensureLastUsedServerInList(connection.getConfigurationServer().getBaseURI());
}
/* See if we have any profiles */
else if (UIConnectionPersistence.getInstance().getLastUsedServerURI() != null) {
setPageData(URI.class, UIConnectionPersistence.getInstance().getLastUsedServerURI());
removePageData(TFSConnection.class);
removePageData(TFSTeamProjectCollection.class);
removePageData(TFSRepository.class);
removePageData(Workspace.class);
ensureLastUsedServerInList();
} else {
removePageData(URI.class);
removePageData(TFSConnection.class);
removePageData(TFSTeamProjectCollection.class);
}
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:26,代码来源:ConnectWizard.java
示例14: setCurrentTeamProject
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
/**
* Sets the current team projects.
*
* @param connection
* the connection (must not be <code>null</code>)
* @param currentProject
* the current project to save (may be <code>null</code>)
*/
public void setCurrentTeamProject(final TFSTeamProjectCollection connection, final ProjectInfo currentProject) {
Check.notNull(connection, "connection"); //$NON-NLS-1$
final String key = getCacheKey(connection);
final XMLMemento root = getMemento(key);
root.removeChildren(MEMENTO_CURRENT_PROJECT_KEY);
if (currentProject != null) {
final Memento child = root.createChild(MEMENTO_CURRENT_PROJECT_KEY);
child.putString(MEMENTO_CURRENT_PROJECT_NAME_KEY, currentProject.getName());
child.putString(MEMENTO_CURRENT_PROJECT_GUID_KEY, currentProject.getGUID());
}
setMemento(key, root);
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:26,代码来源:TeamContextCache.java
示例15: appendCollectionInformation
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
@Override
protected void appendCollectionInformation(TFSTeamProjectCollection collection) {
final QueryTeamProjectsCommand queryCommand2 = new QueryTeamProjectsCommand(collection);
final IStatus status2 = getCommandExecutor().execute(new ThreadedCancellableCommand(queryCommand2));
if (!status2.isOK()) {
return;
}
final ProjectInfo[] projectInfos = queryCommand2.getProjects();
for (final ProjectInfo info : projectInfos) {
final CrossCollectionProjectInfo pi = new CrossCollectionProjectInfo(
collection,
info.getName(),
info.getURI(),
collection.getName(),
collection.getBaseURI().getHost());
projects.add(pi);
}
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:19,代码来源:WizardCrossCollectionProjectSelectionPage.java
示例16: waitForBuildToFinish
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
public static void waitForBuildToFinish(final TFSTeamProjectCollection tpc, final IQueuedBuild queuedBuild)
throws InterruptedException {
System.out.println("Waiting for build to finish"); //$NON-NLS-1$
int timeOutIndex = 0;
do {
Thread.sleep(2000);
queuedBuild.refresh(QueryOptions.NONE);
System.out.println("Build status is " + queuedBuild.getStatus().toString()); //$NON-NLS-1$
timeOutIndex++;
} while (!queuedBuild.getStatus().contains(QueueStatus.COMPLETED) && timeOutIndex < TIME_OUT_COUNTER);
// Check if the build wait timed out
if (!queuedBuild.getStatus().contains(QueueStatus.COMPLETED)) {
System.out.println("The build wait timed out"); //$NON-NLS-1$
} else {
// Display the status of the completed build.
final IBuildDetail buildDetail = queuedBuild.getBuild();
final BuildStatus buildStatus = buildDetail.getStatus();
System.out.println("Build " //$NON-NLS-1$
+ buildDetail.getBuildNumber()
+ " completed with status " //$NON-NLS-1$
+ queuedBuild.getBuildServer().getDisplayText(buildStatus));
}
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:27,代码来源:BuildSample.java
示例17: getWitClient
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
private synchronized WorkItemClient getWitClient(ExternalSystem details, boolean descryptPass) {
String nativeLibsPath = System.getProperty("com.microsoft.tfs.jni.native.base-directory");
if (!Strings.isNullOrEmpty(nativeLibsPath)) {
LOGGER.warn("TFS native libs are placed in {}. Dir present: {}", nativeLibsPath, new File(nativeLibsPath).exists());
}
String username = Strings.isNullOrEmpty(details.getDomain()) ?
details.getUsername() :
details.getDomain() + "\\" + details.getUsername();
String passw = descryptPass ? encryptor.decrypt(details.getPassword()) : details.getPassword();
TFSTeamProjectCollection tfsTeamProjectCollection = new TFSTeamProjectCollection(TfsUtils.asUri(details.getUrl()),
new UsernamePasswordCredentials(username, passw), new DefaultConnectionAdvisor(Locale.getDefault(), TimeZone.getDefault()) {
@Override
public HTTPClientFactory getHTTPClientFactory(ConnectionInstanceData instanceData) {
return new DefaultHTTPClientFactory(instanceData) {
@Override
protected boolean shouldAcceptUntrustedCertificates(ConnectionInstanceData connectionInstanceData) {
return true;
}
};
}
});
return tfsTeamProjectCollection.getWorkItemClient();
}
开发者ID:reportportal,项目名称:service-tfs,代码行数:26,代码来源:TfsSdkStrategy.java
示例18: promptForConnection
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
@Override
public TFSTeamProjectCollection promptForConnection(final IProject project) {
Check.notNull(project, "project"); //$NON-NLS-1$
final Shell parentShell = ShellUtils.getWorkbenchShell();
final EclipseConnectErrorWizard connectWizard = new EclipseConnectErrorWizard();
final String messageFormat =
Messages.getString("ProjectManagerUiDataProvider.WorkspaceNotLocatedDialogTextFormat"); //$NON-NLS-1$
final String message = MessageFormat.format(messageFormat, project.getName());
connectWizard.setErrorMessage(message);
final WizardDialog connectDialog = new WizardDialog(parentShell, connectWizard);
if (UIHelpers.openOnUIThread(connectDialog) != IDialogConstants.OK_ID) {
return null;
}
if (connectWizard.hasPageData(TFSTeamProjectCollection.class)) {
return (TFSTeamProjectCollection) connectWizard.getPageData(TFSTeamProjectCollection.class);
}
return null;
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:26,代码来源:ProjectManagerUIDataProvider.java
示例19: getIdentity
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
/**
* Get a user or team identity for indexing the favorites which is unique
* within TPC scope.
*/
private static GUID getIdentity(
final TFSTeamProjectCollection connection,
final TeamConfiguration currentTeam,
final boolean isPersonal) {
Check.notNull(connection, "connection"); //$NON-NLS-1$
if (isPersonal) {
return connection.getAuthorizedIdentity().getTeamFoundationID();
} else {
if (currentTeam != null) {
return currentTeam.getTeamID();
} else {
return GUID.EMPTY;
}
}
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:21,代码来源:FavoritesStoreFactory.java
示例20: addContextProperties
import com.microsoft.tfs.core.TFSTeamProjectCollection; //导入依赖的package包/类
public static void addContextProperties(final Map<String, String> properties, final TFSConnection connection) {
if (connection != null && connection.hasAuthenticated()) {
final boolean isHosted = connection.isHosted();
properties.put(TfsTelemetryConstants.SHARED_PROPERTY_IS_HOSTED, Boolean.toString(isHosted));
final GUID connectionId = connection.getInstanceID();
properties.put(TfsTelemetryConstants.SHARED_PROPERTY_SERVER_ID, connectionId.toString());
if (connection instanceof TFSTeamProjectCollection) {
final TFSTeamProjectCollection collection = (TFSTeamProjectCollection) connection;
final TFSConfigurationServer configurationServer = collection.getConfigurationServer();
if (configurationServer != null) {
final GUID serverId = configurationServer.getInstanceID();
properties.put(TfsTelemetryConstants.SHARED_PROPERTY_SERVER_ID, serverId.toString());
properties.put(TfsTelemetryConstants.SHARED_PROPERTY_COLLECTION_ID, connectionId.toString());
}
}
}
}
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:22,代码来源:TfsTelemetryHelper.java
注:本文中的com.microsoft.tfs.core.TFSTeamProjectCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论