当前位置: 首页>>代码示例>>Java>>正文


Java RefactoringHistory类代码示例

本文整理汇总了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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:24,代码来源:RefactoringHistoryService.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:JavaModelLabelProvider.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:JavaModelLabelProvider.java

示例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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:JavaModelContentProvider.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:JavaModelAdapterFactory.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:40,代码来源:RefactoringHistoryService.java

示例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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:RefactoringHistoryService.java

示例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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:RefactoringHistoryImplementation.java

示例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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:JavaModelContentProvider.java

示例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();
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:56,代码来源:RefactoringHistoryManager.java

示例13: removeAll

import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; //导入依赖的package包/类
/** {@inheritDoc} */
public RefactoringHistory removeAll(final RefactoringHistory history) {
  return this;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:RefactoringHistoryService.java

示例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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:6,代码来源:RefactoringHistoryService.java

示例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


注:本文中的org.eclipse.ltk.core.refactoring.history.RefactoringHistory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。