use of org.eclipse.core.runtime.SubProgressMonitor in project che by eclipse.
the class FolderUndoState method createExistentResourceFromHandle.
public void createExistentResourceFromHandle(IResource resource, IProgressMonitor monitor) throws CoreException {
Assert.isLegal(resource instanceof IFolder);
if (resource.exists()) {
return;
}
IFolder folderHandle = (IFolder) resource;
try {
//$NON-NLS-1$
monitor.beginTask("", 200);
monitor.setTaskName(RefactoringCoreMessages.FolderDescription_NewFolderProgress);
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
if (location != null) {
folderHandle.createLink(location, IResource.ALLOW_MISSING_LOCAL, new SubProgressMonitor(monitor, 100));
} else {
folderHandle.create(false, true, new SubProgressMonitor(monitor, 100));
}
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
createChildResources(folderHandle, monitor, 100);
} finally {
monitor.done();
}
}
use of org.eclipse.core.runtime.SubProgressMonitor in project che by eclipse.
the class ProjectUndoState method createExistentResourceFromHandle.
public void createExistentResourceFromHandle(IResource resource, IProgressMonitor monitor) throws CoreException {
Assert.isLegal(resource instanceof IProject);
if (resource.exists()) {
return;
}
IProject projectHandle = (IProject) resource;
//$NON-NLS-1$
monitor.beginTask("", 200);
monitor.setTaskName(RefactoringCoreMessages.FolderDescription_NewFolderProgress);
if (projectDescription == null) {
projectHandle.create(new SubProgressMonitor(monitor, 100));
} else {
projectHandle.create(projectDescription, new SubProgressMonitor(monitor, 100));
}
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
if (openOnCreate) {
projectHandle.open(IResource.NONE, new SubProgressMonitor(monitor, 100));
}
monitor.done();
}
use of org.eclipse.core.runtime.SubProgressMonitor in project che by eclipse.
the class ProjectDescription method createExistentResourceFromHandle.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.internal.ide.undo.ResourceDescription#createExistentResourceFromHandle(org.eclipse.core.resources.IResource,
* org.eclipse.core.runtime.IProgressMonitor)
*/
public void createExistentResourceFromHandle(IResource resource, IProgressMonitor monitor) throws CoreException {
Assert.isLegal(resource instanceof IProject);
if (resource.exists()) {
return;
}
IProject projectHandle = (IProject) resource;
//$NON-NLS-1$
monitor.beginTask("", 200);
monitor.setTaskName(UndoMessages.FolderDescription_NewFolderProgress);
if (projectDescription == null) {
projectHandle.create(new SubProgressMonitor(monitor, 100));
} else {
projectHandle.create(projectDescription, new SubProgressMonitor(monitor, 100));
}
if (monitor.isCanceled()) {
throw new OperationCanceledException();
}
if (openOnCreate) {
projectHandle.open(IResource.NONE, new SubProgressMonitor(monitor, 100));
}
monitor.done();
}
use of org.eclipse.core.runtime.SubProgressMonitor in project che by eclipse.
the class IntroduceFactoryRefactoring method findNonPrimaryType.
private IType findNonPrimaryType(String fullyQualifiedName, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException {
SearchPattern p = SearchPattern.createPattern(fullyQualifiedName, IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE);
final RefactoringSearchEngine2 engine = new RefactoringSearchEngine2(p);
engine.setFiltering(true, true);
engine.setScope(RefactoringScopeFactory.create(fCtorBinding.getJavaElement().getJavaProject()));
engine.setStatus(status);
engine.searchPattern(new SubProgressMonitor(pm, 1));
SearchResultGroup[] groups = (SearchResultGroup[]) engine.getResults();
if (groups.length != 0) {
for (int i = 0; i < groups.length; i++) {
SearchMatch[] matches = groups[i].getSearchResults();
for (int j = 0; j < matches.length; j++) {
if (matches[j].getAccuracy() == SearchMatch.A_ACCURATE)
return (IType) matches[j].getElement();
}
}
}
return null;
}
use of org.eclipse.core.runtime.SubProgressMonitor in project che by eclipse.
the class IntroduceFactoryRefactoring method searchForCallsTo.
/**
* Search for all calls to the given <code>IMethodBinding</code> in the project
* that contains the compilation unit <code>fCUHandle</code>.
* @param methodBinding
* @param pm
* @param status
* @return an array of <code>SearchResultGroup</code>'s that identify the search matches
* @throws JavaModelException
*/
private SearchResultGroup[] searchForCallsTo(IMethodBinding methodBinding, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException {
IMethod method = (IMethod) methodBinding.getJavaElement();
final RefactoringSearchEngine2 engine = new RefactoringSearchEngine2(createSearchPattern(method, methodBinding));
engine.setFiltering(true, true);
engine.setScope(createSearchScope(method, methodBinding));
engine.setStatus(status);
engine.searchPattern(new SubProgressMonitor(pm, 1));
return (SearchResultGroup[]) engine.getResults();
}
Aggregations