use of org.eclipse.ltk.core.refactoring.RefactoringDescriptor in project che by eclipse.
the class RenameTypeTest method helper3_fail.
private void helper3_fail(String oldName, String newName, boolean updateSimilar, boolean updateTextual, boolean updateRef, int matchStrategy) throws JavaModelException, CoreException, IOException, Exception {
RefactoringDescriptor descriptor = initWithAllOptions(oldName, oldName, newName, updateRef, updateTextual, updateSimilar, null, matchStrategy);
Assert.assertNotNull("was supposed to fail", performRefactoring(descriptor));
}
use of org.eclipse.ltk.core.refactoring.RefactoringDescriptor in project che by eclipse.
the class RenameTypeTest method helper3.
private void helper3(String oldName, String newName, boolean updateRef, boolean updateTextual, boolean updateSimilar, String nonJavaFiles) throws JavaModelException, CoreException, IOException, Exception {
RefactoringDescriptor descriptor = initWithAllOptions(oldName, oldName, newName, updateRef, updateTextual, updateSimilar, nonJavaFiles, RenamingNameSuggestor.STRATEGY_EMBEDDED);
Refactoring ref = createRefactoring(descriptor);
RefactoringStatus status = performRefactoring(ref);
Assert.assertNull("was supposed to pass", status);
checkResultInClass(newName);
checkMappedSimilarElementsExist(ref);
}
use of org.eclipse.ltk.core.refactoring.RefactoringDescriptor in project che by eclipse.
the class RenameTypeTest method helper3_inner.
private void helper3_inner(String oldName, String oldInnerName, String newName, String innerNewName, boolean updateRef, boolean updateTextual, boolean updateSimilar, String nonJavaFiles) throws JavaModelException, CoreException, IOException, Exception {
RefactoringDescriptor descriptor = initWithAllOptions(oldName, oldInnerName, innerNewName, updateRef, updateTextual, updateSimilar, nonJavaFiles, RenamingNameSuggestor.STRATEGY_EMBEDDED);
Refactoring ref = createRefactoring(descriptor);
Assert.assertNull("was supposed to pass", performRefactoring(ref));
checkResultInClass(newName);
checkMappedSimilarElementsExist(ref);
}
use of org.eclipse.ltk.core.refactoring.RefactoringDescriptor in project che by eclipse.
the class RefactoringHistoryManager method requestDescriptor.
/**
* Requests the resolved refactoring descriptor associated with the given
* proxy.
*
* @param proxy
* the refactoring descriptor proxy
* @param monitor
* the progress monitor to use
* @return the associated refactoring descriptor, or <code>null</code>
*/
RefactoringDescriptor requestDescriptor(final RefactoringDescriptorProxy proxy, final IProgressMonitor monitor) {
try {
monitor.beginTask(RefactoringCoreMessages.RefactoringHistoryService_resolving_information, 2);
final long stamp = proxy.getTimeStamp();
if (stamp >= 0) {
InputStream input = null;
try {
final IFileStore folder = fHistoryStore.getFileStore(stampToPath(stamp));
final IFileStore file = folder.getChild(RefactoringHistoryService.NAME_HISTORY_FILE);
if (file.fetchInfo(EFS.NONE, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).exists()) {
input = new BufferedInputStream(file.openInputStream(EFS.NONE, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
final RefactoringSessionDescriptor descriptor = getCachedSession(file, fProjectName, input);
if (descriptor != null) {
final RefactoringDescriptor[] descriptors = descriptor.getRefactorings();
for (int index = 0; index < descriptors.length; index++) {
final RefactoringDescriptor refactoringDescriptor = descriptors[index];
if (refactoringDescriptor.getTimeStamp() == stamp) {
return refactoringDescriptor;
}
}
}
}
} catch (CoreException exception) {
RefactoringCorePlugin.log(exception);
} finally {
try {
if (input != null)
input.close();
} catch (IOException exception) {
RefactoringCorePlugin.log(exception);
}
}
}
} finally {
monitor.done();
}
return null;
}
use of org.eclipse.ltk.core.refactoring.RefactoringDescriptor in project che by eclipse.
the class RefactoringHistorySerializer method processHistoryNotification.
/**
* Processes the history event.
*
* @param store
* the file store
* @param event
* the history event
* @param name
* the project name, or <code>null</code>
* @throws CoreException
* if an error occurs
*/
private void processHistoryNotification(final IFileStore store, final RefactoringHistoryEvent event, final String name) throws CoreException {
final RefactoringDescriptorProxy proxy = event.getDescriptor();
final int type = event.getEventType();
final RefactoringHistoryManager manager = new RefactoringHistoryManager(store, name);
final NullProgressMonitor monitor = new NullProgressMonitor();
if (type == RefactoringHistoryEvent.PUSHED || type == RefactoringHistoryEvent.ADDED) {
final RefactoringDescriptor descriptor = proxy.requestDescriptor(monitor);
if (descriptor != null)
manager.addRefactoringDescriptor(descriptor, type == RefactoringHistoryEvent.ADDED, monitor);
} else if (type == RefactoringHistoryEvent.POPPED)
manager.removeRefactoringDescriptors(new RefactoringDescriptorProxy[] { proxy }, monitor, RefactoringCoreMessages.RefactoringHistoryService_updating_history);
}
Aggregations