Java 类org.eclipse.core.resources.mapping.ResourceChangeValidator 实例源码

项目:gama    文件:CloseResourceAction.java   
/**
 * Validates the operation against the model providers.
 *
 * @return whether the operation should proceed
 */
private boolean validateClose() {
    final IResourceChangeDescriptionFactory factory = ResourceChangeValidator.getValidator().createDeltaFactory();
    final List<? extends IResource> resources = getActionResources();
    for (final IResource resource : resources) {
        if (resource instanceof IProject) {
            final IProject project = (IProject) resource;
            factory.close(project);
        }
    }
    String message;
    if (resources.size() == 1) {
        message = NLS.bind(IDEWorkbenchMessages.CloseResourceAction_warningForOne, resources.get(0).getName());
    } else {
        message = IDEWorkbenchMessages.CloseResourceAction_warningForMultiple;
    }
    return IDE.promptToConfirm(WorkbenchHelper.getShell(), IDEWorkbenchMessages.CloseResourceAction_confirm,
            message, factory.getDelta(), getModelProviderIds(), false /* no need to syncExec */);
}
项目:Pydev    文件:CopyFilesAndFoldersOperation.java   
/**
 * Validates the copy or move operation.
 *
 * @param resources
 *            the resources being copied or moved
 * @param destinationPath
 *            the destination of the copy or move
 * @return whether the operation should proceed
 * @since 3.2
 */
private boolean validateOperation(IResource[] resources, IPath destinationPath) {
    IResourceChangeDescriptionFactory factory = ResourceChangeValidator.getValidator().createDeltaFactory();
    for (int i = 0; i < resources.length; i++) {
        IResource resource = resources[i];
        if (isMove()) {
            factory.move(resource, destinationPath.append(resource.getName()));
        } else {
            factory.copy(resource, destinationPath.append(resource.getName()));
        }
    }
    String title;
    String message;
    if (isMove()) {
        title = IDEWorkbenchMessages.CopyFilesAndFoldersOperation_confirmMove;
        message = IDEWorkbenchMessages.CopyFilesAndFoldersOperation_warningMove;
    } else {
        title = IDEWorkbenchMessages.CopyFilesAndFoldersOperation_confirmCopy;
        message = IDEWorkbenchMessages.CopyFilesAndFoldersOperation_warningCopy;
    }
    return IDE
            .promptToConfirm(messageShell, title, message, factory.getDelta(), modelProviderIds,
                    true /* syncExec */);
}
项目:che    文件:ResourceChangeChecker.java   
public ResourceChangeChecker() {
  fDeltaFactory = ResourceChangeValidator.getValidator().createDeltaFactory();
}
项目:che    文件:ResourceChangeChecker.java   
public RefactoringStatus check(IProgressMonitor monitor) throws CoreException {
  IStatus status =
      ResourceChangeValidator.getValidator().validateChange(fDeltaFactory.getDelta(), monitor);
  return createFrom(status);
}
项目:che    文件:ResourceChangeChecker.java   
public ResourceChangeChecker() {
  fDeltaFactory = ResourceChangeValidator.getValidator().createDeltaFactory();
}
项目:che    文件:ResourceChangeChecker.java   
public RefactoringStatus check(IProgressMonitor monitor) throws CoreException {
  IStatus status =
      ResourceChangeValidator.getValidator().validateChange(fDeltaFactory.getDelta(), monitor);
  return createFrom(status);
}