Map mapping= SourceReferenceUtil.groupByFile(getElementsToProcess(selection)); if (areAllFilesReadOnly(mapping)){ String title= ReorgMessages.getString("DeleteSourceReferencesAction.title"); String label= ReorgMessages.getString("DeleteSourceReferencesAction.read_only"); MessageDialog.openInformation(JavaPlugin.getActiveWorkbenchShell(), title, label); return; }  List emptyCuList= Arrays.asList(getCusLeftEmpty(mapping));  for (Iterator iter= mapping.keySet().iterator(); iter.hasNext();) { IFile file= (IFile)iter.next(); if (emptyCuList.contains(JavaCore.create(file))) continue; if (isReadOnly(file)) continue; deleteAll(mapping, file); }  ICompilationUnit[] notDeleted= deleteEmptyCus(mapping); for (int i= 0; i < notDeleted.length; i++) { IFile file= (IFile)notDeleted[i].getUnderlyingResource(); if (isReadOnly(file)) continue; deleteAll(mapping, file); }
try { new ProgressMonitorDialog(getShell()).run(false, true, createDeleteOperation(selection)); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, getShell(), "Delete", "An error occurred while performing this operation. See log for details."); } catch (InterruptedException e) {  }
	protected void perform(IStructuredSelection selection) throws CoreException {		if (fAskForDeleteConfirmation && !confirmDelete())			return;		Map mapping= SourceReferenceUtil.groupByFile(getElementsToProcess(selection)); //IFile -> List of ISourceReference (elements from that file)		if (areAllFilesReadOnly(mapping)){			String title= ReorgMessages.getString("DeleteSourceReferencesAction.title"); //$NON-NLS-1$			String label= ReorgMessages.getString("DeleteSourceReferencesAction.read_only");  //$NON-NLS-1$			MessageDialog.openInformation(JavaPlugin.getActiveWorkbenchShell(), title, label);			return;		}							List emptyCuList= Arrays.asList(getCusLeftEmpty(mapping));				for (Iterator iter= mapping.keySet().iterator(); iter.hasNext();) {			IFile file= (IFile)iter.next();			if (emptyCuList.contains(JavaCore.create(file))) //do not delete in these files				continue;			if (isReadOnly(file))				continue;			deleteAll(mapping, file);		}				ICompilationUnit[] notDeleted= deleteEmptyCus(mapping);		for (int i= 0; i < notDeleted.length; i++) {			IFile file= (IFile)notDeleted[i].getUnderlyingResource();			if (isReadOnly(file))				continue;			deleteAll(mapping, file);		}	}