本文整理汇总了Java中org.eclipse.ltk.core.refactoring.history.RefactoringHistory类的典型用法代码示例。如果您正苦于以下问题:Java RefactoringHistory类的具体用法?Java RefactoringHistory怎么用?Java RefactoringHistory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RefactoringHistory类属于org.eclipse.ltk.core.refactoring.history包,在下文中一共展示了RefactoringHistory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readRefactoringHistory
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/** {@inheritDoc} */
public RefactoringHistory readRefactoringHistory(final InputStream stream, final int flags)
throws CoreException {
Assert.isNotNull(stream);
Assert.isTrue(flags >= RefactoringDescriptor.NONE);
final List list = new ArrayList();
final RefactoringSessionDescriptor descriptor =
new RefactoringSessionReader(false, null).readSession(new InputSource(stream));
if (descriptor != null) {
final RefactoringDescriptor[] descriptors = descriptor.getRefactorings();
if (flags > RefactoringDescriptor.NONE) {
for (int index = 0; index < descriptors.length; index++) {
final int current = descriptors[index].getFlags();
if ((current | flags) == current) list.add(descriptors[index]);
}
} else list.addAll(Arrays.asList(descriptors));
}
final RefactoringDescriptorProxy[] proxies = new RefactoringDescriptorProxy[list.size()];
for (int index = 0; index < list.size(); index++)
proxies[index] =
new RefactoringDescriptorProxyAdapter((RefactoringDescriptor) list.get(index));
return new RefactoringHistoryImplementation(proxies);
}
示例2: getImage
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Image getImage(final Object element) {
if (element instanceof IFolder) {
final IFolder folder= (IFolder) element;
if (!isInJavaProject(folder))
return null;
if (folder.getName().equals(NAME_SETTINGS_FOLDER)) {
if (fSettingsImage == null || fSettingsImage.isDisposed())
fSettingsImage= JavaPluginImages.DESC_OBJS_PROJECT_SETTINGS.createImage();
return decorateImage(fSettingsImage, element);
}
}
Image image= super.getImage(element);
if (image == null) {
if (element instanceof RefactoringHistory)
image= fHistoryLabelProvider.getImage(element);
else if (element instanceof RefactoringDescriptorProxy)
image= fHistoryLabelProvider.getImage(element);
return decorateImage(image, element);
}
return image;
}
示例3: getText
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String getText(final Object element) {
if (element instanceof IFolder) {
final IFolder folder= (IFolder) element;
if (!isInJavaProject(folder))
return null;
if (folder.getName().equals(NAME_SETTINGS_FOLDER))
return decorateText(fPreferencesLabel, element);
}
String text= super.getText(element);
if (text == null || "".equals(text)) { //$NON-NLS-1$
if (element instanceof RefactoringHistory)
text= fRefactoringsLabel;
else if (element instanceof RefactoringDescriptorProxy)
text= fHistoryLabelProvider.getText(element);
return decorateText(text, element);
}
return text;
}
示例4: getChildren
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Object[] getChildren(final Object element) {
if (element instanceof ICompilationUnit)
return NO_CHILDREN;
else if (element instanceof RefactoringHistory)
return ((RefactoringHistory) element).getDescriptors();
else if (element instanceof IJavaProject) {
final List<Object> elements= new ArrayList<Object>();
elements.add(((IJavaProject) element).getProject().getFolder(NAME_SETTINGS_FOLDER));
final Object[] children= super.getChildren(element);
for (int index= 0; index < children.length; index++) {
if (!elements.contains(children[index]))
elements.add(children[index]);
}
return elements.toArray();
} else if (element instanceof IFolder) {
final IFolder folder= (IFolder) element;
try {
return folder.members();
} catch (CoreException exception) {
// Do nothing
}
}
return super.getChildren(element);
}
示例5: getAdapter
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Object getAdapter(final Object adaptable, final Class adapter) {
if (adaptable instanceof JavaModelProvider) {
if (adapter == IResourceMappingMerger.class)
return new JavaModelMerger((ModelProvider) adaptable);
else if (adapter == ISynchronizationCompareAdapter.class)
return new JavaSynchronizationCompareAdapter();
} else if (adaptable instanceof RefactoringHistory) {
if (adapter == ResourceMapping.class)
return new JavaRefactoringHistoryResourceMapping((RefactoringHistory) adaptable);
else if (adapter == IResource.class)
return new JavaRefactoringHistoryResourceMapping((RefactoringHistory) adaptable).getResource();
} else if (adaptable instanceof RefactoringDescriptorProxy) {
if (adapter == ResourceMapping.class)
return new JavaRefactoringDescriptorResourceMapping((RefactoringDescriptorProxy) adaptable);
}
return null;
}
示例6: getChildrenInContext
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Object[] getChildrenInContext(final ISynchronizationContext context, final Object parent, final Object[] children) {
final Object[] elements= super.getChildrenInContext(context, parent, children);
if (parent instanceof IPackageFragment)
return getPackageFragmentChildren(context, parent, elements);
else if (parent instanceof IPackageFragmentRoot)
return getPackageFragmentRootChildren(context, parent, elements);
else if (parent instanceof IJavaProject)
return getJavaProjectChildren(context, parent, elements);
else if (parent instanceof RefactoringHistory)
return ((RefactoringHistory) parent).getDescriptors();
// It may be the case that the elements are folders that have a corresponding
// source folder in which case they should be filtered out
return getFilteredElements(parent, elements);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:JavaSynchronizationContentProvider.java
示例7: getProjectHistory
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/** {@inheritDoc} */
public RefactoringHistory getProjectHistory(
final IProject project,
final long start,
final long end,
final int flags,
IProgressMonitor monitor) {
Assert.isNotNull(project);
Assert.isTrue(project.exists());
Assert.isTrue(start >= 0);
Assert.isTrue(end >= 0);
Assert.isTrue(flags >= RefactoringDescriptor.NONE);
if (project.isOpen()) {
if (monitor == null) monitor = new NullProgressMonitor();
try {
monitor.beginTask(
RefactoringCoreMessages.RefactoringHistoryService_retrieving_history, 120);
final String name = project.getName();
final RefactoringHistoryManager manager = getManager(name);
if (manager != null) {
RefactoringHistory history =
manager.readRefactoringHistory(start, end, new SubProgressMonitor(monitor, 20));
if (flags > RefactoringDescriptor.NONE) {
final Set set = new HashSet();
filterRefactoringDescriptors(
history.getDescriptors(), set, false, flags, new SubProgressMonitor(monitor, 100));
history =
new RefactoringHistoryImplementation(
(RefactoringDescriptorProxy[])
set.toArray(new RefactoringDescriptorProxy[set.size()]));
}
return history;
}
} finally {
monitor.done();
}
}
return NO_HISTORY;
}
示例8: getWorkspaceHistory
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/** {@inheritDoc} */
public RefactoringHistory getWorkspaceHistory(
final long start, final long end, IProgressMonitor monitor) {
return getRefactoringHistory(
ResourcesPlugin.getWorkspace().getRoot().getProjects(),
start,
end,
RefactoringDescriptor.NONE,
monitor);
}
示例9: removeAll
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/** {@inheritDoc} */
public RefactoringHistory removeAll(final RefactoringHistory history) {
final Set existing = new LinkedHashSet(Arrays.asList(fDescriptorProxies));
final Set other = new HashSet(Arrays.asList(history.getDescriptors()));
existing.removeAll(other);
final RefactoringDescriptorProxy[] proxies = new RefactoringDescriptorProxy[existing.size()];
existing.toArray(proxies);
return new RefactoringHistoryImplementation(proxies);
}
示例10: deconfigureClasspath
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/**
* Deconfigures the classpath of the project after refactoring.
*
* @param monitor
* the progress monitor to use
* @throws CoreException
* if an error occurs while deconfiguring the classpath
*/
private void deconfigureClasspath(final IProgressMonitor monitor) throws CoreException {
try {
monitor.beginTask(JarImportMessages.JarImportWizard_cleanup_import, 300);
if (fJavaProject != null) {
final IClasspathEntry[] entries= fJavaProject.readRawClasspath();
final boolean changed= deconfigureClasspath(entries, new SubProgressMonitor(monitor, 100, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
final RefactoringHistory history= getRefactoringHistory();
final boolean valid= history != null && !history.isEmpty();
if (valid)
RefactoringCore.getUndoManager().flush();
if (valid || changed)
fJavaProject.setRawClasspath(entries, changed, new SubProgressMonitor(monitor, 60, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
}
if (fSourceFolder != null) {
final IFileStore store= EFS.getStore(fSourceFolder.getRawLocationURI());
if (store.fetchInfo(EFS.NONE, new SubProgressMonitor(monitor, 10, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)).exists())
store.delete(EFS.NONE, new SubProgressMonitor(monitor, 10, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
fSourceFolder.delete(true, false, new SubProgressMonitor(monitor, 10, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
fSourceFolder.clearHistory(new SubProgressMonitor(monitor, 10, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
fSourceFolder= null;
}
if (fJavaProject != null) {
try {
fJavaProject.getResource().refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 100, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
} catch (CoreException exception) {
JavaPlugin.log(exception);
}
}
} finally {
fJavaProject= null;
monitor.done();
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:42,代码来源:BinaryRefactoringHistoryWizard.java
示例11: hasChildren
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean hasChildren(final Object element) {
if (element instanceof ICompilationUnit)
return false;
else if (element instanceof RefactoringHistory)
return true;
else if (element instanceof RefactoringDescriptorProxy)
return false;
else if (element instanceof IFolder)
return true;
return super.hasChildren(element);
}
示例12: readRefactoringHistory
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/**
* Reads the refactoring history from disk.
*
* @param start the start time stamp, inclusive
* @param end the end time stamp, inclusive
* @param monitor the progress monitor to use
* @return the refactoring history
*/
RefactoringHistory readRefactoringHistory(
final long start, final long end, final IProgressMonitor monitor) {
try {
monitor.beginTask(RefactoringCoreMessages.RefactoringHistoryService_retrieving_history, 200);
final Set set = new HashSet();
try {
if (fHistoryStore
.fetchInfo(
EFS.NONE,
new SubProgressMonitor(monitor, 20, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL))
.exists())
readRefactoringDescriptorProxies(
fHistoryStore,
fProjectName,
set,
start,
end,
new SubProgressMonitor(monitor, 80),
RefactoringCoreMessages.RefactoringHistoryService_retrieving_history);
final IFileStore store =
EFS.getLocalFileSystem()
.getStore(RefactoringCorePlugin.getDefault().getStateLocation())
.getChild(RefactoringHistoryService.NAME_HISTORY_FOLDER)
.getChild(RefactoringHistoryService.NAME_WORKSPACE_PROJECT);
if (store
.fetchInfo(
EFS.NONE,
new SubProgressMonitor(monitor, 20, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL))
.exists())
readRefactoringDescriptorProxies(
store,
null,
set,
start,
end,
new SubProgressMonitor(monitor, 80),
RefactoringCoreMessages.RefactoringHistoryService_retrieving_history);
} catch (CoreException exception) {
RefactoringCorePlugin.log(exception);
}
final RefactoringDescriptorProxy[] proxies = new RefactoringDescriptorProxy[set.size()];
set.toArray(proxies);
return new RefactoringHistoryImplementation(proxies);
} finally {
monitor.done();
}
}
示例13: removeAll
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/** {@inheritDoc} */
public RefactoringHistory removeAll(final RefactoringHistory history) {
return this;
}
示例14: getRefactoringHistory
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/** {@inheritDoc} */
public RefactoringHistory getRefactoringHistory(
final IProject[] projects, final IProgressMonitor monitor) {
return getRefactoringHistory(projects, 0, Long.MAX_VALUE, RefactoringDescriptor.NONE, monitor);
}
示例15: aboutToPerformHistory
import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected RefactoringStatus aboutToPerformHistory(final IProgressMonitor monitor) {
final RefactoringStatus status= new RefactoringStatus();
try {
fJavaProject= null;
fSourceFolder= null;
fProcessedFragments.clear();
monitor.beginTask(JarImportMessages.JarImportWizard_prepare_import, 520);
status.merge(super.aboutToPerformHistory(new SubProgressMonitor(monitor, 10, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
if (!status.hasFatalError()) {
final IPackageFragmentRoot root= getPackageFragmentRoot();
if (root != null) {
status.merge(checkPackageFragmentRoots(root, new SubProgressMonitor(monitor, 90, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
if (!status.hasFatalError()) {
status.merge(checkSourceAttachmentRefactorings(new SubProgressMonitor(monitor, 20, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)));
if (!status.hasFatalError()) {
final IJavaProject project= root.getJavaProject();
if (project != null) {
final IFolder folder= project.getProject().getFolder(SOURCE_FOLDER + String.valueOf(System.currentTimeMillis()));
try {
fAutoBuild= CoreUtility.setAutoBuilding(false);
final RefactoringHistory history= getRefactoringHistory();
if (history != null && !history.isEmpty())
configureClasspath(project, root, folder, new SubProgressMonitor(monitor, 300, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
} catch (CoreException exception) {
status.merge(RefactoringStatus.createFatalErrorStatus(exception.getLocalizedMessage()));
try {
project.setRawClasspath(project.readRawClasspath(), false, new SubProgressMonitor(monitor, 100, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
} catch (CoreException throwable) {
JavaPlugin.log(throwable);
}
} finally {
if (!status.hasFatalError()) {
fJavaProject= project;
fSourceFolder= folder;
}
}
}
}
}
}
}
} finally {
monitor.done();
}
return status;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:51,代码来源:BinaryRefactoringHistoryWizard.java