Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-03-15 20:07:24 +0000
committerMichael Valenta2004-03-15 20:07:24 +0000
commit990b02a362627892eeb266878b061919f25b0a7f (patch)
tree82dcae0aebea0fdcda9674219bd8e587548b2407
parent07914a7a99185a1693fd6d094860febc27f4a43f (diff)
downloadeclipse.platform.team-990b02a362627892eeb266878b061919f25b0a7f.tar.gz
eclipse.platform.team-990b02a362627892eeb266878b061919f25b0a7f.tar.xz
eclipse.platform.team-990b02a362627892eeb266878b061919f25b0a7f.zip
Fixed NPE possibilities when obtainign selection
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/GlobalRefreshResourceSelectionPage.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/GlobalRefreshResourceSelectionPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/GlobalRefreshResourceSelectionPage.java
index 3f53fbe67..67bf31823 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/GlobalRefreshResourceSelectionPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/subscriber/GlobalRefreshResourceSelectionPage.java
@@ -332,9 +332,18 @@ public class GlobalRefreshResourceSelectionPage extends WizardPage {
}
private IResource[] getResourcesFromSelection() {
- ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().getActivePart().getSite().getSelectionProvider().getSelection();
- if(selection instanceof IStructuredSelection) {
- return Utils.getResources(((IStructuredSelection)selection).toArray());
+ IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (activeWorkbenchWindow != null) {
+ IWorkbenchPart activePart = activeWorkbenchWindow.getPartService().getActivePart();
+ if (activePart != null) {
+ ISelectionProvider selectionProvider = activePart.getSite().getSelectionProvider();
+ if (selectionProvider != null) {
+ ISelection selection = selectionProvider.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ return Utils.getResources(((IStructuredSelection)selection).toArray());
+ }
+ }
+ }
}
return new IResource[0];
}

Back to the top