本文整理汇总了Java中org.eclipse.core.resources.team.IResourceTree类的典型用法代码示例。如果您正苦于以下问题:Java IResourceTree类的具体用法?Java IResourceTree怎么用?Java IResourceTree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IResourceTree类属于org.eclipse.core.resources.team包,在下文中一共展示了IResourceTree类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteFolder
import org.eclipse.core.resources.team.IResourceTree; //导入依赖的package包/类
public boolean deleteFolder(IResourceTree tree, IFolder folder,
int updateFlags, IProgressMonitor monitor) {
if (SVNWorkspaceRoot.isLinkedResource(folder))
return false;
ISVNLocalFolder resource = new LocalFolder(folder);
try {
if (!resource.isManaged()) {
return false;
}
monitor.beginTask(null, 1000);
deleteResource(resource);
tree.deletedFolder(folder);
} catch (SVNException e) {
tree.failed(e.getStatus());
} finally {
monitor.done();
}
return true;
}
示例2: deleteFile
import org.eclipse.core.resources.team.IResourceTree; //导入依赖的package包/类
public boolean deleteFile(IResourceTree tree, IFile file, int updateFlags,
IProgressMonitor monitor) {
if (SVNWorkspaceRoot.isLinkedResource(file))
return false;
ISVNLocalFile resource = new LocalFile(file);
try {
if (!resource.isManaged()) {
return false;
}
if (getDeferFileDelete(file))
return false;
monitor.beginTask(null, 1000);
deletedFiles.add(file);
deleteResource(resource);
tree.deletedFile(file);
} catch (SVNException e) {
tree.failed(e.getStatus());
} finally {
monitor.done();
}
return true;
}
示例3: deleteProject
import org.eclipse.core.resources.team.IResourceTree; //导入依赖的package包/类
public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) {
ISVNLocalFolder resource = new LocalFolder(project);
try {
// If contents are not being deleted, let Eclipse handle.
if ((updateFlags & IResource.NEVER_DELETE_PROJECT_CONTENT) == IResource.NEVER_DELETE_PROJECT_CONTENT) {
return false;
}
// If not managed, let Eclipse handle.
if (!resource.isManaged())
return false;
File projectDirectory = new File(project.getLocationURI());
// If meta directory does not exist, let Eclipse handle.
File metaFolder = new File(projectDirectory, ".svn"); //$NON-NLS-1$
if (!metaFolder.exists()) {
return false;
}
// If database file does not exist, let Eclipse handle.
File databaseFile = new File(metaFolder, "wc.db"); //$NON-NLS-1$
if (!databaseFile.exists()) {
return false;
}
// If we can delete database file, let Eclipse handle project deletion.
if (databaseFile.delete()) {
return false;
}
// Show message dialog in UI thread and cancel deletion.
SVNProviderPlugin.handleMessage(Policy.bind("SVNMoveDeleteHook.4"), Policy.bind("SVNMoveDeleteHook.5") + project.getName() + Policy.bind("SVNMoveDeleteHook.6"), IMessageHandler.ERROR); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return true;
} catch (Exception e) {
// Let Eclipse try to handle it.
return false;
}
}
示例4: deleteFile
import org.eclipse.core.resources.team.IResourceTree; //导入依赖的package包/类
@Override
public boolean deleteFile(
final IResourceTree tree,
final IFile file,
final int updateFlags,
final IProgressMonitor progressMonitor) {
log.trace("deleteFile: " + file.getFullPath()); //$NON-NLS-1$
progressMonitor.beginTask(
MessageFormat.format(Messages.getString("TFSMoveDeleteHook.DeletingPathFormat"), file.getFullPath()), //$NON-NLS-1$
30);
try {
/* Do the common pre-deletion resource inspection */
final ResourceInspectionResult inspectionResult = inspectResource(
tree,
file,
true,
true,
DELETE_DENIED_CHANGE_TYPES,
updateFlags,
false,
new SubProgressMonitor(progressMonitor, 5));
/*
* Defer to the platform, returning false meaning we do not do any
* work.
*/
if (inspectionResult.getStatus().equals(ResourceInspectionStatus.DEFER)) {
return false;
}
if (repositoryProvider.getRepositoryStatus() == ProjectRepositoryStatus.CONNECTING) {
throw new RuntimeException(
Messages.getString("TFSMoveDeleteHook.ConnectionInProgressWaitBeforeDeleting")); //$NON-NLS-1$
}
log.info(MessageFormat.format("Deletion detected for file {0}", file)); //$NON-NLS-1$
final TFSRepository repository = inspectionResult.getRepository();
final PendingChange[] pendingChanges = inspectionResult.getPendingChanges();
final IStatus deleteStatus =
deleteFile(file, repository, pendingChanges, new SubProgressMonitor(progressMonitor, 10));
if (!deleteStatus.isOK()) {
throw new RuntimeException(deleteStatus.getMessage());
}
tree.standardDeleteFile(file, updateFlags, new SubProgressMonitor(progressMonitor, 5));
return true;
} finally {
progressMonitor.done();
}
}
示例5: moveProject
import org.eclipse.core.resources.team.IResourceTree; //导入依赖的package包/类
@Override
public boolean moveProject(
final IResourceTree tree,
final IProject source,
final IProjectDescription target,
final int updateFlags,
final IProgressMonitor progressMonitor) {
log.trace(MessageFormat.format("moveProject: {0}", source.getFullPath())); //$NON-NLS-1$
progressMonitor.beginTask(
MessageFormat.format(Messages.getString("TFSMoveDeleteHook.MovingProjectFormat"), source.getFullPath()), //$NON-NLS-1$
10);
log.info(MessageFormat.format("Rename detected from project {0} to {1}", source, target)); //$NON-NLS-1$
try {
/*
* Renaming the project only. Does not move folders, only sets the
* new name in the .project file.
*/
if (target.getName() != source.getName()) {
target.setLocation(source.getLocation());
tree.standardMoveProject(source, target, updateFlags, new SubProgressMonitor(progressMonitor, 10));
return true;
} else {
/*
* User is attempting to relocate the project. This gets hairy
* and would involve changing WF mappings in order to pend a
* rename.
*/
tree.failed(
new Status(
IStatus.ERROR,
TFSEclipseClientPlugin.PLUGIN_ID,
0,
MessageFormat.format(
Messages.getString("TFSMoveDeleteHook.MovingProjectNotSupportedInProductFormat"), //$NON-NLS-1$
ProductInformation.getCurrent().toString()),
null));
return true;
}
} finally {
progressMonitor.done();
}
}
示例6: moveProject
import org.eclipse.core.resources.team.IResourceTree; //导入依赖的package包/类
public boolean moveProject(IResourceTree tree, IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) {
return false;
}