<s> package org . eclipse . jdt . internal . core ; import org . eclipse . core . resources . ResourcesPlugin ; import org . eclipse . core . runtime . jobs . ISchedulingRule ; import org . eclipse . jdt . core . IJavaElement ; import org . eclipse . jdt . core . JavaModelException ; public abstract class ChangeClasspathOperation extends JavaModelOperation { protected boolean canChangeResources ; public ChangeClasspathOperation ( IJavaElement [ ] elements , boolean canChangeResources ) { super ( elements ) ; this . canChangeResources = canChangeResources ; } protected boolean canModifyRoots ( ) { return true ; } protected void classpathChanged ( ClasspathChange change , boolean refreshExternalFolder ) throws JavaModelException { JavaProject project = change . project ; project . resetCaches ( ) ; if ( this . canChangeResources ) { if ( isTopLevelOperation ( ) && ! ResourcesPlugin . getWorkspace ( ) . isTreeLocked ( ) ) { new ClasspathValidation ( project ) . validate ( ) ; } new ProjectReferenceChange ( project , change . oldResolvedClasspath ) . updateProjectReferencesIfNecessary ( ) ; new ExternalFolderChange ( project , change . oldResolvedClasspath ) . updateExternalFoldersIfNecessary ( refreshExternalFolder , null ) ; } else { DeltaProcessingState state = JavaModelManager . getDeltaState ( ) ; JavaElementDelta delta = new JavaElementDelta ( getJavaModel ( ) ) ; int result = change . generateDelta ( delta , true ) ; if ( ( result & ClasspathChange . HAS_DELTA ) != 0 ) { addDelta ( delta ) ; state . rootsAreStale = true ; change . requestIndexing ( ) ; state . addClasspathValidation ( project ) ; } if ( ( result & ClasspathChange . HAS_PROJECT_CHANGE ) != 0 ) { state . addProjectReferenceChange ( project , change . oldResolvedClasspath ) ; } if ( ( result & ClasspathChange . HAS_LIBRARY_CHANGE ) != 0 ) { state . addExternalFolderChange ( project , change . oldResolvedClasspath ) ; } } } protected ISchedulingRule getSchedulingRule ( ) { return null ; } public boolean isReadOnly ( ) { return ! this . canChangeResources ; } } </s>