@@ -221,7 +221,7 @@ define(function (require, exports, module) {
221221 }
222222
223223 function _createFileEntries ( $mrofList ) {
224- var data , fileEntry , $link , $newItem ;
224+ var data , fileEntry , $link , $newItem , $removeBtn ;
225225 // Iterate over the MROF list and create the pop over UI items
226226
227227 // If we are in split view we might want to show the panes corresponding to the entries
@@ -270,35 +270,41 @@ define(function (require, exports, module) {
270270 ViewUtils . getFileEntryDisplay ( { name : FileUtils . getBaseName ( value . file ) } )
271271 ) ;
272272
273- // Create remove button
274- var $removeBtn = $ ( "<span class='remove-file'>×</span>" ) . on ( "click" , function ( e ) {
275- e . preventDefault ( ) ;
276- e . stopPropagation ( ) ;
273+ // Create remove button only for files not in working set
274+ $removeBtn = null ;
275+ if ( indxInWS === - 1 ) {
276+ $removeBtn = $ ( "<span class='remove-file'>×</span>" ) . on ( "click" , function ( e ) {
277+ e . preventDefault ( ) ;
278+ e . stopPropagation ( ) ;
277279
278- // Find and remove the entry from _mrofList
279- var filePath = $ ( this ) . parent ( ) . data ( "path" ) ;
280- var paneId = $ ( this ) . parent ( ) . data ( "paneId" ) ;
280+ // Find and remove the entry from _mrofList
281+ var filePath = $ ( this ) . parent ( ) . data ( "path" ) ;
282+ var paneId = $ ( this ) . parent ( ) . data ( "paneId" ) ;
281283
282- _mrofList = _mrofList . filter ( function ( entry ) {
283- return ! ( entry && entry . file === filePath && entry . paneId === paneId ) ;
284- } ) ;
284+ _mrofList = _mrofList . filter ( function ( entry ) {
285+ return ! ( entry && entry . file === filePath && entry . paneId === paneId ) ;
286+ } ) ;
285287
286- // Remove the list item from UI
287- $ ( this ) . parent ( ) . remove ( ) ;
288+ // Remove the list item from UI
289+ $ ( this ) . parent ( ) . remove ( ) ;
288290
289- // Update preferences
290- PreferencesManager . setViewState (
291- OPEN_FILES_VIEW_STATE ,
292- _mrofList ,
293- PreferencesManager . STATE_PROJECT_CONTEXT
294- ) ;
295- } ) ;
291+ // Update preferences
292+ PreferencesManager . setViewState (
293+ OPEN_FILES_VIEW_STATE ,
294+ _mrofList ,
295+ PreferencesManager . STATE_PROJECT_CONTEXT
296+ ) ;
297+ } ) ;
298+ }
296299
297300 // Use the file icon providers
298301 WorkingSetView . useIconProviders ( data , $link ) ;
299302
300- // Create list item with link and remove button
301- $newItem = $ ( "<li></li>" ) . append ( $link ) . append ( $removeBtn ) ;
303+ // Create list item with link and conditionally add remove button
304+ $newItem = $ ( "<li></li>" ) . append ( $link ) ;
305+ if ( $removeBtn ) {
306+ $newItem . append ( $removeBtn ) ;
307+ }
302308
303309 if ( indxInWS !== - 1 ) { // in working set show differently
304310 $newItem . addClass ( "working-set" ) ;
0 commit comments