Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2012-04-27 01:07:11 -0400
committerPawel Piech2012-04-27 01:07:11 -0400
commitfae6ff74493e33acdb1cabc06338970ec76cf6df (patch)
treeb0654ca6307f24dad863fc74c56878427d80a4e6
parent0fa0cd45458ea9d1d82c0b8662ca98066cc57636 (diff)
downloadeclipse.platform.debug-fae6ff74493e33acdb1cabc06338970ec76cf6df.tar.gz
eclipse.platform.debug-fae6ff74493e33acdb1cabc06338970ec76cf6df.tar.xz
eclipse.platform.debug-fae6ff74493e33acdb1cabc06338970ec76cf6df.zip
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java23
1 files changed, 8 insertions, 15 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
index eac1598d2..08203cab3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
@@ -73,11 +73,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
if (fWindow == null) return; // disposed
IWorkbenchPart part = provider.getPart();
- String id = null;
- if (part != null) {
- id = getCombinedPartId(part);
- }
- fProvidersByPartId.put(id, provider);
+ fProvidersByPartId.put( getCombinedPartId(part), provider );
// Check if provider is a window context provider
boolean canSetActive = true;
@@ -107,12 +103,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
public synchronized void removeDebugContextProvider(IDebugContextProvider provider) {
int index = fProviders.indexOf(provider);
if (index >= 0) {
- IWorkbenchPart part = provider.getPart();
- String id = null;
- if (part != null) {
- id = getCombinedPartId(part);
- }
- fProvidersByPartId.remove(id);
+ fProvidersByPartId.remove( getCombinedPartId(provider.getPart()) );
fProviders.remove(index);
IDebugContextProvider activeProvider = getActiveProvider();
if (index == 0) {
@@ -239,7 +230,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
outer: for (Iterator itr = fListenersByPartId.keySet().iterator(); itr.hasNext();) {
String listenerPartId = (String)itr.next();
for (int i = 0; i < fProviders.size(); i++) {
- String providerPartId = getCombinedPartId(((IDebugContextProvider)fProviders.get(i)).getPart());
+ String providerPartId = getCombinedPartId(((IDebugContextProvider)fProviders.get(i)).getPart());
if ((listenerPartId == null && providerPartId == null) ||
(listenerPartId != null && listenerPartId.equals(providerPartId)))
{
@@ -274,7 +265,7 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
outer: for (Iterator itr = fPostListenersByPartId.keySet().iterator(); itr.hasNext();) {
String listenerPartId = (String)itr.next();
for (int i = 0; i < fProviders.size(); i++) {
- String providerPartId = getCombinedPartId(((IDebugContextProvider)fProviders.get(i)).getPart());
+ String providerPartId = getCombinedPartId(((IDebugContextProvider)fProviders.get(i)).getPart());
if ((listenerPartId == null && providerPartId == null) ||
(listenerPartId != null && listenerPartId.equals(providerPartId)))
{
@@ -417,8 +408,10 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
notify(event);
}
- private String getCombinedPartId(IWorkbenchPart part) {
- if (part.getSite() instanceof IViewSite) {
+ private String getCombinedPartId(IWorkbenchPart part) {
+ if (part == null) {
+ return null;
+ } else if (part.getSite() instanceof IViewSite) {
IViewSite site = (IViewSite)part.getSite();
return getCombinedPartId(site.getId(), site.getSecondaryId());

Back to the top