本文整理汇总了Java中org.eclipse.core.resources.IResourceStatus类的典型用法代码示例。如果您正苦于以下问题:Java IResourceStatus类的具体用法?Java IResourceStatus怎么用?Java IResourceStatus使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IResourceStatus类属于org.eclipse.core.resources包,在下文中一共展示了IResourceStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printStackTrace
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
public void printStackTrace(T output) {
synchronized (output) {
IStatus status = getStatus();
Throwable exception = status.getException();
if (exception != null) {
String path = "()"; //$NON-NLS-1$
if (status instanceof IResourceStatus) {
path = "(" + ((IResourceStatus) status).getPath() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
String s = getClass().getName() + path + "[" + status.getCode() + "]: ";
print(output, s); // $NON-NLS-1$ //$NON-NLS-2$
exceptionPrintStackTrace(exception, output);
} else
superPrintStackTrace(output);
}
}
示例2: purgeCache
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
public void purgeCache(IContainer root, boolean deep) throws SVNException {
int depth = deep ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO;
try {
if (root.exists() || root.isPhantom()) {
ResourcesPlugin.getWorkspace().getSynchronizer().flushSyncInfo(StatusCacheManager.SVN_BC_SYNC_KEY, root, depth);
}
if (deep) {
accessor.removeRecursiveFromPendingCache(root);
} else {
accessor.removeFromPendingCache(root);
}
} catch (CoreException e) {
if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
// Must have been deleted since we checked
return;
}
throw SVNException.wrapException(e);
}
}
示例3: isSupervised
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
public boolean isSupervised(IResource resource) throws TeamException {
try {
if (resource.isTeamPrivateMember() || SVNWorkspaceRoot.isLinkedResource(resource)) return false;
RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId());
if (provider == null) return false;
// TODO: what happens for resources that don't exist?
// TODO: is it proper to use ignored here?
ISVNLocalResource svnThing = SVNWorkspaceRoot.getSVNResourceFor(resource);
if (svnThing.isIgnored()) {
// An ignored resource could have an incoming addition (conflict)
return (remoteSyncStateStore.getBytes(resource) != null) ||
((remoteSyncStateStore.members(resource) != null) && (remoteSyncStateStore.members(resource).length > 0));
}
return true;
} catch (TeamException e) {
// If there is no resource in coe this measn there is no local and no remote
// so the resource is not supervised.
if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) {
return false;
}
throw e;
}
}
示例4: createFolder
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
/**
* Recursively creates the folder hierarchy needed for the build output, if
* necessary. If the folder is created, its derived bit is set to true so the
* CM system ignores the contents. If the resource exists, respect the
* existing derived setting.
*
* @param folder
* a folder, somewhere below the project root
*/
private void createFolder(IFolder folder) throws CoreException {
if (!folder.exists()) {
// Make sure that parent folders exist
IContainer parent = folder.getParent();
if (parent instanceof IFolder && !parent.exists()) {
createFolder((IFolder) parent);
}
// Now make the requested folder
try {
folder.create(IResource.DERIVED, true, monitor);
} catch (CoreException e) {
if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
folder.refreshLocal(IResource.DEPTH_ZERO, monitor);
else
throw e;
}
}
}
示例5: checkIn
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
/** An operation calls this method and it only returns when the operation is free to run. */
public void checkIn(ISchedulingRule rule, IProgressMonitor monitor) throws CoreException {
boolean success = false;
try {
if (workspace.isTreeLocked()) {
String msg = Messages.resources_cannotModify;
throw new ResourceException(IResourceStatus.WORKSPACE_LOCKED, null, msg, null);
}
jobManager.beginRule(rule, monitor);
lock.acquire();
incrementPreparedOperations();
success = true;
} finally {
// remember if we failed to check in, so we can avoid check out
if (!success) checkInFailed.set(Boolean.TRUE);
}
}
示例6: printStackTrace
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
/**
* Prints a stack trace out for the exception, and any nested exception that it may have embedded
* in its Status object.
*/
@Override
public void printStackTrace(PrintStream output) {
synchronized (output) {
IStatus status = getStatus();
if (status.getException() != null) {
String path = "()"; // $NON-NLS-1$
if (status instanceof IResourceStatus)
path = "(" + ((IResourceStatus) status).getPath() + ")"; // $NON-NLS-1$ //$NON-NLS-2$
output.print(
getClass().getName()
+ path
+ "["
+ status.getCode()
+ "]: "); // $NON-NLS-1$ //$NON-NLS-2$
status.getException().printStackTrace(output);
} else super.printStackTrace(output);
}
}
示例7: computeAdornmentFlags
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
/**
* Compute the flags that were set on the give object. We expect an IResource for this computation, and we return
* the flags according to the warnings or errors set on the resource.
*
* @param obj
* A IResource (expected)
* @return An integer representing an ERROR or a WARNING; -1 if the give object was not an IResource or when we got
* an exception retrieving the {@link IMarker}s from the resource.
*/
protected int computeAdornmentFlags(Object obj)
{
try
{
if (obj instanceof IResource)
{
return getErrorTicksFromMarkers((IResource) obj, IResource.DEPTH_INFINITE);
}
}
catch (CoreException e)
{
if (e.getStatus().getCode() == IResourceStatus.MARKER_NOT_FOUND)
{
return -1;
}
IdeLog.logWarning(EditorEplPlugin.getDefault(),
"Error computing label-decoration adornment flags", e, EditorEplPlugin.DEBUG_SCOPE); //$NON-NLS-1$
}
return -1;
}
示例8: addOutOfSync
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
private static IStatus addOutOfSync(IStatus status, IResource resource) {
IStatus entry= new Status(
IStatus.ERROR,
ResourcesPlugin.PI_RESOURCES,
IResourceStatus.OUT_OF_SYNC_LOCAL,
Messages.format(CorextMessages.Resources_outOfSync, BasicElementLabels.getPathLabel(resource.getFullPath(), false)),
null);
if (status == null) {
return entry;
} else if (status.isMultiStatus()) {
((MultiStatus)status).add(entry);
return status;
} else {
MultiStatus result= new MultiStatus(
ResourcesPlugin.PI_RESOURCES,
IResourceStatus.OUT_OF_SYNC_LOCAL,
CorextMessages.Resources_outOfSyncResources, null);
result.add(status);
result.add(entry);
return result;
}
}
示例9: executeOperation
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
protected void executeOperation() throws JavaModelException {
try {
this.runnable.run(this.progressMonitor);
} catch (CoreException ce) {
if (ce instanceof JavaModelException) {
throw (JavaModelException)ce;
} else {
if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) {
Throwable e= ce.getStatus().getException();
if (e instanceof JavaModelException) {
throw (JavaModelException) e;
}
}
throw new JavaModelException(ce);
}
}
}
示例10: setActionEnablement
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
/**
* Method invoked from <code>selectionChanged(IAction, ISelection)</code>
* to set the enablement status of the action. The instance variable
* <code>selection</code> will contain the latest selection so the methods
* <code>getSelectedResources()</code> and <code>getSelectedProjects()</code>
* will provide the proper objects.
*
* This method can be overridden by subclasses but should not be invoked by them.
*/
protected void setActionEnablement(IAction action) {
try {
action.setEnabled(isEnabled());
} catch (TeamException e) {
if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
// Enable the action to allow the user to discover the problem
action.setEnabled(true);
} else {
action.setEnabled(false);
// We should not open a dialog when determining menu enablements so log it instead
SVNUIPlugin.log(e);
}
}
}
示例11: getCharset
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
public String getCharset() throws CoreException {
InputStream contents = getContents();
try {
String charSet = SVNUIPlugin.getCharset(getName(), contents);
return charSet;
} catch (IOException e) {
throw new SVNException(new Status(IStatus.ERROR, SVNUIPlugin.ID, IResourceStatus.FAILED_DESCRIBING_CONTENTS, Policy.bind("RemoteAnnotationStorage.1", getFullPath().toString()), e)); //$NON-NLS-1$
} finally {
try {
contents.close();
} catch (IOException e1) {
// Ignore
}
}
}
示例12: getWorkManager
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
/**
* We should not have direct references to this field. All references should go through this
* method.
*/
public WorkManager getWorkManager() throws CoreException {
if (_workManager == null) {
String message = Messages.resources_shutdown;
throw new ResourceException(
new ResourceStatus(IResourceStatus.INTERNAL_ERROR, null, message));
}
return _workManager;
}
示例13: validateName
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
@Override
public IStatus validateName(String segment, int type) {
String message;
/* segment must not be null */
if (segment == null) {
message = Messages.resources_nameNull;
return new org.eclipse.core.internal.resources.ResourceStatus(
IResourceStatus.INVALID_VALUE, null, message);
}
// cannot be an empty string
if (segment.length() == 0) {
message = Messages.resources_nameEmpty;
return new org.eclipse.core.internal.resources.ResourceStatus(
IResourceStatus.INVALID_VALUE, null, message);
}
/* test invalid characters */
char[] chars = OS.INVALID_RESOURCE_CHARACTERS;
for (int i = 0; i < chars.length; i++) {
if (segment.indexOf(chars[i]) != -1) {
message = NLS.bind(Messages.resources_invalidCharInName, String.valueOf(chars[i]), segment);
return new org.eclipse.core.internal.resources.ResourceStatus(
IResourceStatus.INVALID_VALUE, null, message);
}
}
/* test invalid OS names */
if (!OS.isNameValid(segment)) {
message = NLS.bind(Messages.resources_invalidName, segment);
return new org.eclipse.core.internal.resources.ResourceStatus(
IResourceStatus.INVALID_VALUE, null, message);
}
return Status.OK_STATUS;
}
示例14: validatePath
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
@Override
public IStatus validatePath(String path, int type) {
/* path must not be null */
if (path == null) {
String message = Messages.resources_pathNull;
return new org.eclipse.core.internal.resources.ResourceStatus(
IResourceStatus.INVALID_VALUE, null, message);
}
return validatePath(Path.fromOSString(path), type, false);
}
示例15: checkExists
import org.eclipse.core.resources.IResourceStatus; //导入依赖的package包/类
/**
* Checks that this resource exists. If checkType is true, the type of this resource and the one
* in the tree must match.
*
* @exception CoreException if this resource does not exist
*/
public void checkExists(int flags, boolean checkType) throws CoreException {
if (!exists(flags, checkType)) {
String message = NLS.bind(Messages.resources_mustExist, getFullPath());
throw new ResourceException(IResourceStatus.RESOURCE_NOT_FOUND, getFullPath(), message, null);
}
}