[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tm-cvs-commit] dmcknight org.eclipse.tm.rse/plugins/org.eclipse.rse.efs/src/org/eclipse/rse/internal/efs RemoteEditorManager.java

Update of /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.efs/src/org/eclipse/rse/internal/efs
In directory dev1:/tmp/cvs-serv21835/src/org/eclipse/rse/internal/efs

Modified Files:
	RemoteEditorManager.java 
Log Message:
[380025] [efs] shutdown in certain product shell sharing environments can result in NPE


Index: RemoteEditorManager.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.tm.rse/plugins/org.eclipse.rse.efs/src/org/eclipse/rse/internal/efs/RemoteEditorManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RemoteEditorManager.java	8 Oct 2009 14:06:25 -0000	1.3
--- RemoteEditorManager.java	18 May 2012 22:06:22 -0000	1.4
***************
*** 1,4 ****
  /********************************************************************************
!  * Copyright (c) 2009 IBM Corporation. All rights reserved.
   * This program and the accompanying materials are made available under the terms
   * of the Eclipse Public License v1.0 which accompanies this distribution, and is
--- 1,4 ----
  /********************************************************************************
!  * Copyright (c) 2012 IBM Corporation. All rights reserved.
   * This program and the accompanying materials are made available under the terms
   * of the Eclipse Public License v1.0 which accompanies this distribution, and is
***************
*** 13,16 ****
--- 13,17 ----
   * David McKnight      (IBM) - [241316] [efs] Cannot restore editors for RSE/EFS-backed resources
   * David McKnight  (IBM)         - [291738] [efs] repeated queries to RSEFileStoreImpl.fetchInfo() in short time-span should be reduced
+  * David McKnight      (IBM) - [380025] [efs] shutdown in certain product shell sharing environments can result in NPE
   ********************************************************************************/
  package org.eclipse.rse.internal.efs;
***************
*** 227,259 ****
  	public boolean closeRemoteEditors() {
  		boolean result = true;
! 		IWorkbench wb = PlatformUI.getWorkbench();
! 		IWorkbenchWindow[] windows = wb.getWorkbenchWindows();
! 		for (int w = 0; w < windows.length; w++){
! 			IWorkbenchWindow win = windows[w];
! 			IWorkbenchPage[] pages = win.getPages();
! 			for (int p = 0; p < pages.length && result; p++){
! 				IWorkbenchPage page = pages[p];
! 				IEditorReference[] activeReferences = page.getEditorReferences();
! 				for (int er = 0; er < activeReferences.length; er++){
! 					IEditorReference editorReference = activeReferences[er];
! 
! 					try {
! 						IEditorInput input = editorReference.getEditorInput();
! 						if (input instanceof FileEditorInput){
! 							IFile file = ((FileEditorInput)input).getFile();
! 							URI uri = file.getLocationURI();
! 							if ("rse".equals(uri.getScheme())) { //$NON-NLS-1$
! 								IEditorPart editor = editorReference.getEditor(false);
! 
! 								// close the editor
! 								result = page.closeEditor(editor, true);
  							}
  						}
- 					} catch (PartInitException e){
- 						e.printStackTrace();
  					}
  				}
  			}
  		}
  		return result;
  	}
--- 228,270 ----
  	public boolean closeRemoteEditors() {
  		boolean result = true;
! 		try {
! 			IWorkbench wb = PlatformUI.getWorkbench();
! 			if (wb != null){
! 				IWorkbenchWindow[] windows = wb.getWorkbenchWindows();
! 				if (windows != null){
! 					for (int w = 0; w < windows.length; w++){
! 						IWorkbenchWindow win = windows[w];
! 						IWorkbenchPage[] pages = win.getPages();
! 						if (pages != null){
! 							for (int p = 0; p < pages.length && result; p++){
! 								IWorkbenchPage page = pages[p];
! 								IEditorReference[] activeReferences = page.getEditorReferences();
! 								for (int er = 0; er < activeReferences.length; er++){
! 									IEditorReference editorReference = activeReferences[er];
! 				
! 									try {
! 										IEditorInput input = editorReference.getEditorInput();
! 										if (input instanceof FileEditorInput){
! 											IFile file = ((FileEditorInput)input).getFile();
! 											URI uri = file.getLocationURI();
! 											if ("rse".equals(uri.getScheme())) { //$NON-NLS-1$
! 												IEditorPart editor = editorReference.getEditor(false);
! 				
! 												// close the editor
! 												result = page.closeEditor(editor, true);
! 											}
! 										}
! 									} catch (PartInitException e){
! 										e.printStackTrace();
! 									}
! 								}
  							}
  						}
  					}
  				}
  			}
  		}
+ 		catch (Exception e){			
+ 		}
  		return result;
  	}