mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 15:35:24 +02:00
[380025] [efs] shutdown in certain product shell sharing environments can result in NPE
This commit is contained in:
parent
840bbe1553
commit
447fa34bba
1 changed files with 35 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2009 IBM Corporation. All rights reserved.
|
* Copyright (c) 2012 IBM Corporation. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
* Mike Kucera (IBM) - [241316] [efs] Cannot restore editors for RSE/EFS-backed resources
|
* Mike Kucera (IBM) - [241316] [efs] Cannot restore editors for RSE/EFS-backed resources
|
||||||
* David McKnight (IBM) - [241316] [efs] Cannot restore editors for RSE/EFS-backed resources
|
* 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) - [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;
|
package org.eclipse.rse.internal.efs;
|
||||||
|
|
||||||
|
@ -226,35 +227,45 @@ public class RemoteEditorManager implements ISaveParticipant, IResourceChangeLis
|
||||||
*/
|
*/
|
||||||
public boolean closeRemoteEditors() {
|
public boolean closeRemoteEditors() {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
IWorkbench wb = PlatformUI.getWorkbench();
|
try {
|
||||||
IWorkbenchWindow[] windows = wb.getWorkbenchWindows();
|
IWorkbench wb = PlatformUI.getWorkbench();
|
||||||
for (int w = 0; w < windows.length; w++){
|
if (wb != null){
|
||||||
IWorkbenchWindow win = windows[w];
|
IWorkbenchWindow[] windows = wb.getWorkbenchWindows();
|
||||||
IWorkbenchPage[] pages = win.getPages();
|
if (windows != null){
|
||||||
for (int p = 0; p < pages.length && result; p++){
|
for (int w = 0; w < windows.length; w++){
|
||||||
IWorkbenchPage page = pages[p];
|
IWorkbenchWindow win = windows[w];
|
||||||
IEditorReference[] activeReferences = page.getEditorReferences();
|
IWorkbenchPage[] pages = win.getPages();
|
||||||
for (int er = 0; er < activeReferences.length; er++){
|
if (pages != null){
|
||||||
IEditorReference editorReference = activeReferences[er];
|
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 {
|
try {
|
||||||
IEditorInput input = editorReference.getEditorInput();
|
IEditorInput input = editorReference.getEditorInput();
|
||||||
if (input instanceof FileEditorInput){
|
if (input instanceof FileEditorInput){
|
||||||
IFile file = ((FileEditorInput)input).getFile();
|
IFile file = ((FileEditorInput)input).getFile();
|
||||||
URI uri = file.getLocationURI();
|
URI uri = file.getLocationURI();
|
||||||
if ("rse".equals(uri.getScheme())) { //$NON-NLS-1$
|
if ("rse".equals(uri.getScheme())) { //$NON-NLS-1$
|
||||||
IEditorPart editor = editorReference.getEditor(false);
|
IEditorPart editor = editorReference.getEditor(false);
|
||||||
|
|
||||||
// close the editor
|
// close the editor
|
||||||
result = page.closeEditor(editor, true);
|
result = page.closeEditor(editor, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (PartInitException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (PartInitException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue