本文整理匯總了Java中org.eclipse.core.internal.utils.Messages類的典型用法代碼示例。如果您正苦於以下問題:Java Messages類的具體用法?Java Messages怎麽用?Java Messages使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Messages類屬於org.eclipse.core.internal.utils包,在下文中一共展示了Messages類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkIn
import org.eclipse.core.internal.utils.Messages; //導入依賴的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);
}
}
示例2: combineResults
import org.eclipse.core.internal.utils.Messages; //導入依賴的package包/類
private IStatus combineResults(IStatus[] result) {
List<IStatus> notOK = new ArrayList<IStatus>();
for (int i = 0; i < result.length; i++) {
IStatus status = result[i];
if (!status.isOK()) {
notOK.add(status);
}
}
if (notOK.isEmpty()) {
return Status.OK_STATUS;
}
if (notOK.size() == 1) {
return notOK.get(0);
}
return new MultiStatus(
ResourcesPlugin.PI_RESOURCES,
0,
notOK.toArray(new IStatus[notOK.size()]),
Messages.mapping_multiProblems,
null);
}
示例3: setContents
import org.eclipse.core.internal.utils.Messages; //導入依賴的package包/類
@Override
public void setContents(InputStream content, int updateFlags, IProgressMonitor monitor)
throws CoreException {
monitor = Policy.monitorFor(monitor);
try {
String message = NLS.bind(Messages.resources_settingContents, getFullPath());
monitor.beginTask(message, Policy.totalWork);
// if (workspace.shouldValidate)
// workspace.validateSave(this);
final ISchedulingRule rule = workspace.getRuleFactory().modifyRule(this);
try {
workspace.prepareOperation(rule, monitor);
ResourceInfo info = getResourceInfo(false, false);
// checkAccessible(getFlags(info));
workspace.beginOperation(true);
// IFileInfo fileInfo = getStore().fetchInfo();
internalSetContents(
content, updateFlags, false, Policy.subMonitorFor(monitor, Policy.opWork));
} catch (OperationCanceledException e) {
workspace.getWorkManager().operationCanceled();
throw e;
} finally {
workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
FileUtil.safeClose(content);
}
}
示例4: getWorkManager
import org.eclipse.core.internal.utils.Messages; //導入依賴的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;
}
示例5: validateName
import org.eclipse.core.internal.utils.Messages; //導入依賴的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;
}
示例6: validatePath
import org.eclipse.core.internal.utils.Messages; //導入依賴的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);
}
示例7: move
import org.eclipse.core.internal.utils.Messages; //導入依賴的package包/類
@Override
public void move(IPath destination, int updateFlags, IProgressMonitor monitor)
throws CoreException {
monitor = Policy.monitorFor(monitor);
try {
String message = NLS.bind(Messages.resources_moving, getFullPath());
monitor.beginTask(message, Policy.totalWork);
Policy.checkCanceled(monitor);
destination = makePathAbsolute(destination);
// checkValidPath(destination, getType(), false);
Resource destResource = workspace.newResource(destination, getType());
final ISchedulingRule rule = workspace.getRuleFactory().moveRule(this, destResource);
WorkManager workManager = workspace.getWorkManager();
try {
workspace.prepareOperation(rule, monitor);
workspace.beginOperation(true);
int depth = 0;
try {
depth = workManager.beginUnprotected();
unprotectedMove(destResource, updateFlags, monitor);
} finally {
workManager.endUnprotected(depth);
}
} finally {
workspace.endOperation(rule, true, Policy.subMonitorFor(monitor, Policy.endOpWork));
}
} finally {
monitor.done();
}
}
示例8: checkExists
import org.eclipse.core.internal.utils.Messages; //導入依賴的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);
}
}
示例9: getWorkspace
import org.eclipse.core.internal.utils.Messages; //導入依賴的package包/類
/**
* Returns the workspace. The workspace is not accessible after the resources plug-in has
* shutdown.
*
* @return the workspace that was created by the single instance of this plug-in class.
*/
public static IWorkspace getWorkspace() {
if (workspace == null) {
throw new IllegalStateException(Messages.resources_workspaceClosed);
}
return workspace;
}
示例10: unprotectedMove
import org.eclipse.core.internal.utils.Messages; //導入依賴的package包/類
/**
* Calls the move/delete hook to perform the move. Since this method calls client code, it is run
* "unprotected", so the workspace lock is not held. Returns true if resources were actually
* moved, and false otherwise.
*/
private boolean unprotectedMove(
final IResource destination, int updateFlags, IProgressMonitor monitor)
throws CoreException, ResourceException {
// IMoveDeleteHook hook = workspace.getMoveDeleteHook();
switch (getType()) {
case IResource.FILE:
// if (!hook.moveFile(tree, (IFile) this, (IFile) destination, updateFlags,
// Policy.subMonitorFor(monitor, Policy.opWork / 2)))
workspace.standardMoveFile(
(IFile) this,
(IFile) destination,
updateFlags,
Policy.subMonitorFor(monitor, Policy.opWork));
break;
case IResource.FOLDER:
// if (!hook.moveFolder(tree, (IFolder) this, (IFolder) destination,
// updateFlags, Policy.subMonitorFor(monitor, Policy.opWork / 2)))
workspace.standardMoveFolder(
(IFolder) this,
(IFolder) destination,
updateFlags,
Policy.subMonitorFor(monitor, Policy.opWork));
break;
case IResource.PROJECT:
IProject project = (IProject) this;
// if there is no change in name, there is nothing to do so return.
if (getName().equals(destination.getName())) return false;
IProjectDescription description = project.getDescription();
description.setName(destination.getName());
// if (!hook.moveProject(tree, project, description, updateFlags,
// Policy.subMonitorFor(monitor, Policy.opWork / 2)))
workspace.standardMoveProject(
project, description, updateFlags, Policy.subMonitorFor(monitor, Policy.opWork));
break;
case IResource.ROOT:
String msg = Messages.resources_moveRoot;
throw new ResourceException(
new ResourceStatus(IResourceStatus.INVALID_VALUE, getFullPath(), msg));
}
return true;
}