} catch (InterruptedException x) { } catch (InvocationTargetException x) {  Throwable t= x.getTargetException(); if (t instanceof CoreException) { CoreException cx= (CoreException) t; ErrorDialog.openError(shell, JavaEditorMessages.getString("CompilationUnitEditor.error.saving.title2"), JavaEditorMessages.getString("CompilationUnitEditor.error.saving.message2"), cx.getStatus()); } else { MessageDialog.openError(shell, JavaEditorMessages.getString("CompilationUnitEditor.error.saving.title3"), JavaEditorMessages.getString("CompilationUnitEditor.error.saving.message3") + t.getMessage()); }
} catch (CoreException x) { ErrorDialog.openError(shell, JavaEditorMessages.getString("CompilationUnitEditor.error.saving.title2"), JavaEditorMessages.getString("CompilationUnitEditor.error.saving.message2"), x.getStatus());
	protected void performSaveAs(IProgressMonitor progressMonitor) {				Shell shell= getSite().getShell();		IEditorInput input = getEditorInput();				SaveAsDialog dialog= new SaveAsDialog(shell);				IFile original= (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile() : null;		if (original != null)			dialog.setOriginalFile(original);					dialog.create();							IDocumentProvider provider= getDocumentProvider();		if (provider == null) {			// editor has been programmatically closed while the dialog was open			return;		}				if (provider.isDeleted(input) && original != null) {			String message= JavaEditorMessages.getFormattedString("CompilationUnitEditor.warning.save.delete", new Object[] { original.getName() }); //$NON-NLS-1$			dialog.setErrorMessage(null);			dialog.setMessage(message, IMessageProvider.WARNING);		}					if (dialog.open() == Window.CANCEL) {			if (progressMonitor != null)				progressMonitor.setCanceled(true);			return;		}					IPath filePath= dialog.getResult();		if (filePath == null) {			if (progressMonitor != null)				progressMonitor.setCanceled(true);			return;		}					IWorkspaceRoot workspaceRoot= ResourcesPlugin.getWorkspace().getRoot();		IFile file= workspaceRoot.getFile(filePath);		final IEditorInput newInput= new FileEditorInput(file);				ISchedulingRule scheduleRule= file.getParent();		//      Cannot yet release: this operation calls a nested operation//		which wants to lock the whole workspace.//		if (scheduleRule == null)			scheduleRule= workspaceRoot;				WorkspaceModifyOperation op= new WorkspaceModifyOperation(scheduleRule) {			public void execute(final IProgressMonitor monitor) throws CoreException {				getDocumentProvider().saveDocument(monitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);			}		};				boolean success= false;		try {						provider.aboutToChange(newInput);			new ProgressMonitorDialog(shell).run(false, true, op);			success= true;					} catch (InterruptedException x) {		} catch (InvocationTargetException x) {						Throwable t= x.getTargetException();			if (t instanceof CoreException) {				CoreException cx= (CoreException) t;				ErrorDialog.openError(shell, JavaEditorMessages.getString("CompilationUnitEditor.error.saving.title2"), JavaEditorMessages.getString("CompilationUnitEditor.error.saving.message2"), cx.getStatus()); //$NON-NLS-1$ //$NON-NLS-2$			} else {				MessageDialog.openError(shell, JavaEditorMessages.getString("CompilationUnitEditor.error.saving.title3"), JavaEditorMessages.getString("CompilationUnitEditor.error.saving.message3") + t.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$			}								} finally {			provider.changed(newInput);			if (success)				setInput(newInput);		}				if (progressMonitor != null)			progressMonitor.setCanceled(!success);	}