本文整理汇总了Java中com.microsoft.tfs.core.exceptions.TECoreException类的典型用法代码示例。如果您正苦于以下问题:Java TECoreException类的具体用法?Java TECoreException怎么用?Java TECoreException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TECoreException类属于com.microsoft.tfs.core.exceptions包,在下文中一共展示了TECoreException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFieldReferenceName
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
private String getFieldReferenceName(final String name) {
if (name.equalsIgnoreCase("A")) //$NON-NLS-1$
{
return CoreFieldReferenceNames.ASSIGNED_TO;
} else if (name.equalsIgnoreCase("C")) //$NON-NLS-1$
{
return CoreFieldReferenceNames.CREATED_BY;
} else if (name.equalsIgnoreCase("S")) //$NON-NLS-1$
{
return CoreFieldReferenceNames.STATE;
} else if (name.equalsIgnoreCase("T")) //$NON-NLS-1$
{
return CoreFieldReferenceNames.WORK_ITEM_TYPE;
} else {
if (workItemClient.getFieldDefinitions().contains(name)) {
return workItemClient.getFieldDefinitions().get(name).getReferenceName();
}
final String format = Messages.getString("WorkItemSearchCommand.ErrorSearchInvalidFieldNameFormat"); //$NON-NLS-1$
throw new TECoreException(MessageFormat.format(format, name));
}
}
示例2: getCurrentProjectURI
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
private static URI getCurrentProjectURI(final TeamExplorerContext context) {
final ProjectInfo project = context.getCurrentProjectInfo();
if (project == null) {
return context.getServer().getConnection().getBaseURI();
}
final String uriText = project.getURI();
final URI uri;
try {
uri = new URI(uriText);
} catch (final URISyntaxException e) {
final String format = Messages.getString("WebAccessHelper.URIErrorFormat"); //$NON-NLS-1$
throw new TECoreException(MessageFormat.format(format, uriText), e);
}
return uri;
}
示例3: hasServiceDefinition
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
private static boolean hasServiceDefinition(
final TFSTeamProjectCollection collection,
final String serviceType,
final GUID serviceIdentifier) {
try {
return getServiceDefinition(collection, serviceType, serviceIdentifier) != null;
} catch (final TECoreException e) {
final String title = Messages.getString("WebAccessHelper.ErrorDialogTitle"); //$NON-NLS-1$
final String format = Messages.getString("WebAccessHelper.LauchWebAccessErrorFormat"); //$NON-NLS-1$
final String message = MessageFormat.format(format, e.getLocalizedMessage());
log.error("Caught exception while checking a Web Access service", e); //$NON-NLS-1$
MessageBoxHelpers.errorMessageBox(ShellUtils.getWorkbenchShell(), title, message);
return false;
}
}
示例4: getHomeURL
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
/**
* Gets the Web Access home page Url.
*
* @param accessMappingMoniker
* A moniker for the desired access mapping.
* @return Web Access home page url.
*/
public URI getHomeURL(final String accessMappingMoniker) {
if (isCompatibleMode) {
// TfsAdminUtil in Orcas SP1 does not register root TSWA location.
// TfsAdminUtil appends work item editor url as "/wi.aspx" to the
// root location and registers it.
String result = buildURL(ServiceInterfaceNames.TSWA_WORK_ITEM_EDITOR, accessMappingMoniker).toString();
final int pos = result.lastIndexOf('/');
if (pos > 0) {
result = result.substring(0, pos);
}
try {
return new URI(result);
} catch (final URISyntaxException e) {
throw new TECoreException(MessageFormat.format("Unable to create URI from \"{0}\"", result), e); //$NON-NLS-1$
}
} else {
return buildURL(ServiceInterfaceNames.TSWA_HOME, accessMappingMoniker);
}
}
示例5: onException
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
@Override
public IStatus onException(final Throwable t) {
if (t instanceof TECoreException
&& t.getMessage().startsWith("TF14021: ") //$NON-NLS-1$
&& filterItemVersion instanceof DateVersionSpec) {
final String messageFormat = Messages.getString("QueryLabelsCommand.DateIsBeforeAnyChangesetFormat"); //$NON-NLS-1$
final String message = MessageFormat.format(
messageFormat,
DateHelper.getDefaultDateTimeFormat().format(
((DateVersionSpec) filterItemVersion).getDate().getTime()));
return new Status(IStatus.ERROR, TFSCommonClientPlugin.PLUGIN_ID, 14021, message, null);
}
return null;
}
示例6: setNewPath
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void setNewPath(final String newPath) {
if (!needsNewPath()) {
throw new TECoreException(MessageFormat.format(
Messages.getString("EclipseMergeConflictResolution.ResolutionTypeDoesNotAcceptNewPathsFormat"), //$NON-NLS-1$
getDescription()));
}
synchronized (lock) {
this.newPath = newPath;
}
}
示例7: setEncoding
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void setEncoding(final FileEncoding newEncoding) {
if (!needsEncodingSelection()) {
throw new TECoreException(MessageFormat.format(
Messages.getString("EclipseMergeConflictResolution.ResolutionTypeDoesNotAcceptNewEncodingsFormat"), //$NON-NLS-1$
getDescription()));
}
synchronized (lock) {
this.newEncoding = newEncoding;
}
}
示例8: map
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
/**
* Takes any {@link Exception} and returns a more specific
* {@link TECoreException} that can be thrown in its place, if a more
* specific type is known. If no better class is known, the given exception
* is returned unaltered.
*
* @param e
* the {@link Exception} to map (find a more specific exception for).
* If null, null is returned.
* @return the most specific {@link TECoreException} that can be used in
* place of the given exception, or null if the given exception was
* null.
*/
protected static RuntimeException map(final RuntimeException e) {
/*
* Handle common SOAP layer problems.
*/
if (e instanceof UnauthorizedException) {
return new TFSUnauthorizedException((UnauthorizedException) e);
} else if (e instanceof ProxyUnauthorizedException) {
return new HTTPProxyUnauthorizedException((ProxyUnauthorizedException) e);
} else if (e instanceof FederatedAuthException) {
return new TFSFederatedAuthException((FederatedAuthException) e);
} else if (e instanceof TransportException && e.getCause() instanceof UnknownHostException) {
return new TECoreException(
MessageFormat.format(
Messages.getString("TECoreExceptionMapper.UnknownHostFormat"), //$NON-NLS-1$
e.getCause().getLocalizedMessage()),
e.getCause());
} else if (e instanceof FederatedAuthFailedException) {
return new TFSAccessException((FederatedAuthFailedException) e);
} else if (e instanceof TECoreException) {
/*
* Avoid unnecessary exception type conversion.
*/
return e;
} else if (e instanceof ProxyException) {
/*
* ProxyException covers all the checked exceptions that escape
* com.microsoft.tfs.core.ws.runtime. The best we can do is wrap
* them, since all the interesting SOAPFaults should have been
* handled by client-specific mappers.
*/
return new TECoreException(e.getMessage(), e);
}
// Handles unknown types including null.
return e;
}
示例9: getWorkItems
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
/**
* Gets the work items which reference this changeset.
*
* @return the work items which reference this changeset.
* @throws TECoreException
* if this changeset is uncommitted (because uncommitted changesets
* cannot have work items which reference them).
*/
public synchronized WorkItem[] getWorkItems() {
if (getWebServiceObjectInternal().getCset() < 1) {
throw new TECoreException(
Messages.getString("Changeset.AnArtifactURICannotBeCreatedForAnUncommittedChangeset")); //$NON-NLS-1$
}
if (workItems == null) {
return new WorkItem[0];
}
return workItems;
}
示例10: setNewPath
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
@Override
public void setNewPath(final String newPath) {
if (!needsNewPath()) {
throw new TECoreException(MessageFormat.format(
Messages.getString("CoreConflictResolution.ResolutionTypeDoesNotAcceptNewPathsFormat"), //$NON-NLS-1$
getDescription()));
}
this.newPath = newPath;
}
示例11: setEncoding
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
@Override
public void setEncoding(final FileEncoding newEncoding) {
if (!needsEncodingSelection()) {
throw new TECoreException(MessageFormat.format(
Messages.getString("CoreConflictResolution.ResolutionTypeDoesNotAcceptNewEncodingsFormat"), //$NON-NLS-1$
getDescription()));
}
this.newEncoding = newEncoding;
}
示例12: setNewPath
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
@Override
public void setNewPath(final String newPath) {
throw new TECoreException(
//@formatter:off
Messages.getString("AutomergeWritableConflictResolution.AutomergeWritableConflictResolutionCannotAcceptNewPath")); //$NON-NLS-1$
//@formatter:on
}
示例13: setEncoding
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
@Override
public void setEncoding(final FileEncoding newEncoding) {
throw new TECoreException(
//@formatter:off
Messages.getString("AutomergeWritableConflictResolution.AutomergeWritableConflictResolutionCannotAcceptNewEncoding")); //$NON-NLS-1$
//@formatter:on
}
示例14: getCSSNodes
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
public CSSNode getCSSNodes(final String rootNodeUri, final boolean includeChildren) {
final CSSNode[] nodes = getCSSNodes(new String[] {
rootNodeUri
}, includeChildren);
if (nodes.length == 0) {
throw new TECoreException(MessageFormat.format("Unable to find nodes for \"{0}\"", rootNodeUri)); //$NON-NLS-1$
}
if (nodes.length > 1) {
throw new TECoreException(MessageFormat.format(
"Too many nodes returned for \"{0}\". Found {1}", //$NON-NLS-1$
rootNodeUri,
nodes.length));
}
return nodes[0];
}
示例15: printDetailedShelvesets
import com.microsoft.tfs.core.exceptions.TECoreException; //导入依赖的package包/类
public static void printDetailedShelvesets(
final Shelveset[] shelvesets,
final DateFormat dateFormat,
final Display display,
final WorkItemClient workItemClient) {
Check.notNull(shelvesets, "shelvesets"); //$NON-NLS-1$
Check.notNull(dateFormat, "dateFormat"); //$NON-NLS-1$
Check.notNull(display, "display"); //$NON-NLS-1$
Check.notNull(workItemClient, "workItemClient"); //$NON-NLS-1$
for (int i = 0; i < shelvesets.length; i++) {
BasicPrinter.printSeparator(display, '=');
printGeneral(shelvesets[i], dateFormat, display);
/*
* Use the ChangesetPrinter to do notes, since they're the same.
*/
ChangesetPrinter.printCheckinNotes(shelvesets[i].getCheckinNote(), display);
try {
final WorkItemCheckinInfo[] workItemInfo = shelvesets[i].getWorkItemInfo(workItemClient);
final WorkItem[] workItems = new WorkItem[workItemInfo.length];
for (int j = 0; j < workItemInfo.length; j++) {
workItems[j] = workItemInfo[j].getWorkItem();
}
ChangesetPrinter.printWorkItems(workItems, display);
} catch (final TECoreException e) {
display.printErrorLine(e.getMessage());
}
/*
* Unlike Changesets, we only have a comment string (not failures),
* so use our method.
*/
printPolicyOverrideComment(shelvesets[i].getPolicyOverrideComment(), display);
}
}