Java Code Examples for org.eclipse.core.resources.IResource#KEEP_HISTORY
The following examples show how to use
org.eclipse.core.resources.IResource#KEEP_HISTORY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeletePackageFragmentRootChange.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected Change doDelete(IProgressMonitor pm) throws CoreException { if (! confirmDeleteIfReferenced()) return new NullChange(); int resourceUpdateFlags= IResource.KEEP_HISTORY; int jCoreUpdateFlags= IPackageFragmentRoot.ORIGINATING_PROJECT_CLASSPATH | IPackageFragmentRoot.OTHER_REFERRING_PROJECTS_CLASSPATH; pm.beginTask("", 2); //$NON-NLS-1$ IPackageFragmentRoot root= getRoot(); IResource rootResource= root.getResource(); CompositeChange result= new CompositeChange(getName()); ResourceDescription rootDescription = ResourceDescription.fromResource(rootResource); IJavaProject[] referencingProjects= JavaElementUtil.getReferencingProjects(root); HashMap<IFile, String> classpathFilesContents= new HashMap<IFile, String>(); for (int i= 0; i < referencingProjects.length; i++) { IJavaProject javaProject= referencingProjects[i]; IFile classpathFile= javaProject.getProject().getFile(".classpath"); //$NON-NLS-1$ if (classpathFile.exists()) { classpathFilesContents.put(classpathFile, getFileContents(classpathFile)); } } root.delete(resourceUpdateFlags, jCoreUpdateFlags, new SubProgressMonitor(pm, 1)); rootDescription.recordStateFromHistory(rootResource, new SubProgressMonitor(pm, 1)); for (Iterator<Entry<IFile, String>> iterator= classpathFilesContents.entrySet().iterator(); iterator.hasNext();) { Entry<IFile, String> entry= iterator.next(); IFile file= entry.getKey(); String contents= entry.getValue(); //Restore time stamps? This should probably be some sort of UndoTextFileChange. TextFileChange classpathUndo= new TextFileChange(Messages.format(RefactoringCoreMessages.DeletePackageFragmentRootChange_restore_file, BasicElementLabels.getPathLabel(file.getFullPath(), true)), file); classpathUndo.setEdit(new ReplaceEdit(0, getFileLength(file), contents)); result.add(classpathUndo); } result.add(new UndoDeleteResourceChange(rootDescription)); pm.done(); return result; }
Example 2
Source File: DeletePackageFragmentRootChange.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override protected Change doDelete(IProgressMonitor pm) throws CoreException { if (! confirmDeleteIfReferenced()) { return new NullChange(); } int resourceUpdateFlags= IResource.KEEP_HISTORY; int jCoreUpdateFlags= IPackageFragmentRoot.ORIGINATING_PROJECT_CLASSPATH | IPackageFragmentRoot.OTHER_REFERRING_PROJECTS_CLASSPATH; pm.beginTask("", 2); //$NON-NLS-1$ IPackageFragmentRoot root= getRoot(); IResource rootResource= root.getResource(); CompositeChange result= new CompositeChange(getName()); IJavaProject[] referencingProjects= JavaElementUtil.getReferencingProjects(root); HashMap<IFile, String> classpathFilesContents= new HashMap<>(); for (int i= 0; i < referencingProjects.length; i++) { IJavaProject javaProject= referencingProjects[i]; IFile classpathFile= javaProject.getProject().getFile(".classpath"); //$NON-NLS-1$ if (classpathFile.exists()) { classpathFilesContents.put(classpathFile, getFileContents(classpathFile)); } } root.delete(resourceUpdateFlags, jCoreUpdateFlags, new SubProgressMonitor(pm, 1)); // TODO can't port org.eclipse.ui.ide.undo.ResourceDescription.class // ResourceDescription rootDescription = ResourceDescription.fromResource(rootResource); // rootDescription.recordStateFromHistory(rootResource, new SubProgressMonitor(pm, 1)); for (Iterator<Entry<IFile, String>> iterator= classpathFilesContents.entrySet().iterator(); iterator.hasNext();) { Entry<IFile, String> entry= iterator.next(); IFile file= entry.getKey(); String contents= entry.getValue(); //Restore time stamps? This should probably be some sort of UndoTextFileChange. TextFileChange classpathUndo= new TextFileChange(Messages.format(RefactoringCoreMessages.DeletePackageFragmentRootChange_restore_file, BasicElementLabels.getPathLabel(file.getFullPath(), true)), file); classpathUndo.setEdit(new ReplaceEdit(0, getFileLength(file), contents)); result.add(classpathUndo); } // result.add(new UndoDeleteResourceChange(rootDescription)); pm.done(); return result; }
Example 3
Source File: PackageFragmentRootReorgChange.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
protected int getResourceUpdateFlags(){ return IResource.KEEP_HISTORY | IResource.SHALLOW; }
Example 4
Source File: CopyResourceChange.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private int getReorgFlags() { return IResource.KEEP_HISTORY | IResource.SHALLOW; }
Example 5
Source File: PackageFragmentRootReorgChange.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
protected int getResourceUpdateFlags(){ return IResource.KEEP_HISTORY | IResource.SHALLOW; }
Example 6
Source File: CopyResourceChange.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private int getReorgFlags() { return IResource.KEEP_HISTORY | IResource.SHALLOW; }